uawdijnntqw1x1x1
IP : 216.73.216.110
Hostname : 6.87.74.97.host.secureserver.net
Kernel : Linux 6.87.74.97.host.secureserver.net 4.18.0-553.83.1.el8_10.x86_64 #1 SMP Mon Nov 10 04:22:44 EST 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
emeraadmin
/
.cpanel
/
.
/
..
/
public_html
/
wp-includes
/
..
/
node_modules
/
..
/
4d695
/
lib.tar
/
/
base/serialize.js000064400000007177151677225100010025 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.map = exports.twiml = exports.bool = exports.object = exports.prefixedCollapsibleMap = exports.iso8601DateTime = exports.iso8601Date = void 0; const dayjs_1 = __importDefault(require("dayjs")); const utc_1 = __importDefault(require("dayjs/plugin/utc")); dayjs_1.default.extend(utc_1.default); /** * @namespace serialize */ /** * Turns a Date object into a string if parameter is a Date otherwise returns the parameter * * @param d - date object to format * @returns date formatted in YYYY-MM-DD form, otherwise the * provided parameter. */ function iso8601Date(date) { if (!date || !(date instanceof Date)) { return date; } else { return dayjs_1.default.utc(date).format("YYYY-MM-DD"); } } exports.iso8601Date = iso8601Date; /** * Turns a Date object into a string if parameter is a Date otherwise returns the parameter * * @param d - date object to format * @returns date formatted in YYYY-MM-DD[T]HH:mm:ss[Z] form, otherwise the * provided parameter. */ function iso8601DateTime(date) { if (!date || !(date instanceof Date)) { return date; } else { return dayjs_1.default.utc(date).format("YYYY-MM-DD[T]HH:mm:ss[Z]"); } } exports.iso8601DateTime = iso8601DateTime; function prefixedCollapsibleMap(m, prefix) { if (!m || typeof m !== "object" || Object.prototype.toString.call(m) !== "[object Object]") { return {}; } function flatten(m, result, previous) { result = result || {}; previous = previous || []; Object.keys(m).forEach((key) => { const unionKeys = [...previous]; if (!unionKeys.includes(key)) { unionKeys.push(key); } if (typeof m[key] === "object" && Object.prototype.toString.call(m[key]) === "[object Object]") { flatten(m[key], result, unionKeys); } else { result[unionKeys.join(".")] = m[key]; } }); return result; } var flattened = flatten(m); var result = flattened; if (prefix) { result = {}; Object.keys(flattened).forEach((key) => { result[prefix + "." + key] = flattened[key]; }); } return result; } exports.prefixedCollapsibleMap = prefixedCollapsibleMap; function object(o) { if (typeof o === "object") { return JSON.stringify(o); } return o; } exports.object = object; /** * Coerces a boolean literal into a string * * @param input - boolean or string to be coerced * @returns a string 'true' or 'false' if passed a boolean, else the value */ function bool(input) { if (typeof input === "string") { return input; } if (typeof input === "boolean" || (typeof input === "object" && Object.prototype.toString.call(input) === "[object Boolean]")) { return input.toString(); } return input; } exports.bool = bool; function twiml(input) { return input.toString(); } exports.twiml = twiml; /** * Maps transform over each element in input if input is an array * * @param input - array to map transform over, if not an array then it is * returned as is. * @returns new array with transform applied to each element. */ function map(input, transform) { if (typeof input === "object" && Array.isArray(input)) { return input.map((element) => transform(element)); } return input; } exports.map = map; base/utility.js000064400000001077151677225100007532 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isValidPathParam = exports.trim = void 0; const INVALID_PATH_PARAM_CHARS = ["/", "?"]; const trim = (str, c = "\\s") => str.replace(new RegExp(`^([${c}]*)(.*?)([${c}]*)$`), "$2"); exports.trim = trim; function isValidPathParam(param) { if (param === null || param === undefined) return false; const paramString = param.toString(); return INVALID_PATH_PARAM_CHARS.every((invalidChar) => !paramString.includes(invalidChar)); } exports.isValidPathParam = isValidPathParam; base/Version.js000064400000024726151677225100007462 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const RestException_1 = __importDefault(require("./RestException")); const utility_1 = require("./utility"); class Version { /** * * Base version object * * @param domain - twilio domain * @param version - api version */ constructor(domain, version) { this._domain = domain; this._version = version; } get domain() { return this._domain; } /** * Generate absolute url from a uri * * @param uri - uri to transform * @returns transformed url */ absoluteUrl(uri) { return this._domain.absoluteUrl(this.relativeUrl(uri)); } /** * Generate relative url from a uri * * @param uri - uri to transform * @returns transformed url */ relativeUrl(uri) { var result = ""; if (typeof this._version === "string") { const version = (0, utility_1.trim)(this._version, "/"); result += version; result += "/"; } if (typeof uri === "string") { uri = (0, utility_1.trim)(uri, "/"); if (result === "") { result += "/"; } result += uri; } return result; } /** * Make a request against the domain * * @param opts - request options * @returns promise that resolves to request response */ request(opts) { return this._domain.request({ ...opts, uri: this.relativeUrl(opts.uri || ""), }); } /** * Create a new record * * @param opts - request options * * @throws Error If response returns non 2xx or 201 status code * * @returns promise that resolves to created record */ create(opts) { var qResponse = this.request(opts); qResponse = qResponse.then(function success(response) { if (response.statusCode < 200 || response.statusCode >= 300) { throw new RestException_1.default(response); } if (typeof response.body === "string") { return JSON.parse(response.body); } return response.body; }); return qResponse; } /** * Fetch an instance of a record * * @param opts - request options * * @throws Error If response returns non 2xx or 3xx status code * * @returns promise that resolves to fetched result */ fetch(opts) { var qResponse = this.request(opts); qResponse = qResponse.then(function success(response) { if (response.statusCode < 200 || response.statusCode >= 400) { throw new RestException_1.default(response); } if (typeof response.body === "string") { return JSON.parse(response.body); } return response.body; }); return qResponse; } /** * Fetch a page of records * * @param opts - request options * @returns promise that resolves to page of records */ page(opts) { return this.request(opts); } /** * Update a record * * @param opts - request options * * @throws Error If response returns non 2xx status code * * @returns promise that resolves to updated result */ update(opts) { var qResponse = this.request(opts); qResponse = qResponse.then(function success(response) { if (response.statusCode < 200 || response.statusCode >= 300) { throw new RestException_1.default(response); } if (typeof response.body === "string") { return JSON.parse(response.body); } return response.body; }); return qResponse; } /** * Delete a record * * @param opts - request options * * @throws Error If response returns a 5xx status * * @returns promise that resolves to true if record was deleted */ remove(opts) { var qResponse = this.request(opts); qResponse = qResponse.then(function success(response) { if (response.statusCode < 200 || response.statusCode >= 300) { throw new RestException_1.default(response); } return response.statusCode === 204; }); return qResponse; } /** * Process limits for list requests * * @param opts.limit - The maximum number of items to fetch * @param opts.pageSize - The maximum number of items to return with every request * */ readLimits(opts) { var limit = opts.limit; var pageSize = opts.pageSize; if ((limit && !Number.isFinite(limit)) || limit <= 0) { throw new TypeError("Parameter limit must be a positive integer"); } if (pageSize && (!Number.isFinite(pageSize) || pageSize <= 0)) { throw new TypeError("Parameter pageSize must be a positive integer"); } if (limit && !pageSize) { pageSize = limit; } return { limit: limit, pageSize: pageSize, }; } setPromiseCallback(operationPromise, callback) { if (typeof callback === "function") { operationPromise = operationPromise .then((value) => callback(null, value)) .catch((error) => callback(error)); } return operationPromise; } /** * For each record instance, executes a provided callback function with that * instance * * @param params - Parameters (Optional) * @param params.limit - Optional maximum number of record instances to * fetch * @param params.pageSize - Optional maximum number of records to return * with every request * @param params.callback - Callback function to call with each * record instance * @param params.done - Optional done function to call when all * records are processed, the limit is reached, or an error occurs. * Receives an error argument if an error occurs. * @param callback - Callback function to call with each record. * Receives a done function argument that will short-circuit the for-each * loop that may accept an error argument. * @returns Returns a promise that resolves when all records * processed or if the limit is reached, and rejects with an error if an * error occurs and is not handled in the user provided done function. */ each(params, callback) { if (typeof params === "function") { callback = params; params = {}; } else { params = params || {}; } if (params.callback) { callback = params.callback; } if (typeof callback === "undefined") { throw new Error("Callback function must be provided"); } let done = false; let doneCalled = false; let currentPage = 1; let currentResource = 0; let limits = {}; let pPending = true; let pResolve; let pReject; if (this._version instanceof Version) { limits = this._version.readLimits({ limit: params.limit, pageSize: params.pageSize, }); } function onComplete(error) { let unhandledError = error; done = true; if (typeof params.done === "function" && !doneCalled) { try { params.done(unhandledError); unhandledError = null; } catch (e) { unhandledError = e; } } doneCalled = true; if (pPending) { if (unhandledError) { pReject(unhandledError); } else { pResolve(); } pPending = false; } } function fetchNextPage(fn) { let promise = fn(); if (typeof promise === "undefined") { onComplete(); return; } promise .then((page) => { try { page.instances.forEach(function (instance) { if (done || (typeof params.limit !== "undefined" && currentResource >= params.limit)) { done = true; return false; } currentResource++; callback?.(instance, onComplete); }); } catch (e) { return onComplete(e); } if (!done) { currentPage++; fetchNextPage(page.nextPage.bind(page)); } else { onComplete(); } }) .catch(onComplete); } return new Promise((resolve, reject) => { pResolve = resolve; pReject = reject; fetchNextPage(this.page.bind(this, Object.assign(params, limits))); }); } list(params, callback) { if (typeof params === "function") { callback = params; params = {}; } else { params = params || {}; } let allResources = []; params.callback = function (resource, done) { allResources.push(resource); if (typeof params.limit !== "undefined" && allResources.length === params.limit) { done(); } }; let operationPromise = new Promise((resolve, reject) => { params.done = function (error) { if (typeof error === "undefined") { resolve(allResources); } else { reject(error); } }; }); if (this._version instanceof Version) { operationPromise = this._version.setPromiseCallback(operationPromise, callback); } this.each(params); return operationPromise; } } exports.default = Version; base/Domain.js000064400000002433151677225100007233 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utility_1 = require("./utility"); /** * Base domain object */ class Domain { /** * Creates a Domain instance * * @param twilio - A Twilio Client * @param baseUrl - Base url for this domain */ constructor(twilio, baseUrl) { this.twilio = twilio; this.baseUrl = baseUrl; } /** * Turn a uri into an absolute url * * @param uri - uri to transform * @returns absolute url */ absoluteUrl(uri) { var result = ""; if (typeof this.baseUrl === "string") { const cleanBaseUrl = (0, utility_1.trim)(this.baseUrl, "/"); result += cleanBaseUrl; result += "/"; } if (typeof uri === "string") { uri = (0, utility_1.trim)(uri, "/"); if (result === "") { result += "/"; } result += uri; } return result; } /** * Make request to this domain * * @param opts - request options * @returns request promise */ request(opts) { return this.twilio.request({ ...opts, uri: this.absoluteUrl(opts.uri), }); } } exports.default = Domain; base/serialize.d.ts000064400000003704151677225100010251 0ustar00import TwiML from "../twiml/TwiML"; /** * @namespace serialize */ /** * Turns a Date object into a string if parameter is a Date otherwise returns the parameter * * @param d - date object to format * @returns date formatted in YYYY-MM-DD form, otherwise the * provided parameter. */ export declare function iso8601Date<T>(date: T | Date): T | string; /** * Turns a Date object into a string if parameter is a Date otherwise returns the parameter * * @param d - date object to format * @returns date formatted in YYYY-MM-DD[T]HH:mm:ss[Z] form, otherwise the * provided parameter. */ export declare function iso8601DateTime<T>(date: T | Date): T | string; /** * Turns a map of params int oa flattened map separated by dots if the parameter is an object, otherwise returns an empty map * * @param m - map to transform * @param prefix - to append to each flattened value * @returns flattened map */ export declare function prefixedCollapsibleMap<T extends {}>(m: T, prefix?: string): T; /** * Turns an object into a JSON string if the parameter is an object, otherwise returns the passed in object * * @param o - json object or array * @returns stringified object */ export declare function object<T>(o: T): T; /** * Coerces a boolean literal into a string * * @param input - boolean or string to be coerced * @returns a string 'true' or 'false' if passed a boolean, else the value */ export declare function bool(input: string | boolean): string | "true" | "false"; export declare function twiml(input: TwiML | string): string; type MapFunction<TInput, TOutput> = (input: TInput) => TOutput; /** * Maps transform over each element in input if input is an array * * @param input - array to map transform over, if not an array then it is * returned as is. * @returns new array with transform applied to each element. */ export declare function map<TInput, TOutput>(input: Array<TInput>, transform: MapFunction<TInput, TOutput>): Array<TOutput>; export {}; base/values.js000064400000000610151677225100007316 0ustar00"use strict"; /** * @namespace values */ Object.defineProperty(exports, "__esModule", { value: true }); exports.of = void 0; /** * Removes all undefined values of an object * * @param obj - object to filter * @returns object with no undefined values */ function of(obj) { return Object.fromEntries(Object.entries(obj).filter((entry) => entry[1] !== undefined)); } exports.of = of; base/utility.d.ts000064400000000177151677225100007766 0ustar00export declare const trim: (str: string, c?: string) => string; export declare function isValidPathParam(param: any): boolean; base/RestException.js000064400000002024151677225100010614 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class RestException extends Error { constructor(response) { super("[HTTP " + response.statusCode + "] Failed to execute request"); const isResponseBodyString = typeof response.body == "string"; const body = isResponseBodyString ? parseResponseBody(response.body) : response.body; this.status = response.statusCode; if (body !== null) { this.message = body.message; this.code = body.code; this.moreInfo = body.more_info; /* jshint ignore:line */ this.details = body.details; } else { this.message = "[HTTP " + response.statusCode + "] Failed to execute request"; } } } exports.default = RestException; function parseResponseBody(response_body) { let body = null; try { body = JSON.parse(response_body); } catch (catchError) { body = null; } return body; } base/values.d.ts000064400000000323151677225100007553 0ustar00/** * @namespace values */ /** * Removes all undefined values of an object * * @param obj - object to filter * @returns object with no undefined values */ export declare function of(obj: Object): Object; base/Version.d.ts000064400000007763151677225100007720 0ustar00import Domain from "./Domain"; import { RequestOpts } from "./BaseTwilio"; export interface PageLimitOptions { /** * The maximum number of items to fetch */ limit: number; /** * The maximum number of items to return with every request */ pageSize: number; } export interface PageLimit { limit: number; pageSize: number; } export default class Version { _domain: Domain; _version: Version | string; /** * * Base version object * * @param domain - twilio domain * @param version - api version */ constructor(domain: Domain, version: string | Version); get domain(): Domain; /** * Generate absolute url from a uri * * @param uri - uri to transform * @returns transformed url */ absoluteUrl(uri: string): string; /** * Generate relative url from a uri * * @param uri - uri to transform * @returns transformed url */ relativeUrl(uri: string): string; /** * Make a request against the domain * * @param opts - request options * @returns promise that resolves to request response */ request(opts: RequestOpts): Promise<any>; /** * Create a new record * * @param opts - request options * * @throws Error If response returns non 2xx or 201 status code * * @returns promise that resolves to created record */ create(opts: RequestOpts): Promise<any>; /** * Fetch an instance of a record * * @param opts - request options * * @throws Error If response returns non 2xx or 3xx status code * * @returns promise that resolves to fetched result */ fetch(opts: RequestOpts): Promise<any>; /** * Fetch a page of records * * @param opts - request options * @returns promise that resolves to page of records */ page(opts: RequestOpts): Promise<any>; /** * Update a record * * @param opts - request options * * @throws Error If response returns non 2xx status code * * @returns promise that resolves to updated result */ update(opts: RequestOpts): Promise<any>; /** * Delete a record * * @param opts - request options * * @throws Error If response returns a 5xx status * * @returns promise that resolves to true if record was deleted */ remove(opts: RequestOpts): Promise<boolean>; /** * Process limits for list requests * * @param opts.limit - The maximum number of items to fetch * @param opts.pageSize - The maximum number of items to return with every request * */ readLimits(opts: PageLimitOptions): PageLimit; setPromiseCallback(operationPromise: any, callback: any): Promise<any>; /** * For each record instance, executes a provided callback function with that * instance * * @param params - Parameters (Optional) * @param params.limit - Optional maximum number of record instances to * fetch * @param params.pageSize - Optional maximum number of records to return * with every request * @param params.callback - Callback function to call with each * record instance * @param params.done - Optional done function to call when all * records are processed, the limit is reached, or an error occurs. * Receives an error argument if an error occurs. * @param callback - Callback function to call with each record. * Receives a done function argument that will short-circuit the for-each * loop that may accept an error argument. * @returns Returns a promise that resolves when all records * processed or if the limit is reached, and rejects with an error if an * error occurs and is not handled in the user provided done function. */ each<T>(params?: any, callback?: (item: T, done: (err?: Error) => void) => void): Promise<void>; list<T>(params?: any, callback?: (error: Error | null, items: T) => any): Promise<any>; } base/BaseTwilio.js000064400000016566151677225100010102 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const RequestClient_1 = __importDefault(require("./RequestClient")); /* jshint ignore:line */ const os = require("os"); /* jshint ignore:line */ const url = require("url"); /* jshint ignore:line */ const moduleInfo = require("../../package.json"); /* jshint ignore:line */ const util = require("util"); /* jshint ignore:line */ const RestException = require("../base/RestException"); /* jshint ignore:line */ var Twilio; (function (Twilio) { /* jshint ignore:start */ /** * Parent class for Twilio Client that implements request & validation logic */ /* jshint ignore:end */ class Client { /* jshint ignore:start */ /** * Create a BaseTwilio instance * * @param username - * The username used for authentication. This is normally account sid, but if using key/secret auth will be * the api key sid. * @param password - * The password used for authentication. This is normally auth token, but if using key/secret auth will be * the secret. * @param opts - The options argument * * @returns A new instance of BaseTwilio */ /* jshint ignore:end */ constructor(username, password, opts) { this.opts = opts || {}; this.env = this.opts.env || {}; this.username = username ?? this.env.TWILIO_ACCOUNT_SID ?? process.env.TWILIO_ACCOUNT_SID ?? (() => { throw new Error("username is required"); })(); this.password = password ?? this.env.TWILIO_AUTH_TOKEN ?? process.env.TWILIO_AUTH_TOKEN ?? (() => { throw new Error("password is required"); })(); this.accountSid = this.opts.accountSid || this.username; this.edge = this.opts.edge ?? this.env.TWILIO_EDGE ?? process.env.TWILIO_EDGE; this.region = this.opts.region ?? this.env.TWILIO_REGION ?? process.env.TWILIO_REGION; this.logLevel = this.opts.logLevel ?? this.env.TWILIO_LOG_LEVEL ?? process.env.TWILIO_LOG_LEVEL; this.autoRetry = this.opts.autoRetry || false; this.maxRetries = this.opts.maxRetries; this.userAgentExtensions = this.opts.userAgentExtensions || []; this._httpClient = this.opts.httpClient; if (this.opts.lazyLoading === false) { this._httpClient = this.httpClient; } if (!this.accountSid.startsWith("AC")) { const apiKeyMsg = this.accountSid.startsWith("SK") ? ". The given SID indicates an API Key which requires the accountSid to be passed as an additional option" : ""; throw new Error("accountSid must start with AC" + apiKeyMsg); } } get httpClient() { if (!this._httpClient) { this._httpClient = new RequestClient_1.default({ autoRetry: this.autoRetry, maxRetries: this.maxRetries, }); } return this._httpClient; } /* jshint ignore:start */ /** * Makes a request to the Twilio API using the configured http client. * Authentication information is automatically added if none is provided. * * @param opts - The options argument */ /* jshint ignore:end */ request(opts) { opts = opts || {}; if (!opts.method) { throw new Error("method is required"); } if (!opts.uri) { throw new Error("uri is required"); } const username = opts.username || this.username; const password = opts.password || this.password; const headers = opts.headers || {}; const pkgVersion = moduleInfo.version; const osName = os.platform(); const osArch = os.arch(); const nodeVersion = process.version; headers["User-Agent"] = util.format("twilio-node/%s (%s %s) node/%s", pkgVersion, osName, osArch, nodeVersion); this.userAgentExtensions?.forEach((extension) => { headers["User-Agent"] += ` ${extension}`; }); headers["Accept-Charset"] = "utf-8"; if (opts.method === "post" && !headers["Content-Type"]) { headers["Content-Type"] = "application/x-www-form-urlencoded"; } if (!headers["Accept"]) { headers["Accept"] = "application/json"; } var uri = new url.URL(opts.uri); uri.hostname = this.getHostname(uri.hostname, this.edge, this.region); return this.httpClient?.request({ method: opts.method, uri: uri.href, username: username, password: password, headers: headers, params: opts.params, data: opts.data, timeout: opts.timeout, allowRedirects: opts.allowRedirects, logLevel: opts.logLevel, }); } /* jshint ignore:start */ /** * Adds a region and/or edge to a given hostname * * @param hostname - A URI hostname (e.g. api.twilio.com) * @param targetEdge - The targeted edge location (e.g. sydney) * @param targetRegion - The targeted region location (e.g. au1) */ /* jshint ignore:end */ getHostname(hostname, targetEdge, targetRegion) { const defaultRegion = "us1"; const domain = hostname.split(".").slice(-2).join("."); const prefix = hostname.split("." + domain)[0]; let [product, edge, region] = prefix.split("."); if (edge && !region) { region = edge; edge = undefined; } region = targetRegion || region || (targetEdge && defaultRegion); if (!region) { return hostname; } edge = targetEdge || edge; return [product, edge, region, domain].filter((part) => part).join("."); } /* jshint ignore:start */ /** * Test if your environment is impacted by a TLS or certificate * change is by sending an HTTP request to the test endpoint * * @throws RestException if the request fails * */ /* jshint ignore:end */ validateSslCert() { return this.httpClient ?.request({ method: "get", uri: "https://tls-test.twilio.com:443", }) .then((response) => { if (response["statusCode"] < 200 || response["statusCode"] >= 300) { throw new RestException(response); } return response; }); } } Twilio.Client = Client; })(Twilio || (Twilio = {})); module.exports = Twilio; base/deserialize.js000064400000004322151677225100010323 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.integer = exports.decimal = exports.rfc2822DateTime = exports.iso8601DateTime = exports.iso8601Date = void 0; const dayjs_1 = __importDefault(require("dayjs")); const utc_1 = __importDefault(require("dayjs/plugin/utc")); dayjs_1.default.extend(utc_1.default); /** * @namespace deserialize */ /** * Parse a string into a Date object * * @param s - Date string in YYYY-MM-DD format * @returns Date object, or the original date string if the argument is not a valid date */ function iso8601Date(s) { return parseDate(s, "YYYY-MM-DD"); } exports.iso8601Date = iso8601Date; /** * Parse a string into a Date object * * @param s - Date string in YYYY-MM-DD[T]HH:mm:ss[Z] format * @returns Date object, or the original date string if the argument is not a valid date */ function iso8601DateTime(s) { return parseDate(s, "YYYY-MM-DD[T]HH:mm:ss[Z]"); } exports.iso8601DateTime = iso8601DateTime; /** * Parse a string into a Date object * * @param s - Date string in ddd, DD MMM YYYY HH:mm:ss [+0000] format * @returns Date object, or the original date string if the argument is not a valid date */ function rfc2822DateTime(s) { return parseDate(s, "ddd, DD MMM YYYY HH:mm:ss [+0000]"); } exports.rfc2822DateTime = rfc2822DateTime; /** * Parse a string into a decimal * * @param d - Decimal value as string * @returns Number, or the original string if the argument is NaN */ function decimal(d) { return parseNumber(d, parseFloat); } exports.decimal = decimal; /** * Parse a string into a integer * * @param i - Integer value as string * @returns Number, or the original string if the argument is NaN */ function integer(i) { return parseNumber(i, parseInt); } exports.integer = integer; function parseDate(s, format) { var m = dayjs_1.default.utc(s, format); if (m.isValid()) { return m.toDate(); } return s; } function parseNumber(n, parser) { var parsed = parser(n); if (typeof parsed === "number" && isNaN(parsed)) { return n; } return parsed; } base/Page.d.ts000064400000006070151677225100007135 0ustar00import Version from "./Version"; import Response from "../http/response"; export interface TwilioResponsePayload { [key: string]: any; first_page_uri: string; next_page_uri: string; page: number; page_size: number; previous_page_uri: string; uri: string; meta?: { key?: string; next_page_url?: string; previous_page_url?: string; }; } interface Solution { [name: string]: any; } export default class Page<TVersion extends Version, TPayload extends TwilioResponsePayload, TResource, TInstance> { nextPageUrl?: string; previousPageUrl?: string; instances: TInstance[]; _version: TVersion; _payload: TPayload; _solution: Solution; /** * * Base page object to maintain request state. * * @param version - A twilio version instance * @param response - The http response * @param solution - path solution */ constructor(version: TVersion, response: Response<string | TPayload>, solution: Solution); /** * Meta keys returned in a list request * * @constant META_KEYS */ static META_KEYS: string[]; /** * Get the url of the previous page of records * * @returns url of the previous page, or undefined if the * previous page URI/URL is not defined. */ getPreviousPageUrl(): string | undefined; /** * Get the url of the next page of records * * @returns url of the next page, or undefined if the * next page URI/URL is not defined. */ getNextPageUrl(): string | undefined; /** * Build a new instance given a json payload * * @param payload - Payload response from the API * @returns instance of a resource */ getInstance(payload: any): TInstance; /** * Load a list of records * * @param resources - json payload of records * @returns list of resources */ loadInstances(resources: TResource[]): TInstance[]; /** * Fetch the next page of records * * @returns promise that resolves to next page of results, * or undefined if there isn't a nextPageUrl undefined. */ nextPage(): Promise<Page<TVersion, TPayload, TResource, TInstance>> | undefined; /** * Fetch the previous page of records * * @returns promise that resolves to previous page of * results, or undefined if there isn't a previousPageUrl undefined. */ previousPage(): Promise<Page<TVersion, TPayload, TResource, TInstance>> | undefined; /** * Parse json response from API * * @param response - API response * * @throws Error If non 200 status code is returned * * @returns json parsed response */ processResponse(response: Response<string | TPayload>): TPayload; /** * Load a page of records * * @param {object} payload json payload * @return {array} the page of records */ loadPage(payload: TPayload): TResource[]; forOwn(obj: object, iteratee: (val: any, key: string, object: object) => void): void; toJSON(): object; } export {}; base/deserialize.d.ts000064400000002421151677225100010555 0ustar00export interface NumberParser { (n: string): number; } /** * @namespace deserialize */ /** * Parse a string into a Date object * * @param s - Date string in YYYY-MM-DD format * @returns Date object, or the original date string if the argument is not a valid date */ export declare function iso8601Date(s: string): string | Date; /** * Parse a string into a Date object * * @param s - Date string in YYYY-MM-DD[T]HH:mm:ss[Z] format * @returns Date object, or the original date string if the argument is not a valid date */ export declare function iso8601DateTime(s: string): string | Date; /** * Parse a string into a Date object * * @param s - Date string in ddd, DD MMM YYYY HH:mm:ss [+0000] format * @returns Date object, or the original date string if the argument is not a valid date */ export declare function rfc2822DateTime(s: string): string | Date; /** * Parse a string into a decimal * * @param d - Decimal value as string * @returns Number, or the original string if the argument is NaN */ export declare function decimal(d: string): string | number; /** * Parse a string into a integer * * @param i - Integer value as string * @returns Number, or the original string if the argument is NaN */ export declare function integer(i: string): string | number; base/Domain.d.ts000064400000001307151677225100007466 0ustar00import { Client as BaseTwilio, RequestOpts } from "./BaseTwilio"; /** * Base domain object */ export default class Domain { twilio: BaseTwilio; baseUrl: string; /** * Creates a Domain instance * * @param twilio - A Twilio Client * @param baseUrl - Base url for this domain */ constructor(twilio: BaseTwilio, baseUrl: string); /** * Turn a uri into an absolute url * * @param uri - uri to transform * @returns absolute url */ absoluteUrl(uri?: string): string; /** * Make request to this domain * * @param opts - request options * @returns request promise */ request(opts: RequestOpts): Promise<any>; } base/RequestClient.js000064400000023050151677225100010611 0ustar00"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const axios_1 = __importDefault(require("axios")); const fs = __importStar(require("fs")); const https_proxy_agent_1 = __importDefault(require("https-proxy-agent")); const qs_1 = __importDefault(require("qs")); const https = __importStar(require("https")); const response_1 = __importDefault(require("../http/response")); const request_1 = __importDefault(require("../http/request")); const DEFAULT_CONTENT_TYPE = "application/x-www-form-urlencoded"; const DEFAULT_TIMEOUT = 30000; const DEFAULT_INITIAL_RETRY_INTERVAL_MILLIS = 100; const DEFAULT_MAX_RETRY_DELAY = 3000; const DEFAULT_MAX_RETRIES = 3; function getExponentialBackoffResponseHandler(axios, opts) { const maxIntervalMillis = opts.maxIntervalMillis; const maxRetries = opts.maxRetries; return function (res) { const config = res.config; if (res.status !== 429) { return res; } const retryCount = (config.retryCount || 0) + 1; if (retryCount <= maxRetries) { config.retryCount = retryCount; const baseDelay = Math.min(maxIntervalMillis, DEFAULT_INITIAL_RETRY_INTERVAL_MILLIS * Math.pow(2, retryCount)); const delay = Math.floor(baseDelay * Math.random()); // Full jitter backoff return new Promise((resolve) => { setTimeout(() => resolve(axios(config)), delay); }); } return res; }; } class RequestClient { /** * Make http request * @param opts - The options passed to https.Agent * @param opts.timeout - https.Agent timeout option. Used as the socket timeout, AND as the default request timeout. * @param opts.keepAlive - https.Agent keepAlive option * @param opts.keepAliveMsecs - https.Agent keepAliveMsecs option * @param opts.maxSockets - https.Agent maxSockets option * @param opts.maxTotalSockets - https.Agent maxTotalSockets option * @param opts.maxFreeSockets - https.Agent maxFreeSockets option * @param opts.scheduling - https.Agent scheduling option * @param opts.autoRetry - Enable auto-retry requests with exponential backoff on 429 responses. Defaults to false. * @param opts.maxRetryDelay - Max retry delay in milliseconds for 429 Too Many Request response retries. Defaults to 3000. * @param opts.maxRetries - Max number of request retries for 429 Too Many Request responses. Defaults to 3. */ constructor(opts) { opts = opts || {}; this.defaultTimeout = opts.timeout || DEFAULT_TIMEOUT; this.autoRetry = opts.autoRetry || false; this.maxRetryDelay = opts.maxRetryDelay || DEFAULT_MAX_RETRY_DELAY; this.maxRetries = opts.maxRetries || DEFAULT_MAX_RETRIES; // construct an https agent let agentOpts = { timeout: this.defaultTimeout, keepAlive: opts.keepAlive, keepAliveMsecs: opts.keepAliveMsecs, maxSockets: opts.maxSockets, maxTotalSockets: opts.maxTotalSockets, maxFreeSockets: opts.maxFreeSockets, scheduling: opts.scheduling, ca: opts.ca, }; // sets https agent CA bundle if defined in CA bundle filepath env variable if (process.env.TWILIO_CA_BUNDLE !== undefined) { if (agentOpts.ca === undefined) { agentOpts.ca = fs.readFileSync(process.env.TWILIO_CA_BUNDLE); } } let agent; if (process.env.HTTP_PROXY) { // Note: if process.env.HTTP_PROXY is set, we're not able to apply the given // socket timeout. See: https://github.com/TooTallNate/node-https-proxy-agent/pull/96 agent = (0, https_proxy_agent_1.default)(process.env.HTTP_PROXY); } else { agent = new https.Agent(agentOpts); } // construct an axios instance this.axios = axios_1.default.create(); this.axios.defaults.headers.post["Content-Type"] = DEFAULT_CONTENT_TYPE; this.axios.defaults.httpsAgent = agent; if (opts.autoRetry) { this.axios.interceptors.response.use(getExponentialBackoffResponseHandler(this.axios, { maxIntervalMillis: this.maxRetryDelay, maxRetries: this.maxRetries, })); } } /** * Make http request * @param opts - The options argument * @param opts.method - The http method * @param opts.uri - The request uri * @param opts.username - The username used for auth * @param opts.password - The password used for auth * @param opts.headers - The request headers * @param opts.params - The request params * @param opts.data - The request data * @param opts.timeout - The request timeout in milliseconds (default 30000) * @param opts.allowRedirects - Should the client follow redirects * @param opts.forever - Set to true to use the forever-agent * @param opts.logLevel - Show debug logs */ request(opts) { if (!opts.method) { throw new Error("http method is required"); } if (!opts.uri) { throw new Error("uri is required"); } var headers = opts.headers || {}; if (!headers.Connection && !headers.connection && opts.forever) { headers.Connection = "keep-alive"; } else if (!headers.Connection && !headers.connection) { headers.Connection = "close"; } let auth = undefined; if (opts.username && opts.password) { auth = Buffer.from(opts.username + ":" + opts.password).toString("base64"); headers.Authorization = "Basic " + auth; } const options = { timeout: opts.timeout || this.defaultTimeout, maxRedirects: opts.allowRedirects ? 10 : 0, url: opts.uri, method: opts.method, headers: opts.headers, proxy: false, validateStatus: (status) => status >= 100 && status < 600, }; if (opts.data && options.headers) { if (options.headers["Content-Type"] === "application/x-www-form-urlencoded") { options.data = qs_1.default.stringify(opts.data, { arrayFormat: "repeat" }); } else if (options.headers["Content-Type"] === "application/json") { options.data = opts.data; } } if (opts.params) { options.params = opts.params; options.paramsSerializer = (params) => { return qs_1.default.stringify(params, { arrayFormat: "repeat" }); }; } const requestOptions = { method: opts.method, url: opts.uri, auth: auth, params: options.params, data: opts.data, headers: opts.headers, }; if (opts.logLevel === "debug") { this.logRequest(requestOptions); } const _this = this; this.lastResponse = undefined; this.lastRequest = new request_1.default(requestOptions); return this.axios(options) .then((response) => { if (opts.logLevel === "debug") { console.log(`response.statusCode: ${response.status}`); console.log(`response.headers: ${JSON.stringify(response.headers)}`); } _this.lastResponse = new response_1.default(response.status, response.data, response.headers); return { statusCode: response.status, body: response.data, headers: response.headers, }; }) .catch((error) => { _this.lastResponse = undefined; throw error; }); } filterLoggingHeaders(headers) { return Object.keys(headers).filter((header) => { return !"authorization".includes(header.toLowerCase()); }); } logRequest(options) { console.log("-- BEGIN Twilio API Request --"); console.log(`${options.method} ${options.url}`); if (options.params) { console.log("Querystring:"); console.log(options.params); } if (options.headers) { console.log("Headers:"); const filteredHeaderKeys = this.filterLoggingHeaders(options.headers); filteredHeaderKeys.forEach((header) => console.log(`${header}: ${options.headers?.header}`)); } console.log("-- END Twilio API Request --"); } } module.exports = RequestClient; base/BaseTwilio.d.ts000064400000005646151677225100010333 0ustar00/// <reference types="node" /> import RequestClient from "./RequestClient"; import { HttpMethod } from "../interfaces"; import { Headers } from "../http/request"; declare namespace Twilio { interface ClientOpts { httpClient?: RequestClient; accountSid?: string; env?: NodeJS.ProcessEnv; edge?: string; region?: string; lazyLoading?: boolean; logLevel?: string; userAgentExtensions?: string[]; autoRetry?: boolean; maxRetries?: number; } interface RequestOpts { method?: HttpMethod; uri?: string; username?: string; password?: string; headers?: Headers; params?: object; data?: object; timeout?: number; allowRedirects?: boolean; logLevel?: string; } /** * Parent class for Twilio Client that implements request & validation logic */ class Client { username: string; password: string; accountSid: string; opts?: ClientOpts; env?: NodeJS.ProcessEnv; edge?: string; region?: string; logLevel?: string; autoRetry: boolean; maxRetries?: number; userAgentExtensions?: string[]; _httpClient?: RequestClient; /** * Create a BaseTwilio instance * * @param username - * The username used for authentication. This is normally account sid, but if using key/secret auth will be * the api key sid. * @param password - * The password used for authentication. This is normally auth token, but if using key/secret auth will be * the secret. * @param opts - The options argument * * @returns A new instance of BaseTwilio */ constructor(username?: string, password?: string, opts?: ClientOpts); get httpClient(): RequestClient; /** * Makes a request to the Twilio API using the configured http client. * Authentication information is automatically added if none is provided. * * @param opts - The options argument */ request(opts: RequestOpts): Promise<any>; /** * Adds a region and/or edge to a given hostname * * @param hostname - A URI hostname (e.g. api.twilio.com) * @param targetEdge - The targeted edge location (e.g. sydney) * @param targetRegion - The targeted region location (e.g. au1) */ getHostname(hostname: string, targetEdge: string | undefined, targetRegion: string | undefined): string; /** * Test if your environment is impacted by a TLS or certificate * change is by sending an HTTP request to the test endpoint * * @throws RestException if the request fails * */ validateSslCert(): Promise<any>; } } export = Twilio; base/RestException.d.ts000064400000000562151677225100011055 0ustar00interface RestExceptionError { status: number; message?: string; code?: number; moreInfo?: string; details?: object; } export default class RestException extends Error implements RestExceptionError { status: number; message: string; code?: number; moreInfo?: string; details?: object; constructor(response: any); } export {}; base/Page.js000064400000013477151677225100006712 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const RestException_1 = __importDefault(require("./RestException")); class Page { /** * * Base page object to maintain request state. * * @param version - A twilio version instance * @param response - The http response * @param solution - path solution */ constructor(version, response, solution) { let payload = this.processResponse(response); this._version = version; this._payload = payload; this._solution = solution; this.nextPageUrl = this.getNextPageUrl(); this.previousPageUrl = this.getPreviousPageUrl(); this.instances = this.loadInstances(this.loadPage(payload)); } /** * Get the url of the previous page of records * * @returns url of the previous page, or undefined if the * previous page URI/URL is not defined. */ getPreviousPageUrl() { if (this._payload.meta && "previous_page_url" in this._payload.meta && this._payload.meta.previous_page_url) { // jshint ignore:line return this._payload.meta.previous_page_url; // jshint ignore:line } if ("previous_page_uri" in this._payload && this._payload.previous_page_uri) { // jshint ignore:line return this._version._domain.absoluteUrl(this._payload.previous_page_uri); // jshint ignore:line } return undefined; } /** * Get the url of the next page of records * * @returns url of the next page, or undefined if the * next page URI/URL is not defined. */ getNextPageUrl() { if (this._payload.meta && "next_page_url" in this._payload.meta && this._payload.meta.next_page_url) { // jshint ignore:line return this._payload.meta.next_page_url; // jshint ignore:line } if ("next_page_uri" in this._payload && this._payload.next_page_uri) { // jshint ignore:line return this._version._domain.absoluteUrl(this._payload.next_page_uri); // jshint ignore:line } return undefined; } /** * Build a new instance given a json payload * * @param payload - Payload response from the API * @returns instance of a resource */ getInstance(payload) { throw new Error("Page.get_instance() must be implemented in the derived class"); } /** * Load a list of records * * @param resources - json payload of records * @returns list of resources */ loadInstances(resources) { let instances = []; resources.forEach((resource) => { instances.push(this.getInstance(resource)); }); return instances; } /** * Fetch the next page of records * * @returns promise that resolves to next page of results, * or undefined if there isn't a nextPageUrl undefined. */ nextPage() { if (!this.nextPageUrl) { return undefined; } var reqPromise = this._version._domain.twilio.request({ method: "get", uri: this.nextPageUrl, }); var nextPagePromise = reqPromise.then(function (response) { return new this.constructor(this._version, response, this._solution); }.bind(this)); return nextPagePromise; } /** * Fetch the previous page of records * * @returns promise that resolves to previous page of * results, or undefined if there isn't a previousPageUrl undefined. */ previousPage() { if (!this.previousPageUrl) { return undefined; } var reqPromise = this._version._domain.twilio.request({ method: "get", uri: this.previousPageUrl, }); var prevPagePromise = reqPromise.then(function (response) { return new this.constructor(this._version, response, this._solution); }.bind(this)); return prevPagePromise; } /** * Parse json response from API * * @param response - API response * * @throws Error If non 200 status code is returned * * @returns json parsed response */ processResponse(response) { if (response.statusCode !== 200) { throw new RestException_1.default(response); } if (typeof response.body === "string") { return JSON.parse(response.body); } return response.body; } /** * Load a page of records * * @param {object} payload json payload * @return {array} the page of records */ loadPage(payload) { if (payload.meta?.key) { return payload[payload.meta.key]; } const keys = Object.keys(payload).filter((key) => !Page.META_KEYS.includes(key)); if (keys.length === 1) { return payload[keys[0]]; } throw new Error("Page Records cannot be deserialized"); } forOwn(obj, iteratee) { obj = Object(obj); for (const [key, val] of Object.entries(obj)) { iteratee(val, key, obj); } } toJSON() { const clone = {}; this.forOwn(this, (value, key) => { if (!key.startsWith("_") && typeof value !== "function") { clone[key] = value; } }); return clone; } } exports.default = Page; /** * Meta keys returned in a list request * * @constant META_KEYS */ Page.META_KEYS = [ "end", "first_page_uri", "last_page_uri", "next_page_uri", "num_pages", "page", "page_size", "previous_page_uri", "start", "total", "uri", ]; base/RequestClient.d.ts000064400000011477151677225100011057 0ustar00/// <reference types="node" /> import { HttpMethod } from "../interfaces"; import { AxiosInstance } from "axios"; import Response from "../http/response"; import Request, { Headers } from "../http/request"; declare class RequestClient { defaultTimeout: number; axios: AxiosInstance; lastResponse?: Response<any>; lastRequest?: Request<any>; autoRetry: boolean; maxRetryDelay: number; maxRetries: number; /** * Make http request * @param opts - The options passed to https.Agent * @param opts.timeout - https.Agent timeout option. Used as the socket timeout, AND as the default request timeout. * @param opts.keepAlive - https.Agent keepAlive option * @param opts.keepAliveMsecs - https.Agent keepAliveMsecs option * @param opts.maxSockets - https.Agent maxSockets option * @param opts.maxTotalSockets - https.Agent maxTotalSockets option * @param opts.maxFreeSockets - https.Agent maxFreeSockets option * @param opts.scheduling - https.Agent scheduling option * @param opts.autoRetry - Enable auto-retry requests with exponential backoff on 429 responses. Defaults to false. * @param opts.maxRetryDelay - Max retry delay in milliseconds for 429 Too Many Request response retries. Defaults to 3000. * @param opts.maxRetries - Max number of request retries for 429 Too Many Request responses. Defaults to 3. */ constructor(opts?: RequestClient.RequestClientOptions); /** * Make http request * @param opts - The options argument * @param opts.method - The http method * @param opts.uri - The request uri * @param opts.username - The username used for auth * @param opts.password - The password used for auth * @param opts.headers - The request headers * @param opts.params - The request params * @param opts.data - The request data * @param opts.timeout - The request timeout in milliseconds (default 30000) * @param opts.allowRedirects - Should the client follow redirects * @param opts.forever - Set to true to use the forever-agent * @param opts.logLevel - Show debug logs */ request<TData>(opts: RequestClient.RequestOptions<TData>): Promise<Response<TData>>; filterLoggingHeaders(headers: Headers): string[]; private logRequest; } declare namespace RequestClient { interface RequestOptions<TData = any, TParams = object> { /** * The HTTP method */ method: HttpMethod; /** * The request URI */ uri: string; /** * The username used for auth */ username?: string; /** * The password used for auth */ password?: string; /** * The request headers */ headers?: Headers; /** * The object of params added as query string to the request */ params?: TParams; /** * The form data that should be submitted */ data?: TData; /** * The request timeout in milliseconds */ timeout?: number; /** * Should the client follow redirects */ allowRedirects?: boolean; /** * Set to true to use the forever-agent */ forever?: boolean; /** * Set to 'debug' to enable debug logging */ logLevel?: string; } interface RequestClientOptions { /** * A timeout in milliseconds. This will be used as the HTTPS agent's socket * timeout, AND as the default request timeout. */ timeout?: number; /** * https.Agent keepAlive option */ keepAlive?: boolean; /** * https.Agent keepAliveMSecs option */ keepAliveMsecs?: number; /** * https.Agent maxSockets option */ maxSockets?: number; /** * https.Agent maxTotalSockets option */ maxTotalSockets?: number; /** * https.Agent maxFreeSockets option */ maxFreeSockets?: number; /** * https.Agent scheduling option */ scheduling?: "fifo" | "lifo" | undefined; /** * The private CA certificate bundle (if private SSL certificate) */ ca?: string | Buffer; /** * Enable auto-retry with exponential backoff when receiving 429 Errors from * the API. Disabled by default. */ autoRetry?: boolean; /** * Maximum retry delay in milliseconds for 429 Error response retries. * Defaults to 3000. */ maxRetryDelay?: number; /** * Maximum number of request retries for 429 Error responses. Defaults to 3. */ maxRetries?: number; } } export = RequestClient; jwt/ClientCapability.d.ts000064400000003003151677225100011364 0ustar00export interface Scope { scope: string; payload(): string; } export interface OutgoingClientScopeOptions { applicationSid: string; clientName?: string; params?: object; } export interface ClientCapabilityOptions { accountSid: string; authToken: string; ttl?: number; } /** * @param filters */ export declare class EventStreamScope implements Scope { scope: string; filters: object; constructor(filters?: object); payload(): string; } /** * @param clientName */ export declare class IncomingClientScope implements Scope { scope: string; clientName: string; constructor(clientName: string); payload(): string; } export declare class OutgoingClientScope implements Scope { scope: string; applicationSid: string; clientName?: string; params?: object; /** * @param options - ... * @param options.applicationSid - the application sid * @param options.clientName - the client name * @param options.params - parameters */ constructor(options: OutgoingClientScopeOptions); payload(): string; } /** * @param options */ export default class ClientCapability { static EventStreamScope: typeof EventStreamScope; static IncomingClientScope: typeof IncomingClientScope; static OutgoingClientScope: typeof OutgoingClientScope; accountSid: string; authToken: string; ttl: number; scopes: Scope[]; constructor(options: ClientCapabilityOptions); addScope(scope: Scope): void; toJwt(): string; } jwt/AccessToken.d.ts000064400000015306151677225100010357 0ustar00declare class AccessToken implements AccessToken.AccessTokenOptions { static DEFAULT_ALGORITHM: "HS256"; static ALGORITHMS: string[]; accountSid: string; keySid: string; secret: string; ttl: number; identity: string; nbf?: number; region?: string; grants: AccessToken.Grant<any, any, any>[]; /** * @param accountSid - The account's unique ID to which access is scoped * @param keySid - The signing key's unique ID * @param secret - The secret to sign the token with * @param options - ... * @param options.ttl - Time to live in seconds (default 3600) * @param options.identity - The identity of the first person. Required. * @param options.nbf - Time from epoch in seconds for not before value * @param options.region - The region value associated with this account */ constructor(accountSid: string, keySid: string, secret: string, options: AccessToken.AccessTokenOptions); addGrant<T extends AccessToken.Grant<any, any, any>>(grant: T): void; toJwt(algorithm?: "HS256" | "HS384" | "HS512"): string; } declare namespace AccessToken { abstract class Grant<TOptions, TPayload, TKey> { key: TKey; protected constructor(key: TKey); abstract toPayload(): TPayload; } interface TaskRouterGrantOptions { workspaceSid?: string; workerSid?: string; role?: string; } interface TaskRouterGrantPayload { workspace_sid?: string; worker_sid?: string; role?: string; } interface ChatGrantOptions { serviceSid?: string; endpointId?: string; deploymentRoleSid?: string; pushCredentialSid?: string; } interface ChatGrantPayload { service_sid?: string; endpoint_id?: string; deployment_role_sid?: string; push_credential_sid?: string; } interface VideoGrantOptions { room?: string; } interface VideoGrantPayload { room?: string; } interface SyncGrantOptions { serviceSid?: string; endpointId?: string; } interface SyncGrantPayload { service_sid?: string; endpoint_id?: string; } interface VoiceGrantOptions { incomingAllow?: boolean; outgoingApplicationSid?: string; outgoingApplicationParams?: object; pushCredentialSid?: string; endpointId?: string; } interface VoiceGrantPayload { incoming?: { allow: boolean; }; outgoing?: { application_sid: string; params?: object; }; push_credential_sid?: string; endpoint_id?: string; } interface PlaybackGrantOptions { grant?: object; } interface PlaybackGrantPayload { grant?: object; } interface AccessTokenOptions { /** * Time to live in seconds */ ttl?: number; /** * The identity of the first person. Required. */ identity: string; /** * Time from epoch in seconds for not before value */ nbf?: number; /** * The region value associated with this account */ region?: string; } class TaskRouterGrant extends Grant<TaskRouterGrantOptions, TaskRouterGrantPayload, "task_router"> implements TaskRouterGrantOptions { workspaceSid?: string; workerSid?: string; role?: string; /** * @param options - ... * @param options.workspaceSid - The workspace unique ID * @param options.workerSid - The worker unique ID * @param options.role - The role of the grant */ constructor(options?: TaskRouterGrantOptions); toPayload(): TaskRouterGrantPayload; } class ChatGrant extends Grant<ChatGrantOptions, ChatGrantPayload, "chat"> implements ChatGrantOptions { serviceSid?: string; endpointId?: string; deploymentRoleSid?: string; pushCredentialSid?: string; /** * @param options - ... * @param options.serviceSid - The service unique ID * @param options.endpointId - The endpoint ID * @param options.deploymentRoleSid - SID of the deployment role to be * assigned to the user * @param options.pushCredentialSid - The Push Credentials SID */ constructor(options?: ChatGrantOptions); toPayload(): ChatGrantPayload; } class VideoGrant extends Grant<VideoGrantOptions, VideoGrantPayload, "video"> implements VideoGrantOptions { room?: string; /** * @param options - ... * @param options.room - The Room name or Room sid. */ constructor(options?: VideoGrantOptions); toPayload(): VideoGrantPayload; } class SyncGrant extends Grant<SyncGrantOptions, SyncGrantPayload, "data_sync"> implements SyncGrantOptions { serviceSid?: string; endpointId?: string; /** * @param options.serviceSid - The service unique ID * @param options.endpointId - The endpoint ID */ constructor(options?: SyncGrantOptions); toPayload(): SyncGrantPayload; } class VoiceGrant extends Grant<VoiceGrantOptions, VoiceGrantPayload, "voice"> implements VoiceGrantOptions { incomingAllow?: boolean; outgoingApplicationSid?: string; outgoingApplicationParams?: object; pushCredentialSid?: string; endpointId?: string; /** * @param options - ... * @param options.incomingAllow - Whether or not this endpoint is allowed to receive incoming calls as grants.identity * @param options.outgoingApplicationSid - application sid to call when placing outgoing call * @param options.outgoingApplicationParams - request params to pass to the application * @param options.pushCredentialSid - Push Credential Sid to use when registering to receive incoming call notifications * @param options.endpointId - Specify an endpoint identifier for this device, which will allow the developer * to direct calls to a specific endpoint when multiple devices are associated with a single identity */ constructor(options?: VoiceGrantOptions); toPayload(): VoiceGrantPayload; } class PlaybackGrant extends Grant<PlaybackGrantOptions, PlaybackGrantPayload, "player"> implements PlaybackGrantOptions { grant?: object; /** * @param options - ... * @param options.grant - The PlaybackGrant retrieved from Twilio's API */ constructor(options?: PlaybackGrantOptions); toPayload(): PlaybackGrantPayload; } } export = AccessToken; jwt/ClientCapability.js000064400000011026151677225100011134 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.OutgoingClientScope = exports.IncomingClientScope = exports.EventStreamScope = void 0; const jsonwebtoken_1 = __importDefault(require("jsonwebtoken")); const querystring_1 = __importDefault(require("querystring")); /** * @param filters */ class EventStreamScope { constructor(filters) { this.scope = "scope:stream:subscribe"; this.filters = filters || {}; } payload() { var queryArgs = ["path=/2010-04-01/Events"]; if (Object.keys(this.filters).length > 0) { var queryParams = Object.entries(this.filters).map((filter) => { return [querystring_1.default.escape(filter[0]), querystring_1.default.escape(filter[1])].join("="); }); var filterParams = queryParams.join("&"); queryArgs.push(["appParams", querystring_1.default.escape(filterParams)].join("=")); } var queryString = queryArgs.join("&"); return [this.scope, queryString].join("?"); } } exports.EventStreamScope = EventStreamScope; /** * @param clientName */ class IncomingClientScope { constructor(clientName) { this.scope = "scope:client:incoming"; this.clientName = clientName; } payload() { var query = ["clientName", querystring_1.default.escape(this.clientName)].join("="); return [this.scope, query].join("?"); } } exports.IncomingClientScope = IncomingClientScope; class OutgoingClientScope { /** * @param options - ... * @param options.applicationSid - the application sid * @param options.clientName - the client name * @param options.params - parameters */ constructor(options) { this.scope = "scope:client:outgoing"; if (!options) { throw new Error('Required parameter "options" missing.'); } if (typeof options !== "object") { throw new TypeError('Parameter "options" must be a type Object'); } if (!options.applicationSid) { throw new Error('Required parameter "options.applicationSid" missing.'); } this.applicationSid = options.applicationSid; this.clientName = options.clientName; this.params = options.params; } payload() { var queryArgs = [["appSid", querystring_1.default.escape(this.applicationSid)].join("=")]; if (typeof this.clientName === "string") { queryArgs.push(["clientName", querystring_1.default.escape(this.clientName)].join("=")); } if (typeof this.params === "object") { var queryParams = Object.entries(this.params).map((param) => { return [querystring_1.default.escape(param[0]), querystring_1.default.escape(param[1])].join("="); }); var filterParams = queryParams.join("&"); queryArgs.push(["appParams", querystring_1.default.escape(filterParams)].join("=")); } var queryString = queryArgs.join("&"); return [this.scope, queryString].join("?"); } } exports.OutgoingClientScope = OutgoingClientScope; /** * @param options */ class ClientCapability { constructor(options) { if (!options) { throw new Error('Required parameter "options" missing.'); } if (typeof options !== "object") { throw new TypeError('Parameter "options" must be a type Object'); } if (!options.accountSid) { throw new Error('Required parameter "options.accountSid" missing.'); } if (!options.authToken) { throw new Error('Required parameter "options.authToken" missing.'); } this.accountSid = options.accountSid; this.authToken = options.authToken; this.ttl = options.ttl || 3600; this.scopes = []; } addScope(scope) { this.scopes.push(scope); } toJwt() { const scope = this.scopes.map((scope) => scope.payload()).join(" "); var payload = { scope: scope, iss: this.accountSid, exp: Math.floor(new Date().valueOf() / 1000) + this.ttl, }; return jsonwebtoken_1.default.sign(payload, this.authToken); } } exports.default = ClientCapability; ClientCapability.EventStreamScope = EventStreamScope; ClientCapability.IncomingClientScope = IncomingClientScope; ClientCapability.OutgoingClientScope = OutgoingClientScope; jwt/taskrouter/util.d.ts000064400000004225151677225100011333 0ustar00import { Policy } from "./TaskRouterCapability"; /** * Build the default Policies for a worker * * @param version - TaskRouter version * @param workspaceSid - workspace sid * @param workerSid - worker sid * @returns list of Policies */ export declare function defaultWorkerPolicies(version: string, workspaceSid: string, workerSid: string): Policy[]; /** * Build the default Event Bridge Policies * * @param accountSid - account sid * @param channelId - channel id * @returns list of Policies */ export declare function defaultEventBridgePolicies(accountSid: string, channelId: string): Policy[]; /** * Generate TaskRouter workspace url * * @param workspaceSid - workspace sid or '**' for all workspaces * @returns generated url */ export declare function workspacesUrl(workspaceSid?: string): string; /** * Generate TaskRouter task queue url * * @param workspaceSid - workspace sid * @param taskQueueSid - task queue sid or '**' for all task queues * @returns generated url */ export declare function taskQueuesUrl(workspaceSid: string, taskQueueSid?: string): string; /** * Generate TaskRouter task url * * @param workspaceSid - workspace sid * @param taskSid - task sid or '**' for all tasks * @returns generated url */ export declare function tasksUrl(workspaceSid: string, taskSid?: string): string; /** * Generate TaskRouter activity url * * @param workspaceSid - workspace sid * @param activitySid - activity sid or '**' for all activities * @returns generated url */ export declare function activitiesUrl(workspaceSid: string, activitySid?: string): string; /** * Generate TaskRouter worker url * * @param workspaceSid - workspace sid * @param workerSid - worker sid or '**' for all workers * @returns generated url */ export declare function workersUrl(workspaceSid: string, workerSid?: string): string; /** * Generate TaskRouter worker reservation url * * @param workspaceSid - workspace sid * @param workerSid - worker sid * @param reservationSid - reservation sid or '**' for all reservations * @returns generated url */ export declare function reservationsUrl(workspaceSid: string, workerSid: string, reservationSid?: string): string; jwt/taskrouter/TaskRouterCapability.d.ts000064400000003754151677225100014471 0ustar00export interface TaskRouterCapabilityOptions { accountSid: string; authToken: string; workspaceSid: string; channelId: string; friendlyName?: string; ttl?: number; version?: string; } export interface PolicyOptions { /** Policy URL */ url?: string; /** HTTP Method */ method?: string; /** Request query filter allowances */ queryFilter?: object; /** Request post filter allowances */ postFilter?: object; /** Allow the policy */ allow?: boolean; } export interface PolicyPayload { url: string; method: string; query_filter: object; post_filter: object; allow: boolean; } /** * Create a new Policy */ export declare class Policy { url: string; method: string; queryFilter: object; postFilter: object; allow: boolean; /** * Create a new Policy instance * * @param options - ... * @param options.url - Policy URL * @param options.method - HTTP Method * @param options.queryFilter - Request query filter allowances * @param options.postFilter - Request post filter allowances * @param options.allowed - Allow the policy */ constructor(options?: PolicyOptions); payload(): PolicyPayload; } export default class TaskRouterCapability { accountSid: string; authToken: string; workspaceSid: string; channelId: string; ttl: number; version: string; policies: Policy[]; friendlyName?: string; /** * @param options - ... * @param options.accountSid - account sid * @param options.authToken - auth token * @param options.workspaceSid - workspace sid * @param options.channelId - taskrouter channel id * @param options.friendlyName - friendly name for the jwt * @param options.ttl - time to live * @param options.version - taskrouter version */ constructor(options: TaskRouterCapabilityOptions); static Policy: typeof Policy; addPolicy(policy: Policy): void; toJwt(): string; } jwt/taskrouter/util.js000064400000012063151677225100011076 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.reservationsUrl = exports.workersUrl = exports.activitiesUrl = exports.tasksUrl = exports.taskQueuesUrl = exports.workspacesUrl = exports.defaultEventBridgePolicies = exports.defaultWorkerPolicies = void 0; const TaskRouterCapability_1 = require("./TaskRouterCapability"); const EVENT_URL_BASE = "https://event-bridge.twilio.com/v1/wschannels"; const TASKROUTER_BASE_URL = "https://taskrouter.twilio.com"; const TASKROUTER_VERSION = "v1"; /** * Build the default Policies for a worker * * @param version - TaskRouter version * @param workspaceSid - workspace sid * @param workerSid - worker sid * @returns list of Policies */ function defaultWorkerPolicies(version, workspaceSid, workerSid) { var activities = new TaskRouterCapability_1.Policy({ url: [ TASKROUTER_BASE_URL, version, "Workspaces", workspaceSid, "Activities", ].join("/"), method: "GET", allow: true, }); var tasks = new TaskRouterCapability_1.Policy({ url: [ TASKROUTER_BASE_URL, version, "Workspaces", workspaceSid, "Tasks", "**", ].join("/"), method: "GET", allow: true, }); var reservations = new TaskRouterCapability_1.Policy({ url: [ TASKROUTER_BASE_URL, version, "Workspaces", workspaceSid, "Workers", workerSid, "Reservations", "**", ].join("/"), method: "GET", allow: true, }); var workerFetch = new TaskRouterCapability_1.Policy({ url: [ TASKROUTER_BASE_URL, version, "Workspaces", workspaceSid, "Workers", workerSid, ].join("/"), method: "GET", allow: true, }); return [activities, tasks, reservations, workerFetch]; } exports.defaultWorkerPolicies = defaultWorkerPolicies; /** * Build the default Event Bridge Policies * * @param accountSid - account sid * @param channelId - channel id * @returns list of Policies */ function defaultEventBridgePolicies(accountSid, channelId) { var url = [EVENT_URL_BASE, accountSid, channelId].join("/"); return [ new TaskRouterCapability_1.Policy({ url: url, method: "GET", allow: true, }), new TaskRouterCapability_1.Policy({ url: url, method: "POST", allow: true, }), ]; } exports.defaultEventBridgePolicies = defaultEventBridgePolicies; /** * Generate TaskRouter workspace url * * @param workspaceSid - workspace sid or '**' for all workspaces * @returns generated url */ function workspacesUrl(workspaceSid) { return [TASKROUTER_BASE_URL, TASKROUTER_VERSION, "Workspaces", workspaceSid] .filter((item) => typeof item === "string") .join("/"); } exports.workspacesUrl = workspacesUrl; /** * Generate TaskRouter task queue url * * @param workspaceSid - workspace sid * @param taskQueueSid - task queue sid or '**' for all task queues * @returns generated url */ function taskQueuesUrl(workspaceSid, taskQueueSid) { return [workspacesUrl(workspaceSid), "TaskQueues", taskQueueSid] .filter((item) => typeof item === "string") .join("/"); } exports.taskQueuesUrl = taskQueuesUrl; /** * Generate TaskRouter task url * * @param workspaceSid - workspace sid * @param taskSid - task sid or '**' for all tasks * @returns generated url */ function tasksUrl(workspaceSid, taskSid) { return [workspacesUrl(workspaceSid), "Tasks", taskSid] .filter((item) => typeof item === "string") .join("/"); } exports.tasksUrl = tasksUrl; /** * Generate TaskRouter activity url * * @param workspaceSid - workspace sid * @param activitySid - activity sid or '**' for all activities * @returns generated url */ function activitiesUrl(workspaceSid, activitySid) { return [workspacesUrl(workspaceSid), "Activities", activitySid] .filter((item) => typeof item === "string") .join("/"); } exports.activitiesUrl = activitiesUrl; /** * Generate TaskRouter worker url * * @param workspaceSid - workspace sid * @param workerSid - worker sid or '**' for all workers * @returns generated url */ function workersUrl(workspaceSid, workerSid) { return [workspacesUrl(workspaceSid), "Workers", workerSid] .filter((item) => typeof item === "string") .join("/"); } exports.workersUrl = workersUrl; /** * Generate TaskRouter worker reservation url * * @param workspaceSid - workspace sid * @param workerSid - worker sid * @param reservationSid - reservation sid or '**' for all reservations * @returns generated url */ function reservationsUrl(workspaceSid, workerSid, reservationSid) { return [workersUrl(workspaceSid, workerSid), "Reservations", reservationSid] .filter((item) => typeof item === "string") .join("/"); } exports.reservationsUrl = reservationsUrl; jwt/taskrouter/TaskRouterCapability.js000064400000006733151677225100014235 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Policy = void 0; const jsonwebtoken_1 = __importDefault(require("jsonwebtoken")); /** * Create a new Policy */ class Policy { /** * Create a new Policy instance * * @param options - ... * @param options.url - Policy URL * @param options.method - HTTP Method * @param options.queryFilter - Request query filter allowances * @param options.postFilter - Request post filter allowances * @param options.allowed - Allow the policy */ constructor(options) { options = options || {}; this.url = options.url || ""; this.method = options.method || "GET"; this.queryFilter = options.queryFilter || {}; this.postFilter = options.postFilter || {}; this.allow = options.allow || true; } payload() { return { url: this.url, method: this.method, query_filter: this.queryFilter, post_filter: this.postFilter, allow: this.allow, }; } } exports.Policy = Policy; class TaskRouterCapability { /** * @param options - ... * @param options.accountSid - account sid * @param options.authToken - auth token * @param options.workspaceSid - workspace sid * @param options.channelId - taskrouter channel id * @param options.friendlyName - friendly name for the jwt * @param options.ttl - time to live * @param options.version - taskrouter version */ constructor(options) { if (!options) { throw new Error('Required parameter "options" missing.'); } if (!options.accountSid) { throw new Error('Required parameter "options.accountSid" missing.'); } if (!options.authToken) { throw new Error('Required parameter "options.authToken" missing.'); } if (!options.workspaceSid) { throw new Error('Required parameter "options.workspaceSid" missing.'); } if (!options.channelId) { throw new Error('Required parameter "options.channelId" missing.'); } this.accountSid = options.accountSid; this.authToken = options.authToken; this.workspaceSid = options.workspaceSid; this.channelId = options.channelId; this.friendlyName = options.friendlyName; this.ttl = options.ttl || 3600; this.version = options.version || "v1"; this.policies = []; } addPolicy(policy) { this.policies.push(policy); } toJwt() { var payload = { iss: this.accountSid, exp: Math.floor(new Date().valueOf() / 1000) + this.ttl, version: this.version, friendly_name: this.friendlyName, account_sid: this.accountSid, channel: this.channelId, workspace_sid: this.workspaceSid, policies: this.policies.map((policy) => policy.payload()), }; if (this.channelId.startsWith("WK")) { payload.worker_sid = this.channelId; } else if (this.channelId.startsWith("WQ")) { payload.taskqueue_sid = this.channelId; } return jsonwebtoken_1.default.sign(payload, this.authToken); } } exports.default = TaskRouterCapability; TaskRouterCapability.Policy = Policy; jwt/AccessToken.js000064400000021772151677225100010127 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const jsonwebtoken_1 = __importDefault(require("jsonwebtoken")); class AccessToken { /** * @param accountSid - The account's unique ID to which access is scoped * @param keySid - The signing key's unique ID * @param secret - The secret to sign the token with * @param options - ... * @param options.ttl - Time to live in seconds (default 3600) * @param options.identity - The identity of the first person. Required. * @param options.nbf - Time from epoch in seconds for not before value * @param options.region - The region value associated with this account */ constructor(accountSid, keySid, secret, options) { if (!accountSid) { throw new Error("accountSid is required"); } if (!keySid) { throw new Error("keySid is required"); } if (!secret) { throw new Error("secret is required"); } if (!options || !options.identity) { throw new Error("identity is required to be specified in options"); } this.accountSid = accountSid; this.keySid = keySid; this.secret = secret; this.ttl = options.ttl || 3600; this.identity = options.identity; this.nbf = options.nbf; this.region = options.region; this.grants = []; } addGrant(grant) { this.grants.push(grant); } toJwt(algorithm) { algorithm = algorithm || AccessToken.DEFAULT_ALGORITHM; if (!AccessToken.ALGORITHMS.includes(algorithm)) { throw new Error("Algorithm not supported. Allowed values are " + AccessToken.ALGORITHMS.join(", ")); } let grants = {}; if (Number.isInteger(this.identity) || typeof this.identity === "string") { grants.identity = String(this.identity); } for (const grant of this.grants) { grants[grant.key] = grant.toPayload(); } const now = Math.floor(Date.now() / 1000); let payload = { jti: this.keySid + "-" + now, grants: grants, }; if (typeof this.nbf === "number") { payload.nbf = this.nbf; } let header = { cty: "twilio-fpa;v=1", typ: "JWT", }; if (this.region && typeof this.region === "string") { header.twr = this.region; } return jsonwebtoken_1.default.sign(payload, this.secret, { header: header, algorithm: algorithm, issuer: this.keySid, subject: this.accountSid, expiresIn: this.ttl, }); } } AccessToken.DEFAULT_ALGORITHM = "HS256"; AccessToken.ALGORITHMS = ["HS256", "HS384", "HS512"]; (function (AccessToken) { class Grant { constructor(key) { this.key = key; } } AccessToken.Grant = Grant; class TaskRouterGrant extends Grant { /** * @param options - ... * @param options.workspaceSid - The workspace unique ID * @param options.workerSid - The worker unique ID * @param options.role - The role of the grant */ constructor(options) { options = options || {}; super("task_router"); this.workspaceSid = options.workspaceSid; this.workerSid = options.workerSid; this.role = options.role; } toPayload() { let grant = {}; if (this.workspaceSid) { grant.workspace_sid = this.workspaceSid; } if (this.workerSid) { grant.worker_sid = this.workerSid; } if (this.role) { grant.role = this.role; } return grant; } } AccessToken.TaskRouterGrant = TaskRouterGrant; class ChatGrant extends Grant { /** * @param options - ... * @param options.serviceSid - The service unique ID * @param options.endpointId - The endpoint ID * @param options.deploymentRoleSid - SID of the deployment role to be * assigned to the user * @param options.pushCredentialSid - The Push Credentials SID */ constructor(options) { options = options || {}; super("chat"); this.serviceSid = options.serviceSid; this.endpointId = options.endpointId; this.deploymentRoleSid = options.deploymentRoleSid; this.pushCredentialSid = options.pushCredentialSid; } toPayload() { let grant = {}; if (this.serviceSid) { grant.service_sid = this.serviceSid; } if (this.endpointId) { grant.endpoint_id = this.endpointId; } if (this.deploymentRoleSid) { grant.deployment_role_sid = this.deploymentRoleSid; } if (this.pushCredentialSid) { grant.push_credential_sid = this.pushCredentialSid; } return grant; } } AccessToken.ChatGrant = ChatGrant; class VideoGrant extends Grant { /** * @param options - ... * @param options.room - The Room name or Room sid. */ constructor(options) { options = options || {}; super("video"); this.room = options.room; } toPayload() { let grant = {}; if (this.room) { grant.room = this.room; } return grant; } } AccessToken.VideoGrant = VideoGrant; class SyncGrant extends Grant { /** * @param options.serviceSid - The service unique ID * @param options.endpointId - The endpoint ID */ constructor(options) { options = options || {}; super("data_sync"); this.serviceSid = options.serviceSid; this.endpointId = options.endpointId; } toPayload() { let grant = {}; if (this.serviceSid) { grant.service_sid = this.serviceSid; } if (this.endpointId) { grant.endpoint_id = this.endpointId; } return grant; } } AccessToken.SyncGrant = SyncGrant; class VoiceGrant extends Grant { /** * @param options - ... * @param options.incomingAllow - Whether or not this endpoint is allowed to receive incoming calls as grants.identity * @param options.outgoingApplicationSid - application sid to call when placing outgoing call * @param options.outgoingApplicationParams - request params to pass to the application * @param options.pushCredentialSid - Push Credential Sid to use when registering to receive incoming call notifications * @param options.endpointId - Specify an endpoint identifier for this device, which will allow the developer * to direct calls to a specific endpoint when multiple devices are associated with a single identity */ constructor(options) { options = options || {}; super("voice"); this.incomingAllow = options.incomingAllow; this.outgoingApplicationSid = options.outgoingApplicationSid; this.outgoingApplicationParams = options.outgoingApplicationParams; this.pushCredentialSid = options.pushCredentialSid; this.endpointId = options.endpointId; } toPayload() { let grant = {}; if (this.incomingAllow === true) { grant.incoming = { allow: true }; } if (this.outgoingApplicationSid) { grant.outgoing = { application_sid: this.outgoingApplicationSid, }; if (this.outgoingApplicationParams) { grant.outgoing.params = this.outgoingApplicationParams; } } if (this.pushCredentialSid) { grant.push_credential_sid = this.pushCredentialSid; } if (this.endpointId) { grant.endpoint_id = this.endpointId; } return grant; } } AccessToken.VoiceGrant = VoiceGrant; class PlaybackGrant extends Grant { /** * @param options - ... * @param options.grant - The PlaybackGrant retrieved from Twilio's API */ constructor(options) { options = options || {}; super("player"); this.grant = options.grant; } toPayload() { let grant = {}; if (this.grant) { grant = this.grant; } return grant; } } AccessToken.PlaybackGrant = PlaybackGrant; })(AccessToken || (AccessToken = {})); module.exports = AccessToken; rest/NumbersBase.js000064400000002301151677225100010267 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./numbers/V1")); const V2_1 = __importDefault(require("./numbers/V2")); class NumbersBase extends Domain_1.default { /** * Initialize numbers domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://numbers.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = NumbersBase; rest/Routes.js000064400000001574151677225100007355 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const RoutesBase_1 = __importDefault(require("./RoutesBase")); class Routes extends RoutesBase_1.default { /** * @deprecated - Use v1.phoneNumbers instead */ get phoneNumbers() { console.warn("phoneNumbers is deprecated. Use v1.phoneNumbers instead."); return this.v2.phoneNumbers; } /** * @deprecated - Use v1.sipDomains instead */ get sipDomains() { console.warn("sipDomains is deprecated. Use v1.sipDomains instead."); return this.v2.sipDomains; } /** * @deprecated - Use v1.trunks instead */ get trunks() { console.warn("trunks is deprecated. Use v1.trunks instead."); return this.v2.trunks; } } module.exports = Routes; rest/chat/V2.d.ts000064400000001443151677225100007531 0ustar00import ChatBase from "../ChatBase"; import Version from "../../base/Version"; import { CredentialListInstance } from "./v2/credential"; import { ServiceListInstance } from "./v2/service"; export default class V2 extends Version { /** * Initialize the V2 version of Chat * * @param domain - The Twilio (Twilio.Chat) domain */ constructor(domain: ChatBase); /** credentials - { Twilio.Chat.V2.CredentialListInstance } resource */ protected _credentials?: CredentialListInstance; /** services - { Twilio.Chat.V2.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** Getter for credentials resource */ get credentials(): CredentialListInstance; /** Getter for services resource */ get services(): ServiceListInstance; } rest/chat/V3.d.ts000064400000001016151677225100007526 0ustar00import ChatBase from "../ChatBase"; import Version from "../../base/Version"; import { ChannelListInstance } from "./v3/channel"; export default class V3 extends Version { /** * Initialize the V3 version of Chat * * @param domain - The Twilio (Twilio.Chat) domain */ constructor(domain: ChatBase); /** channels - { Twilio.Chat.V3.ChannelListInstance } resource */ protected _channels?: ChannelListInstance; /** Getter for channels resource */ get channels(): ChannelListInstance; } rest/chat/V1.d.ts000064400000001443151677225100007530 0ustar00import ChatBase from "../ChatBase"; import Version from "../../base/Version"; import { CredentialListInstance } from "./v1/credential"; import { ServiceListInstance } from "./v1/service"; export default class V1 extends Version { /** * Initialize the V1 version of Chat * * @param domain - The Twilio (Twilio.Chat) domain */ constructor(domain: ChatBase); /** credentials - { Twilio.Chat.V1.CredentialListInstance } resource */ protected _credentials?: CredentialListInstance; /** services - { Twilio.Chat.V1.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** Getter for credentials resource */ get credentials(): CredentialListInstance; /** Getter for services resource */ get services(): ServiceListInstance; } rest/chat/v3/channel.d.ts000064400000014502151677225100011202 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V3 from "../V3"; export type ChannelChannelType = "public" | "private"; export type ChannelWebhookEnabledType = "true" | "false"; /** * Options to pass to update a ChannelInstance */ export interface ChannelContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ChannelWebhookEnabledType; /** */ type?: ChannelChannelType; /** The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this channel belongs to. */ messagingServiceSid?: string; } export interface ChannelContext { /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ChannelContextSolution { serviceSid: string; sid: string; } export declare class ChannelContextImpl implements ChannelContext { protected _version: V3; protected _solution: ChannelContextSolution; protected _uri: string; constructor(_version: V3, serviceSid: string, sid: string); update(params?: ChannelContextUpdateOptions | ((error: Error | null, item?: ChannelInstance) => any), callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ChannelResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; unique_name: string; attributes: string; type: ChannelChannelType; date_created: Date; date_updated: Date; created_by: string; members_count: number; messages_count: number; messaging_service_sid: string; url: string; } export declare class ChannelInstance { protected _version: V3; protected _solution: ChannelContextSolution; protected _context?: ChannelContext; constructor(_version: V3, payload: ChannelResource, serviceSid?: string, sid?: string); /** * The unique string that we created to identify the Channel resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. */ serviceSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\'s `sid` in the URL. */ uniqueName: string; /** * The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes: string; type: ChannelChannelType; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. */ createdBy: string; /** * The number of Members in the Channel. */ membersCount: number; /** * The number of Messages that have been passed in the Channel. */ messagesCount: number; /** * The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this channel belongs to. */ messagingServiceSid: string; /** * The absolute URL of the Channel resource. */ url: string; private get _proxy(); /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; uniqueName: string; attributes: string; type: ChannelChannelType; dateCreated: Date; dateUpdated: Date; createdBy: string; membersCount: number; messagesCount: number; messagingServiceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ChannelSolution { } export interface ChannelListInstance { _version: V3; _solution: ChannelSolution; _uri: string; (serviceSid: string, sid: string): ChannelContext; get(serviceSid: string, sid: string): ChannelContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ChannelListInstance(version: V3): ChannelListInstance; export {}; rest/chat/v3/channel.js000064400000013027151677225100010747 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.ChannelListInstance = exports.ChannelInstance = exports.ChannelContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class ChannelContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${sid}`; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["type"] !== undefined) data["Type"] = params["type"]; if (params["messagingServiceSid"] !== undefined) data["MessagingServiceSid"] = params["messagingServiceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid, 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.ChannelContextImpl = ChannelContextImpl; class ChannelInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.attributes = payload.attributes; this.type = payload.type; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this.membersCount = deserialize.integer(payload.members_count); this.messagesCount = deserialize.integer(payload.messages_count); this.messagingServiceSid = payload.messaging_service_sid; this.url = payload.url; this._solution = { serviceSid: serviceSid || this.serviceSid, sid: sid || this.sid, }; } get _proxy() { this._context = this._context || new ChannelContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, uniqueName: this.uniqueName, attributes: this.attributes, type: this.type, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, membersCount: this.membersCount, messagesCount: this.messagesCount, messagingServiceSid: this.messagingServiceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelInstance = ChannelInstance; function ChannelListInstance(version) { const instance = ((serviceSid, sid) => instance.get(serviceSid, sid)); instance.get = function get(serviceSid, sid) { return new ChannelContextImpl(version, serviceSid, sid); }; 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; } exports.ChannelListInstance = ChannelListInstance; rest/chat/V2.js000064400000002725151677225100007301 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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 credential_1 = require("./v2/credential"); const service_1 = require("./v2/service"); class V2 extends Version_1.default { /** * Initialize the V2 version of Chat * * @param domain - The Twilio (Twilio.Chat) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for credentials resource */ get credentials() { this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this); return this._credentials; } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } } exports.default = V2; rest/chat/v2/service.d.ts000064400000055265151677225100011244 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; import { BindingListInstance } from "./service/binding"; import { ChannelListInstance } from "./service/channel"; import { RoleListInstance } from "./service/role"; import { UserListInstance } from "./service/user"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** A descriptive string that you create to describe the resource. */ friendlyName?: string; /** The service role assigned to users when they are added to the service. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. */ defaultServiceRoleSid?: string; /** The channel role assigned to users when they are added to a channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. */ defaultChannelRoleSid?: string; /** The channel role assigned to a channel creator when they join a new channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. */ defaultChannelCreatorRoleSid?: string; /** Whether to enable the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature. The default is `true`. */ readStatusEnabled?: boolean; /** Whether to enable the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) for this Service instance. The default is `false`. */ reachabilityEnabled?: boolean; /** How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. */ typingIndicatorTimeout?: number; /** DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. */ consumptionReportInterval?: number; /** Whether to send a notification when a new message is added to a channel. The default is `false`. */ "notifications.newMessage.enabled"?: boolean; /** The template to use to create the notification text displayed when a new message is added to a channel and `notifications.new_message.enabled` is `true`. */ "notifications.newMessage.template"?: string; /** The name of the sound to play when a new message is added to a channel and `notifications.new_message.enabled` is `true`. */ "notifications.newMessage.sound"?: string; /** Whether the new message badge is enabled. The default is `false`. */ "notifications.newMessage.badgeCountEnabled"?: boolean; /** Whether to send a notification when a member is added to a channel. The default is `false`. */ "notifications.addedToChannel.enabled"?: boolean; /** The template to use to create the notification text displayed when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. */ "notifications.addedToChannel.template"?: string; /** The name of the sound to play when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. */ "notifications.addedToChannel.sound"?: string; /** Whether to send a notification to a user when they are removed from a channel. The default is `false`. */ "notifications.removedFromChannel.enabled"?: boolean; /** The template to use to create the notification text displayed to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. */ "notifications.removedFromChannel.template"?: string; /** The name of the sound to play to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. */ "notifications.removedFromChannel.sound"?: string; /** Whether to send a notification when a user is invited to a channel. The default is `false`. */ "notifications.invitedToChannel.enabled"?: boolean; /** The template to use to create the notification text displayed when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. */ "notifications.invitedToChannel.template"?: string; /** The name of the sound to play when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. */ "notifications.invitedToChannel.sound"?: string; /** The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ preWebhookUrl?: string; /** The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ postWebhookUrl?: string; /** The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ webhookMethod?: string; /** The list of webhook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ webhookFilters?: Array<string>; /** The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. */ "limits.channelMembers"?: number; /** The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. */ "limits.userChannels"?: number; /** The message to send when a media message has no text. Can be used as placeholder message. */ "media.compatibilityMessage"?: string; /** The number of times to retry a call to the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won\\\'t be retried. */ preWebhookRetryCount?: number; /** The number of times to retry a call to the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won\\\'t be retried. */ postWebhookRetryCount?: number; /** Whether to log notifications. The default is `false`. */ "notifications.logEnabled"?: boolean; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** A descriptive string that you create to describe the new resource. */ friendlyName: string; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { bindings: BindingListInstance; channels: ChannelListInstance; roles: RoleListInstance; users: UserListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V2; protected _solution: ServiceContextSolution; protected _uri: string; protected _bindings?: BindingListInstance; protected _channels?: ChannelListInstance; protected _roles?: RoleListInstance; protected _users?: UserListInstance; constructor(_version: V2, sid: string); get bindings(): BindingListInstance; get channels(): ChannelListInstance; get roles(): RoleListInstance; get users(): UserListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; date_created: Date; date_updated: Date; default_service_role_sid: string; default_channel_role_sid: string; default_channel_creator_role_sid: string; read_status_enabled: boolean; reachability_enabled: boolean; typing_indicator_timeout: number; consumption_report_interval: number; limits: any; pre_webhook_url: string; post_webhook_url: string; webhook_method: string; webhook_filters: Array<string>; pre_webhook_retry_count: number; post_webhook_retry_count: number; notifications: any; media: any; url: string; links: Record<string, string>; } export declare class ServiceInstance { protected _version: V2; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V2, payload: ServiceResource, sid?: string); /** * The unique string that we created to identify the Service resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service 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 [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 service role assigned to users when they are added to the service. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. */ defaultServiceRoleSid: string; /** * The channel role assigned to users when they are added to a channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. */ defaultChannelRoleSid: string; /** * The channel role assigned to a channel creator when they join a new channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. */ defaultChannelCreatorRoleSid: string; /** * Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. */ readStatusEnabled: boolean; /** * Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. */ reachabilityEnabled: boolean; /** * How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. */ typingIndicatorTimeout: number; /** * DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. */ consumptionReportInterval: number; /** * An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. */ limits: any; /** * The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ preWebhookUrl: string; /** * The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ postWebhookUrl: string; /** * The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ webhookMethod: string; /** * The list of webhook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ webhookFilters: Array<string>; /** * The number of times to retry a call to the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won\'t be retried. */ preWebhookRetryCount: number; /** * The number of times to retry a call to the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won\'t be retried. */ postWebhookRetryCount: number; /** * The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ notifications: any; /** * An object that describes the properties of media that the service supports. The object contains the `size_limit_mb` property, which describes the size of the largest media file in MB; and the `compatibility_message` property, which contains the message text to send when a media message does not have any text. */ media: any; /** * The absolute URL of the Service resource. */ url: string; /** * The absolute URLs of the Service\'s [Channels](https://www.twilio.com/docs/chat/channels), [Roles](https://www.twilio.com/docs/chat/rest/role-resource), [Bindings](https://www.twilio.com/docs/chat/rest/binding-resource), and [Users](https://www.twilio.com/docs/chat/rest/user-resource). */ links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the bindings. */ bindings(): BindingListInstance; /** * Access the channels. */ channels(): ChannelListInstance; /** * Access the roles. */ roles(): RoleListInstance; /** * Access the users. */ users(): UserListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; defaultServiceRoleSid: string; defaultChannelRoleSid: string; defaultChannelCreatorRoleSid: string; readStatusEnabled: boolean; reachabilityEnabled: boolean; typingIndicatorTimeout: number; consumptionReportInterval: number; limits: any; preWebhookUrl: string; postWebhookUrl: string; webhookMethod: string; webhookFilters: string[]; preWebhookRetryCount: number; postWebhookRetryCount: number; notifications: any; media: any; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V2; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V2): ServiceListInstance; export declare class ServicePage extends Page<V2, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service.js000064400000041637151677225100011006 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const binding_1 = require("./service/binding"); const channel_1 = require("./service/channel"); const role_1 = require("./service/role"); const user_1 = require("./service/user"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get bindings() { this._bindings = this._bindings || (0, binding_1.BindingListInstance)(this._version, this._solution.sid); return this._bindings; } get channels() { this._channels = this._channels || (0, channel_1.ChannelListInstance)(this._version, this._solution.sid); return this._channels; } get roles() { this._roles = this._roles || (0, role_1.RoleListInstance)(this._version, this._solution.sid); return this._roles; } get users() { this._users = this._users || (0, user_1.UserListInstance)(this._version, this._solution.sid); return this._users; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["defaultServiceRoleSid"] !== undefined) data["DefaultServiceRoleSid"] = params["defaultServiceRoleSid"]; if (params["defaultChannelRoleSid"] !== undefined) data["DefaultChannelRoleSid"] = params["defaultChannelRoleSid"]; if (params["defaultChannelCreatorRoleSid"] !== undefined) data["DefaultChannelCreatorRoleSid"] = params["defaultChannelCreatorRoleSid"]; if (params["readStatusEnabled"] !== undefined) data["ReadStatusEnabled"] = serialize.bool(params["readStatusEnabled"]); if (params["reachabilityEnabled"] !== undefined) data["ReachabilityEnabled"] = serialize.bool(params["reachabilityEnabled"]); if (params["typingIndicatorTimeout"] !== undefined) data["TypingIndicatorTimeout"] = params["typingIndicatorTimeout"]; if (params["consumptionReportInterval"] !== undefined) data["ConsumptionReportInterval"] = params["consumptionReportInterval"]; if (params["notifications.newMessage.enabled"] !== undefined) data["Notifications.NewMessage.Enabled"] = serialize.bool(params["notifications.newMessage.enabled"]); if (params["notifications.newMessage.template"] !== undefined) data["Notifications.NewMessage.Template"] = params["notifications.newMessage.template"]; if (params["notifications.newMessage.sound"] !== undefined) data["Notifications.NewMessage.Sound"] = params["notifications.newMessage.sound"]; if (params["notifications.newMessage.badgeCountEnabled"] !== undefined) data["Notifications.NewMessage.BadgeCountEnabled"] = serialize.bool(params["notifications.newMessage.badgeCountEnabled"]); if (params["notifications.addedToChannel.enabled"] !== undefined) data["Notifications.AddedToChannel.Enabled"] = serialize.bool(params["notifications.addedToChannel.enabled"]); if (params["notifications.addedToChannel.template"] !== undefined) data["Notifications.AddedToChannel.Template"] = params["notifications.addedToChannel.template"]; if (params["notifications.addedToChannel.sound"] !== undefined) data["Notifications.AddedToChannel.Sound"] = params["notifications.addedToChannel.sound"]; if (params["notifications.removedFromChannel.enabled"] !== undefined) data["Notifications.RemovedFromChannel.Enabled"] = serialize.bool(params["notifications.removedFromChannel.enabled"]); if (params["notifications.removedFromChannel.template"] !== undefined) data["Notifications.RemovedFromChannel.Template"] = params["notifications.removedFromChannel.template"]; if (params["notifications.removedFromChannel.sound"] !== undefined) data["Notifications.RemovedFromChannel.Sound"] = params["notifications.removedFromChannel.sound"]; if (params["notifications.invitedToChannel.enabled"] !== undefined) data["Notifications.InvitedToChannel.Enabled"] = serialize.bool(params["notifications.invitedToChannel.enabled"]); if (params["notifications.invitedToChannel.template"] !== undefined) data["Notifications.InvitedToChannel.Template"] = params["notifications.invitedToChannel.template"]; if (params["notifications.invitedToChannel.sound"] !== undefined) data["Notifications.InvitedToChannel.Sound"] = params["notifications.invitedToChannel.sound"]; if (params["preWebhookUrl"] !== undefined) data["PreWebhookUrl"] = params["preWebhookUrl"]; if (params["postWebhookUrl"] !== undefined) data["PostWebhookUrl"] = params["postWebhookUrl"]; if (params["webhookMethod"] !== undefined) data["WebhookMethod"] = params["webhookMethod"]; if (params["webhookFilters"] !== undefined) data["WebhookFilters"] = serialize.map(params["webhookFilters"], (e) => e); if (params["limits.channelMembers"] !== undefined) data["Limits.ChannelMembers"] = params["limits.channelMembers"]; if (params["limits.userChannels"] !== undefined) data["Limits.UserChannels"] = params["limits.userChannels"]; if (params["media.compatibilityMessage"] !== undefined) data["Media.CompatibilityMessage"] = params["media.compatibilityMessage"]; if (params["preWebhookRetryCount"] !== undefined) data["PreWebhookRetryCount"] = params["preWebhookRetryCount"]; if (params["postWebhookRetryCount"] !== undefined) data["PostWebhookRetryCount"] = params["postWebhookRetryCount"]; if (params["notifications.logEnabled"] !== undefined) data["Notifications.LogEnabled"] = serialize.bool(params["notifications.logEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { 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.defaultServiceRoleSid = payload.default_service_role_sid; this.defaultChannelRoleSid = payload.default_channel_role_sid; this.defaultChannelCreatorRoleSid = payload.default_channel_creator_role_sid; this.readStatusEnabled = payload.read_status_enabled; this.reachabilityEnabled = payload.reachability_enabled; this.typingIndicatorTimeout = deserialize.integer(payload.typing_indicator_timeout); this.consumptionReportInterval = deserialize.integer(payload.consumption_report_interval); this.limits = payload.limits; this.preWebhookUrl = payload.pre_webhook_url; this.postWebhookUrl = payload.post_webhook_url; this.webhookMethod = payload.webhook_method; this.webhookFilters = payload.webhook_filters; this.preWebhookRetryCount = deserialize.integer(payload.pre_webhook_retry_count); this.postWebhookRetryCount = deserialize.integer(payload.post_webhook_retry_count); this.notifications = payload.notifications; this.media = payload.media; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the bindings. */ bindings() { return this._proxy.bindings; } /** * Access the channels. */ channels() { return this._proxy.channels; } /** * Access the roles. */ roles() { return this._proxy.roles; } /** * Access the users. */ users() { return this._proxy.users; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, defaultServiceRoleSid: this.defaultServiceRoleSid, defaultChannelRoleSid: this.defaultChannelRoleSid, defaultChannelCreatorRoleSid: this.defaultChannelCreatorRoleSid, readStatusEnabled: this.readStatusEnabled, reachabilityEnabled: this.reachabilityEnabled, typingIndicatorTimeout: this.typingIndicatorTimeout, consumptionReportInterval: this.consumptionReportInterval, limits: this.limits, preWebhookUrl: this.preWebhookUrl, postWebhookUrl: this.postWebhookUrl, webhookMethod: this.webhookMethod, webhookFilters: this.webhookFilters, preWebhookRetryCount: this.preWebhookRetryCount, postWebhookRetryCount: this.postWebhookRetryCount, notifications: this.notifications, media: this.media, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/chat/v2/credential.d.ts000064400000032403151677225100011703 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; export type CredentialPushService = "gcm" | "apn" | "fcm"; /** * Options to pass to update a CredentialInstance */ export interface CredentialContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----` */ certificate?: string; /** [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----` */ privateKey?: string; /** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox?: boolean; /** [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. */ apiKey?: string; /** [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. */ secret?: string; } /** * Options to pass to create a CredentialInstance */ export interface CredentialListInstanceCreateOptions { /** */ type: CredentialPushService; /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName?: string; /** [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----` */ certificate?: string; /** [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----` */ privateKey?: string; /** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox?: boolean; /** [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. */ apiKey?: string; /** [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. */ secret?: string; } /** * Options to pass to each */ export interface CredentialListInstanceEachOptions { /** 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: CredentialInstance, 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 CredentialListInstanceOptions { /** 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 CredentialListInstancePageOptions { /** 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 CredentialContext { /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialContextSolution { sid: string; } export declare class CredentialContextImpl implements CredentialContext { protected _version: V2; protected _solution: CredentialContextSolution; protected _uri: string; constructor(_version: V2, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; update(params?: CredentialContextUpdateOptions | ((error: Error | null, item?: CredentialInstance) => any), callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialPayload extends TwilioResponsePayload { credentials: CredentialResource[]; } interface CredentialResource { sid: string; account_sid: string; friendly_name: string; type: CredentialPushService; sandbox: string; date_created: Date; date_updated: Date; url: string; } export declare class CredentialInstance { protected _version: V2; protected _solution: CredentialContextSolution; protected _context?: CredentialContext; constructor(_version: V2, payload: CredentialResource, sid?: string); /** * The unique string that we created to identify the Credential resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; type: CredentialPushService; /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Credential resource. */ url: string; private get _proxy(); /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; type: CredentialPushService; sandbox: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialSolution { } export interface CredentialListInstance { _version: V2; _solution: CredentialSolution; _uri: string; (sid: string): CredentialContext; get(sid: string): CredentialContext; /** * Create a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ create(params: CredentialListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Streams CredentialInstance 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 { CredentialListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListInstanceEachOptions, callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialInstance 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: CredentialPage) => any): Promise<CredentialPage>; /** * Lists CredentialInstance 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 { CredentialListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; list(params: CredentialListInstanceOptions, callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; /** * Retrieve a single page of CredentialInstance 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 { CredentialListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; page(params: CredentialListInstancePageOptions, callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListInstance(version: V2): CredentialListInstance; export declare class CredentialPage extends Page<V2, CredentialPayload, CredentialResource, CredentialInstance> { /** * Initialize the CredentialPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: CredentialSolution); /** * Build an instance of CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialResource): CredentialInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/credential.js000064400000024172151677225100011453 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.CredentialPage = exports.CredentialListInstance = exports.CredentialInstance = exports.CredentialContextImpl = void 0; 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 CredentialContextImpl { 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/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, 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.CredentialContextImpl = CredentialContextImpl; class CredentialInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.sandbox = payload.sandbox; 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 CredentialContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, type: this.type, sandbox: this.sandbox, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialInstance = CredentialInstance; function CredentialListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Credentials`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["Type"] = params["type"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialPage(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 CredentialPage(instance._version, payload, 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; } exports.CredentialListInstance = CredentialListInstance; class CredentialPage extends Page_1.default { /** * Initialize the CredentialPage * * @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 CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialPage = CredentialPage; rest/chat/v2/service/user/userBinding.d.ts000064400000026743151677225100014472 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type UserBindingBindingType = "gcm" | "apn" | "fcm"; /** * Options to pass to each */ export interface UserBindingListInstanceEachOptions { /** The push technology used by the User Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ bindingType?: Array<UserBindingBindingType>; /** 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: UserBindingInstance, 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 UserBindingListInstanceOptions { /** The push technology used by the User Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ bindingType?: Array<UserBindingBindingType>; /** 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 UserBindingListInstancePageOptions { /** The push technology used by the User Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ bindingType?: Array<UserBindingBindingType>; /** 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 UserBindingContext { /** * Remove a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserBindingInstance */ fetch(callback?: (error: Error | null, item?: UserBindingInstance) => any): Promise<UserBindingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserBindingContextSolution { serviceSid: string; userSid: string; sid: string; } export declare class UserBindingContextImpl implements UserBindingContext { protected _version: V2; protected _solution: UserBindingContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, userSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserBindingInstance) => any): Promise<UserBindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserBindingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserBindingPayload extends TwilioResponsePayload { bindings: UserBindingResource[]; } interface UserBindingResource { sid: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; endpoint: string; identity: string; user_sid: string; credential_sid: string; binding_type: UserBindingBindingType; message_types: Array<string>; url: string; } export declare class UserBindingInstance { protected _version: V2; protected _solution: UserBindingContextSolution; protected _context?: UserBindingContext; constructor(_version: V2, payload: UserBindingResource, serviceSid: string, userSid: string, sid?: string); /** * The unique string that we created to identify the User Binding resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Binding resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Binding resource is associated with. */ serviceSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The unique endpoint identifier for the User Binding. The format of the value depends on the `binding_type`. */ endpoint: string; /** * The application-defined string that uniquely identifies the resource\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. */ identity: string; /** * The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) with the User Binding resource. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ userSid: string; /** * The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ credentialSid: string; bindingType: UserBindingBindingType; /** * The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. */ messageTypes: Array<string>; /** * The absolute URL of the User Binding resource. */ url: string; private get _proxy(); /** * Remove a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserBindingInstance */ fetch(callback?: (error: Error | null, item?: UserBindingInstance) => any): Promise<UserBindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; endpoint: string; identity: string; userSid: string; credentialSid: string; bindingType: UserBindingBindingType; messageTypes: string[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserBindingSolution { serviceSid: string; userSid: string; } export interface UserBindingListInstance { _version: V2; _solution: UserBindingSolution; _uri: string; (sid: string): UserBindingContext; get(sid: string): UserBindingContext; /** * Streams UserBindingInstance 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 { UserBindingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserBindingInstance, done: (err?: Error) => void) => void): void; each(params: UserBindingListInstanceEachOptions, callback?: (item: UserBindingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserBindingInstance 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: UserBindingPage) => any): Promise<UserBindingPage>; /** * Lists UserBindingInstance 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 { UserBindingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserBindingInstance[]) => any): Promise<UserBindingInstance[]>; list(params: UserBindingListInstanceOptions, callback?: (error: Error | null, items: UserBindingInstance[]) => any): Promise<UserBindingInstance[]>; /** * Retrieve a single page of UserBindingInstance 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 { UserBindingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserBindingPage) => any): Promise<UserBindingPage>; page(params: UserBindingListInstancePageOptions, callback?: (error: Error | null, items: UserBindingPage) => any): Promise<UserBindingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserBindingListInstance(version: V2, serviceSid: string, userSid: string): UserBindingListInstance; export declare class UserBindingPage extends Page<V2, UserBindingPayload, UserBindingResource, UserBindingInstance> { /** * Initialize the UserBindingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: UserBindingSolution); /** * Build an instance of UserBindingInstance * * @param payload - Payload response from the API */ getInstance(payload: UserBindingResource): UserBindingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/user/userBinding.js000064400000021030151677225100014216 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.UserBindingPage = exports.UserBindingListInstance = exports.UserBindingInstance = exports.UserBindingContextImpl = void 0; 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 UserBindingContextImpl { constructor(_version, serviceSid, userSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, userSid, sid }; this._uri = `/Services/${serviceSid}/Users/${userSid}/Bindings/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserBindingInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.userSid, 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.UserBindingContextImpl = UserBindingContextImpl; class UserBindingInstance { constructor(_version, payload, serviceSid, userSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.endpoint = payload.endpoint; this.identity = payload.identity; this.userSid = payload.user_sid; this.credentialSid = payload.credential_sid; this.bindingType = payload.binding_type; this.messageTypes = payload.message_types; this.url = payload.url; this._solution = { serviceSid, userSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserBindingContextImpl(this._version, this._solution.serviceSid, this._solution.userSid, this._solution.sid); return this._context; } /** * Remove a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserBindingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, endpoint: this.endpoint, identity: this.identity, userSid: this.userSid, credentialSid: this.credentialSid, bindingType: this.bindingType, messageTypes: this.messageTypes, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserBindingInstance = UserBindingInstance; function UserBindingListInstance(version, serviceSid, userSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserBindingContextImpl(version, serviceSid, userSid, sid); }; instance._version = version; instance._solution = { serviceSid, userSid }; instance._uri = `/Services/${serviceSid}/Users/${userSid}/Bindings`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["bindingType"] !== undefined) data["BindingType"] = serialize.map(params["bindingType"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserBindingPage(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 UserBindingPage(instance._version, payload, 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; } exports.UserBindingListInstance = UserBindingListInstance; class UserBindingPage extends Page_1.default { /** * Initialize the UserBindingPage * * @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 UserBindingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserBindingInstance(this._version, payload, this._solution.serviceSid, this._solution.userSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserBindingPage = UserBindingPage; rest/chat/v2/service/user/userChannel.js000064400000024270151677225100014225 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.UserChannelPage = exports.UserChannelListInstance = exports.UserChannelInstance = exports.UserChannelContextImpl = void 0; 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 UserChannelContextImpl { constructor(_version, serviceSid, userSid, channelSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } this._solution = { serviceSid, userSid, channelSid }; this._uri = `/Services/${serviceSid}/Users/${userSid}/Channels/${channelSid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserChannelInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.userSid, instance._solution.channelSid)); 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["notificationLevel"] !== undefined) data["NotificationLevel"] = params["notificationLevel"]; if (params["lastConsumedMessageIndex"] !== undefined) data["LastConsumedMessageIndex"] = params["lastConsumedMessageIndex"]; if (params["lastConsumptionTimestamp"] !== undefined) data["LastConsumptionTimestamp"] = serialize.iso8601DateTime(params["lastConsumptionTimestamp"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserChannelInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.userSid, instance._solution.channelSid)); 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.UserChannelContextImpl = UserChannelContextImpl; class UserChannelInstance { constructor(_version, payload, serviceSid, userSid, channelSid) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.channelSid = payload.channel_sid; this.userSid = payload.user_sid; this.memberSid = payload.member_sid; this.status = payload.status; this.lastConsumedMessageIndex = deserialize.integer(payload.last_consumed_message_index); this.unreadMessagesCount = deserialize.integer(payload.unread_messages_count); this.links = payload.links; this.url = payload.url; this.notificationLevel = payload.notification_level; this._solution = { serviceSid, userSid, channelSid: channelSid || this.channelSid, }; } get _proxy() { this._context = this._context || new UserChannelContextImpl(this._version, this._solution.serviceSid, this._solution.userSid, this._solution.channelSid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, channelSid: this.channelSid, userSid: this.userSid, memberSid: this.memberSid, status: this.status, lastConsumedMessageIndex: this.lastConsumedMessageIndex, unreadMessagesCount: this.unreadMessagesCount, links: this.links, url: this.url, notificationLevel: this.notificationLevel, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserChannelInstance = UserChannelInstance; function UserChannelListInstance(version, serviceSid, userSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } const instance = ((channelSid) => instance.get(channelSid)); instance.get = function get(channelSid) { return new UserChannelContextImpl(version, serviceSid, userSid, channelSid); }; instance._version = version; instance._solution = { serviceSid, userSid }; instance._uri = `/Services/${serviceSid}/Users/${userSid}/Channels`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserChannelPage(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 UserChannelPage(instance._version, payload, 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; } exports.UserChannelListInstance = UserChannelListInstance; class UserChannelPage extends Page_1.default { /** * Initialize the UserChannelPage * * @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 UserChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserChannelInstance(this._version, payload, this._solution.serviceSid, this._solution.userSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserChannelPage = UserChannelPage; rest/chat/v2/service/user/userChannel.d.ts000064400000033666151677225100014472 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type UserChannelChannelStatus = "joined" | "invited" | "not_participating"; export type UserChannelNotificationLevel = "default" | "muted"; export type UserChannelWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a UserChannelInstance */ export interface UserChannelContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserChannelWebhookEnabledType; } /** * Options to pass to update a UserChannelInstance */ export interface UserChannelContextUpdateOptions { /** */ notificationLevel?: UserChannelNotificationLevel; /** The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. */ lastConsumedMessageIndex?: number; /** The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). */ lastConsumptionTimestamp?: Date; } /** * Options to pass to each */ export interface UserChannelListInstanceEachOptions { /** 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: UserChannelInstance, 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 UserChannelListInstanceOptions { /** 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 UserChannelListInstancePageOptions { /** 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 UserChannelContext { /** * Remove a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a UserChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ remove(params: UserChannelContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ fetch(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Update a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ update(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Update a UserChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ update(params: UserChannelContextUpdateOptions, callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserChannelContextSolution { serviceSid: string; userSid: string; channelSid: string; } export declare class UserChannelContextImpl implements UserChannelContext { protected _version: V2; protected _solution: UserChannelContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, userSid: string, channelSid: string); remove(params?: UserChannelContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; update(params?: UserChannelContextUpdateOptions | ((error: Error | null, item?: UserChannelInstance) => any), callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserChannelPayload extends TwilioResponsePayload { channels: UserChannelResource[]; } interface UserChannelResource { account_sid: string; service_sid: string; channel_sid: string; user_sid: string; member_sid: string; status: UserChannelChannelStatus; last_consumed_message_index: number; unread_messages_count: number; links: Record<string, string>; url: string; notification_level: UserChannelNotificationLevel; } export declare class UserChannelInstance { protected _version: V2; protected _solution: UserChannelContextSolution; protected _context?: UserChannelContext; constructor(_version: V2, payload: UserChannelResource, serviceSid: string, userSid: string, channelSid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Channel resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Channel resource is associated with. */ serviceSid: string; /** * The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the User Channel resource belongs to. */ channelSid: string; /** * The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) the User Channel belongs to. */ userSid: string; /** * The SID of a [Member](https://www.twilio.com/docs/chat/rest/member-resource) that represents the User on the Channel. */ memberSid: string; status: UserChannelChannelStatus; /** * The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. */ lastConsumedMessageIndex: number; /** * The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](https://www.twilio.com/docs/chat/consumption-horizon) to learn how to mark messages as consumed. */ unreadMessagesCount: number; /** * The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource) , [Invites](https://www.twilio.com/docs/chat/rest/invite-resource) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. */ links: Record<string, string>; /** * The absolute URL of the User Channel resource. */ url: string; notificationLevel: UserChannelNotificationLevel; private get _proxy(); /** * Remove a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a UserChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ remove(params: UserChannelContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ fetch(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Update a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ update(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Update a UserChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ update(params: UserChannelContextUpdateOptions, callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; channelSid: string; userSid: string; memberSid: string; status: UserChannelChannelStatus; lastConsumedMessageIndex: number; unreadMessagesCount: number; links: Record<string, string>; url: string; notificationLevel: UserChannelNotificationLevel; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserChannelSolution { serviceSid: string; userSid: string; } export interface UserChannelListInstance { _version: V2; _solution: UserChannelSolution; _uri: string; (channelSid: string): UserChannelContext; get(channelSid: string): UserChannelContext; /** * Streams UserChannelInstance 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 { UserChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserChannelInstance, done: (err?: Error) => void) => void): void; each(params: UserChannelListInstanceEachOptions, callback?: (item: UserChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserChannelInstance 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: UserChannelPage) => any): Promise<UserChannelPage>; /** * Lists UserChannelInstance 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 { UserChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserChannelInstance[]) => any): Promise<UserChannelInstance[]>; list(params: UserChannelListInstanceOptions, callback?: (error: Error | null, items: UserChannelInstance[]) => any): Promise<UserChannelInstance[]>; /** * Retrieve a single page of UserChannelInstance 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 { UserChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserChannelPage) => any): Promise<UserChannelPage>; page(params: UserChannelListInstancePageOptions, callback?: (error: Error | null, items: UserChannelPage) => any): Promise<UserChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserChannelListInstance(version: V2, serviceSid: string, userSid: string): UserChannelListInstance; export declare class UserChannelPage extends Page<V2, UserChannelPayload, UserChannelResource, UserChannelInstance> { /** * Initialize the UserChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: UserChannelSolution); /** * Build an instance of UserChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: UserChannelResource): UserChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/binding.d.ts000064400000027237151677225100012654 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type BindingBindingType = "gcm" | "apn" | "fcm"; /** * Options to pass to each */ export interface BindingListInstanceEachOptions { /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ bindingType?: Array<BindingBindingType>; /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: BindingInstance, 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 BindingListInstanceOptions { /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ bindingType?: Array<BindingBindingType>; /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface BindingListInstancePageOptions { /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ bindingType?: Array<BindingBindingType>; /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface BindingContext { /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BindingContextSolution { serviceSid: string; sid: string; } export declare class BindingContextImpl implements BindingContext { protected _version: V2; protected _solution: BindingContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BindingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BindingPayload extends TwilioResponsePayload { bindings: BindingResource[]; } interface BindingResource { sid: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; endpoint: string; identity: string; credential_sid: string; binding_type: BindingBindingType; message_types: Array<string>; url: string; links: Record<string, string>; } export declare class BindingInstance { protected _version: V2; protected _solution: BindingContextSolution; protected _context?: BindingContext; constructor(_version: V2, payload: BindingResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Binding resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Binding resource is associated with. */ serviceSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. */ endpoint: string; /** * The application-defined string that uniquely identifies the resource\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. */ identity: string; /** * The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ credentialSid: string; bindingType: BindingBindingType; /** * The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. */ messageTypes: Array<string>; /** * The absolute URL of the Binding resource. */ url: string; /** * The absolute URLs of the Binding\'s [User](https://www.twilio.com/docs/chat/rest/user-resource). */ links: Record<string, string>; private get _proxy(); /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; endpoint: string; identity: string; credentialSid: string; bindingType: BindingBindingType; messageTypes: string[]; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BindingSolution { serviceSid: string; } export interface BindingListInstance { _version: V2; _solution: BindingSolution; _uri: string; (sid: string): BindingContext; get(sid: string): BindingContext; /** * Streams BindingInstance 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 { BindingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void; each(params: BindingListInstanceEachOptions, callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BindingInstance 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: BindingPage) => any): Promise<BindingPage>; /** * Lists BindingInstance 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 { BindingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>; list(params: BindingListInstanceOptions, callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>; /** * Retrieve a single page of BindingInstance 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 { BindingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>; page(params: BindingListInstancePageOptions, callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BindingListInstance(version: V2, serviceSid: string): BindingListInstance; export declare class BindingPage extends Page<V2, BindingPayload, BindingResource, BindingInstance> { /** * Initialize the BindingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: BindingSolution); /** * Build an instance of BindingInstance * * @param payload - Payload response from the API */ getInstance(payload: BindingResource): BindingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/channel.d.ts000064400000043467151677225100012655 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; import { InviteListInstance } from "./channel/invite"; import { MemberListInstance } from "./channel/member"; import { MessageListInstance } from "./channel/message"; import { WebhookListInstance } from "./channel/webhook"; export type ChannelChannelType = "public" | "private"; export type ChannelWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a ChannelInstance */ export interface ChannelContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ChannelWebhookEnabledType; } /** * Options to pass to update a ChannelInstance */ export interface ChannelContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ChannelWebhookEnabledType; /** A descriptive string that you create to describe the resource. It can be up to 256 characters long. */ friendlyName?: string; /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\\\'s `sid` in the URL. This value must be 256 characters or less in length and unique within the Service. */ uniqueName?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. */ dateCreated?: Date; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. */ dateUpdated?: Date; /** The `identity` of the User that created the channel. Default is: `system`. */ createdBy?: string; } /** * Options to pass to create a ChannelInstance */ export interface ChannelListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ChannelWebhookEnabledType; /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName?: string; /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the Channel resource\\\'s `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. */ uniqueName?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; /** */ type?: ChannelChannelType; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. */ dateCreated?: Date; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. The default value is `null`. Note that this parameter should only be used in cases where a Channel is being recreated from a backup/separate source and where a Message was previously updated. */ dateUpdated?: Date; /** The `identity` of the User that created the channel. Default is: `system`. */ createdBy?: string; } /** * Options to pass to each */ export interface ChannelListInstanceEachOptions { /** The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. */ type?: Array<ChannelChannelType>; /** 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: ChannelInstance, 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 ChannelListInstanceOptions { /** The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. */ type?: Array<ChannelChannelType>; /** 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 ChannelListInstancePageOptions { /** The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. */ type?: Array<ChannelChannelType>; /** 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 ChannelContext { invites: InviteListInstance; members: MemberListInstance; messages: MessageListInstance; webhooks: WebhookListInstance; /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ remove(params: ChannelContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ChannelContextSolution { serviceSid: string; sid: string; } export declare class ChannelContextImpl implements ChannelContext { protected _version: V2; protected _solution: ChannelContextSolution; protected _uri: string; protected _invites?: InviteListInstance; protected _members?: MemberListInstance; protected _messages?: MessageListInstance; protected _webhooks?: WebhookListInstance; constructor(_version: V2, serviceSid: string, sid: string); get invites(): InviteListInstance; get members(): MemberListInstance; get messages(): MessageListInstance; get webhooks(): WebhookListInstance; remove(params?: ChannelContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; update(params?: ChannelContextUpdateOptions | ((error: Error | null, item?: ChannelInstance) => any), callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ChannelPayload extends TwilioResponsePayload { channels: ChannelResource[]; } interface ChannelResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; unique_name: string; attributes: string; type: ChannelChannelType; date_created: Date; date_updated: Date; created_by: string; members_count: number; messages_count: number; url: string; links: Record<string, string>; } export declare class ChannelInstance { protected _version: V2; protected _solution: ChannelContextSolution; protected _context?: ChannelContext; constructor(_version: V2, payload: ChannelResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Channel resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. */ serviceSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\'s `sid` in the URL. */ uniqueName: string; /** * The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes: string; type: ChannelChannelType; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. */ createdBy: string; /** * The number of Members in the Channel. */ membersCount: number; /** * The number of Messages that have been passed in the Channel. */ messagesCount: number; /** * The absolute URL of the Channel resource. */ url: string; /** * The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource), [Invites](https://www.twilio.com/docs/chat/rest/invite-resource), Webhooks and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. */ links: Record<string, string>; private get _proxy(); /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ remove(params: ChannelContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Access the invites. */ invites(): InviteListInstance; /** * Access the members. */ members(): MemberListInstance; /** * Access the messages. */ messages(): MessageListInstance; /** * Access the webhooks. */ webhooks(): WebhookListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; uniqueName: string; attributes: string; type: ChannelChannelType; dateCreated: Date; dateUpdated: Date; createdBy: string; membersCount: number; messagesCount: number; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ChannelSolution { serviceSid: string; } export interface ChannelListInstance { _version: V2; _solution: ChannelSolution; _uri: string; (sid: string): ChannelContext; get(sid: string): ChannelContext; /** * Create a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ create(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Create a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ create(params: ChannelListInstanceCreateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Streams ChannelInstance 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 { ChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; each(params: ChannelListInstanceEachOptions, callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ChannelInstance 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: ChannelPage) => any): Promise<ChannelPage>; /** * Lists ChannelInstance 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 { ChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; list(params: ChannelListInstanceOptions, callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; /** * Retrieve a single page of ChannelInstance 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 { ChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; page(params: ChannelListInstancePageOptions, callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ChannelListInstance(version: V2, serviceSid: string): ChannelListInstance; export declare class ChannelPage extends Page<V2, ChannelPayload, ChannelResource, ChannelInstance> { /** * Initialize the ChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ChannelSolution); /** * Build an instance of ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: ChannelResource): ChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/binding.js000064400000020146151677225100012410 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.BindingPage = exports.BindingListInstance = exports.BindingInstance = exports.BindingContextImpl = void 0; 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 BindingContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Bindings/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BindingInstance(operationVersion, payload, instance._solution.serviceSid, 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.BindingContextImpl = BindingContextImpl; class BindingInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.endpoint = payload.endpoint; this.identity = payload.identity; this.credentialSid = payload.credential_sid; this.bindingType = payload.binding_type; this.messageTypes = payload.message_types; this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new BindingContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, endpoint: this.endpoint, identity: this.identity, credentialSid: this.credentialSid, bindingType: this.bindingType, messageTypes: this.messageTypes, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BindingInstance = BindingInstance; function BindingListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new BindingContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Bindings`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["bindingType"] !== undefined) data["BindingType"] = serialize.map(params["bindingType"], (e) => e); if (params["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BindingPage(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 BindingPage(instance._version, payload, 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; } exports.BindingListInstance = BindingListInstance; class BindingPage extends Page_1.default { /** * Initialize the BindingPage * * @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 BindingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BindingInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BindingPage = BindingPage; rest/chat/v2/service/channel/member.d.ts000064400000043001151677225100014104 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type MemberWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a MemberInstance */ export interface MemberContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MemberWebhookEnabledType; } /** * Options to pass to update a MemberInstance */ export interface MemberContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MemberWebhookEnabledType; /** The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/rest/service-resource). */ roleSid?: string; /** The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) that the Member has read within the [Channel](https://www.twilio.com/docs/chat/channels). */ lastConsumedMessageIndex?: number; /** The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). */ lastConsumptionTimestamp?: Date; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source. */ dateCreated?: Date; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. */ dateUpdated?: Date; /** A valid JSON string that contains application-specific data. */ attributes?: string; } /** * Options to pass to create a MemberInstance */ export interface MemberListInstanceCreateOptions { /** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. */ identity: string; /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MemberWebhookEnabledType; /** The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/rest/service-resource). */ roleSid?: string; /** The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. This parameter should only be used when recreating a Member from a backup/separate source. */ lastConsumedMessageIndex?: number; /** The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). */ lastConsumptionTimestamp?: Date; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source. */ dateCreated?: Date; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. The default value is `null`. Note that this parameter should only be used when a Member is being recreated from a backup/separate source and where a Member was previously updated. */ dateUpdated?: Date; /** A valid JSON string that contains application-specific data. */ attributes?: string; } /** * Options to pass to each */ export interface MemberListInstanceEachOptions { /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the Member resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: MemberInstance, 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 MemberListInstanceOptions { /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the Member resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface MemberListInstancePageOptions { /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the Member resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface MemberContext { /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ remove(params: MemberContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MemberContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class MemberContextImpl implements MemberContext { protected _version: V2; protected _solution: MemberContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, channelSid: string, sid: string); remove(params?: MemberContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; update(params?: MemberContextUpdateOptions | ((error: Error | null, item?: MemberInstance) => any), callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MemberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MemberPayload extends TwilioResponsePayload { members: MemberResource[]; } interface MemberResource { sid: string; account_sid: string; channel_sid: string; service_sid: string; identity: string; date_created: Date; date_updated: Date; role_sid: string; last_consumed_message_index: number; last_consumption_timestamp: Date; url: string; attributes: string; } export declare class MemberInstance { protected _version: V2; protected _solution: MemberContextSolution; protected _context?: MemberContext; constructor(_version: V2, payload: MemberResource, serviceSid: string, channelSid: string, sid?: string); /** * The unique string that we created to identify the Member resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource. */ accountSid: string; /** * The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Member resource belongs to. */ channelSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Member resource is associated with. */ serviceSid: string; /** * The application-defined string that uniquely identifies the resource\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. */ identity: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the member. */ roleSid: string; /** * The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. */ lastConsumedMessageIndex: number; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). */ lastConsumptionTimestamp: Date; /** * The absolute URL of the Member resource. */ url: string; /** * The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes: string; private get _proxy(); /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ remove(params: MemberContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; lastConsumedMessageIndex: number; lastConsumptionTimestamp: Date; url: string; attributes: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MemberSolution { serviceSid: string; channelSid: string; } export interface MemberListInstance { _version: V2; _solution: MemberSolution; _uri: string; (sid: string): MemberContext; get(sid: string): MemberContext; /** * Create a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ create(params: MemberListInstanceCreateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Streams MemberInstance 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 { MemberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; each(params: MemberListInstanceEachOptions, callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MemberInstance 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: MemberPage) => any): Promise<MemberPage>; /** * Lists MemberInstance 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 { MemberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; list(params: MemberListInstanceOptions, callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; /** * Retrieve a single page of MemberInstance 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 { MemberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; page(params: MemberListInstancePageOptions, callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MemberListInstance(version: V2, serviceSid: string, channelSid: string): MemberListInstance; export declare class MemberPage extends Page<V2, MemberPayload, MemberResource, MemberInstance> { /** * Initialize the MemberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: MemberSolution); /** * Build an instance of MemberInstance * * @param payload - Payload response from the API */ getInstance(payload: MemberResource): MemberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/channel/message.js000064400000030541151677225100014032 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.MessagePage = exports.MessageListInstance = exports.MessageInstance = exports.MessageContextImpl = void 0; 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 MessageContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Messages/${sid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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["body"] !== undefined) data["Body"] = params["body"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["lastUpdatedBy"] !== undefined) data["LastUpdatedBy"] = params["lastUpdatedBy"]; if (params["from"] !== undefined) data["From"] = params["from"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.MessageContextImpl = MessageContextImpl; class MessageInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.attributes = payload.attributes; this.serviceSid = payload.service_sid; this.to = payload.to; this.channelSid = payload.channel_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.lastUpdatedBy = payload.last_updated_by; this.wasEdited = payload.was_edited; this.from = payload.from; this.body = payload.body; this.index = deserialize.integer(payload.index); this.type = payload.type; this.media = payload.media; this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MessageContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, attributes: this.attributes, serviceSid: this.serviceSid, to: this.to, channelSid: this.channelSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, lastUpdatedBy: this.lastUpdatedBy, wasEdited: this.wasEdited, from: this.from, body: this.body, index: this.index, type: this.type, media: this.media, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessageInstance = MessageInstance; function MessageListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MessageContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Messages`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["lastUpdatedBy"] !== undefined) data["LastUpdatedBy"] = params["lastUpdatedBy"]; if (params["body"] !== undefined) data["Body"] = params["body"]; if (params["mediaSid"] !== undefined) data["MediaSid"] = params["mediaSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["order"] !== undefined) data["Order"] = params["order"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MessagePage(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 MessagePage(instance._version, payload, 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; } exports.MessageListInstance = MessageListInstance; class MessagePage extends Page_1.default { /** * Initialize the MessagePage * * @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 MessageInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MessageInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessagePage = MessagePage; rest/chat/v2/service/channel/invite.js000064400000022541151677225100013705 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.InvitePage = exports.InviteListInstance = exports.InviteInstance = exports.InviteContextImpl = void 0; 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 InviteContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Invites/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InviteInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.InviteContextImpl = InviteContextImpl; class InviteInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.channelSid = payload.channel_sid; this.serviceSid = payload.service_sid; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.roleSid = payload.role_sid; this.createdBy = payload.created_by; this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InviteContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, channelSid: this.channelSid, serviceSid: this.serviceSid, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, roleSid: this.roleSid, createdBy: this.createdBy, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InviteInstance = InviteInstance; function InviteListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InviteContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Invites`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InviteInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InvitePage(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 InvitePage(instance._version, payload, 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; } exports.InviteListInstance = InviteListInstance; class InvitePage extends Page_1.default { /** * Initialize the InvitePage * * @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 InviteInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InviteInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InvitePage = InvitePage; rest/chat/v2/service/channel/webhook.d.ts000064400000034140151677225100014277 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type WebhookMethod = "GET" | "POST"; export type WebhookType = "webhook" | "trigger" | "studio"; /** * Options to pass to update a WebhookInstance */ export interface WebhookContextUpdateOptions { /** The URL of the webhook to call using the `configuration.method`. */ "configuration.url"?: string; /** */ "configuration.method"?: WebhookMethod; /** The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger). */ "configuration.filters"?: Array<string>; /** A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`. */ "configuration.triggers"?: Array<string>; /** The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` = `studio`. */ "configuration.flowSid"?: string; /** The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. */ "configuration.retryCount"?: number; } /** * Options to pass to create a WebhookInstance */ export interface WebhookListInstanceCreateOptions { /** */ type: WebhookType; /** The URL of the webhook to call using the `configuration.method`. */ "configuration.url"?: string; /** */ "configuration.method"?: WebhookMethod; /** The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger). */ "configuration.filters"?: Array<string>; /** A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`. */ "configuration.triggers"?: Array<string>; /** The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` is `studio`. */ "configuration.flowSid"?: string; /** The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. */ "configuration.retryCount"?: number; } /** * Options to pass to each */ export interface WebhookListInstanceEachOptions { /** 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: WebhookInstance, 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 WebhookListInstanceOptions { /** 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 WebhookListInstancePageOptions { /** 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 WebhookContext { /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WebhookContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class WebhookContextImpl implements WebhookContext { protected _version: V2; protected _solution: WebhookContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; update(params?: WebhookContextUpdateOptions | ((error: Error | null, item?: WebhookInstance) => any), callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WebhookContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WebhookPayload extends TwilioResponsePayload { webhooks: WebhookResource[]; } interface WebhookResource { sid: string; account_sid: string; service_sid: string; channel_sid: string; type: string; url: string; configuration: any; date_created: Date; date_updated: Date; } export declare class WebhookInstance { protected _version: V2; protected _solution: WebhookContextSolution; protected _context?: WebhookContext; constructor(_version: V2, payload: WebhookResource, serviceSid: string, channelSid: string, sid?: string); /** * The unique string that we created to identify the Channel Webhook resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel Webhook resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel Webhook resource is associated with. */ serviceSid: string; /** * The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Channel Webhook resource belongs to. */ channelSid: string; /** * The type of webhook. Can be: `webhook`, `studio`, or `trigger`. */ type: string; /** * The absolute URL of the Channel Webhook resource. */ url: string; /** * The JSON string that describes how the channel webhook is configured. The configuration object contains the `url`, `method`, `filters`, and `retry_count` values that are configured by the create and update actions. */ configuration: any; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; private get _proxy(); /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; channelSid: string; type: string; url: string; configuration: any; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WebhookSolution { serviceSid: string; channelSid: string; } export interface WebhookListInstance { _version: V2; _solution: WebhookSolution; _uri: string; (sid: string): WebhookContext; get(sid: string): WebhookContext; /** * Create a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ create(params: WebhookListInstanceCreateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Streams WebhookInstance 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 { WebhookListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; each(params: WebhookListInstanceEachOptions, callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WebhookInstance 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: WebhookPage) => any): Promise<WebhookPage>; /** * Lists WebhookInstance 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 { WebhookListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; list(params: WebhookListInstanceOptions, callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; /** * Retrieve a single page of WebhookInstance 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 { WebhookListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; page(params: WebhookListInstancePageOptions, callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WebhookListInstance(version: V2, serviceSid: string, channelSid: string): WebhookListInstance; export declare class WebhookPage extends Page<V2, WebhookPayload, WebhookResource, WebhookInstance> { /** * Initialize the WebhookPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: WebhookSolution); /** * Build an instance of WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload: WebhookResource): WebhookInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/channel/message.d.ts000064400000042214151677225100014266 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type MessageOrderType = "asc" | "desc"; export type MessageWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a MessageInstance */ export interface MessageContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; } /** * Options to pass to update a MessageInstance */ export interface MessageContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; /** The message to send to the channel. Can be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. */ body?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat\\\'s history is being recreated from a backup/separate source. */ dateCreated?: Date; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. */ dateUpdated?: Date; /** The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. */ lastUpdatedBy?: string; /** The [Identity](https://www.twilio.com/docs/chat/identity) of the message\\\'s author. */ from?: string; } /** * Options to pass to create a MessageInstance */ export interface MessageListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; /** The [Identity](https://www.twilio.com/docs/chat/identity) of the new message\\\'s author. The default value is `system`. */ from?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat\\\'s history is being recreated from a backup/separate source. */ dateCreated?: Date; /** The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. */ dateUpdated?: Date; /** The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. */ lastUpdatedBy?: string; /** The message to send to the channel. Can be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. */ body?: string; /** The SID of the [Media](https://www.twilio.com/docs/chat/rest/media) to attach to the new Message. */ mediaSid?: string; } /** * Options to pass to each */ export interface MessageListInstanceEachOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. */ order?: MessageOrderType; /** 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: MessageInstance, 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 MessageListInstanceOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. */ order?: MessageOrderType; /** 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 MessageListInstancePageOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. */ order?: MessageOrderType; /** 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 MessageContext { /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ remove(params: MessageContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MessageContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class MessageContextImpl implements MessageContext { protected _version: V2; protected _solution: MessageContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, channelSid: string, sid: string); remove(params?: MessageContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; update(params?: MessageContextUpdateOptions | ((error: Error | null, item?: MessageInstance) => any), callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MessageContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MessagePayload extends TwilioResponsePayload { messages: MessageResource[]; } interface MessageResource { sid: string; account_sid: string; attributes: string; service_sid: string; to: string; channel_sid: string; date_created: Date; date_updated: Date; last_updated_by: string; was_edited: boolean; from: string; body: string; index: number; type: string; media: any; url: string; } export declare class MessageInstance { protected _version: V2; protected _solution: MessageContextSolution; protected _context?: MessageContext; constructor(_version: V2, payload: MessageResource, serviceSid: string, channelSid: string, sid?: string); /** * The unique string that we created to identify the Message resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource. */ accountSid: string; /** * The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Message resource is associated with. */ serviceSid: string; /** * The SID of the [Channel](https://www.twilio.com/docs/chat/channels) that the message was sent to. */ to: string; /** * The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Message resource belongs to. */ channelSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. */ lastUpdatedBy: string; /** * Whether the message has been edited since it was created. */ wasEdited: boolean; /** * The [Identity](https://www.twilio.com/docs/chat/identity) of the message\'s author. The default value is `system`. */ from: string; /** * The content of the message. */ body: string; /** * The index of the message within the [Channel](https://www.twilio.com/docs/chat/channels). Indices may skip numbers, but will always be in order of when the message was received. */ index: number; /** * The Message type. Can be: `text` or `media`. */ type: string; /** * An object that describes the Message\'s media, if the message contains media. The object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object\'s file size in bytes. If the Message has no media, this value is `null`. */ media: any; /** * The absolute URL of the Message resource. */ url: string; private get _proxy(); /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ remove(params: MessageContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; attributes: string; serviceSid: string; to: string; channelSid: string; dateCreated: Date; dateUpdated: Date; lastUpdatedBy: string; wasEdited: boolean; from: string; body: string; index: number; type: string; media: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MessageSolution { serviceSid: string; channelSid: string; } export interface MessageListInstance { _version: V2; _solution: MessageSolution; _uri: string; (sid: string): MessageContext; get(sid: string): MessageContext; /** * Create a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Create a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(params: MessageListInstanceCreateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Streams MessageInstance 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 { MessageListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; each(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MessageInstance 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: MessagePage) => any): Promise<MessagePage>; /** * Lists MessageInstance 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 { MessageListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; list(params: MessageListInstanceOptions, callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; /** * Retrieve a single page of MessageInstance 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 { MessageListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; page(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessageListInstance(version: V2, serviceSid: string, channelSid: string): MessageListInstance; export declare class MessagePage extends Page<V2, MessagePayload, MessageResource, MessageInstance> { /** * Initialize the MessagePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: MessageSolution); /** * Build an instance of MessageInstance * * @param payload - Payload response from the API */ getInstance(payload: MessageResource): MessageInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/channel/member.js000064400000031147151677225100013660 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.MemberPage = exports.MemberListInstance = exports.MemberInstance = exports.MemberContextImpl = void 0; 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 MemberContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Members/${sid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["lastConsumedMessageIndex"] !== undefined) data["LastConsumedMessageIndex"] = params["lastConsumedMessageIndex"]; if (params["lastConsumptionTimestamp"] !== undefined) data["LastConsumptionTimestamp"] = serialize.iso8601DateTime(params["lastConsumptionTimestamp"]); if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.MemberContextImpl = MemberContextImpl; class MemberInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.channelSid = payload.channel_sid; this.serviceSid = payload.service_sid; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.roleSid = payload.role_sid; this.lastConsumedMessageIndex = deserialize.integer(payload.last_consumed_message_index); this.lastConsumptionTimestamp = deserialize.iso8601DateTime(payload.last_consumption_timestamp); this.url = payload.url; this.attributes = payload.attributes; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MemberContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, channelSid: this.channelSid, serviceSid: this.serviceSid, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, roleSid: this.roleSid, lastConsumedMessageIndex: this.lastConsumedMessageIndex, lastConsumptionTimestamp: this.lastConsumptionTimestamp, url: this.url, attributes: this.attributes, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberInstance = MemberInstance; function MemberListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MemberContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Members`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["lastConsumedMessageIndex"] !== undefined) data["LastConsumedMessageIndex"] = params["lastConsumedMessageIndex"]; if (params["lastConsumptionTimestamp"] !== undefined) data["LastConsumptionTimestamp"] = serialize.iso8601DateTime(params["lastConsumptionTimestamp"]); if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MemberPage(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 MemberPage(instance._version, payload, 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; } exports.MemberListInstance = MemberListInstance; class MemberPage extends Page_1.default { /** * Initialize the MemberPage * * @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 MemberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MemberInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberPage = MemberPage; rest/chat/v2/service/channel/invite.d.ts000064400000026267151677225100014152 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; /** * Options to pass to create a InviteInstance */ export interface InviteListInstanceCreateOptions { /** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. */ identity: string; /** The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the new member. */ roleSid?: string; } /** * Options to pass to each */ export interface InviteListInstanceEachOptions { /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InviteInstance, 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 InviteListInstanceOptions { /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InviteListInstancePageOptions { /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InviteContext { /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InviteContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class InviteContextImpl implements InviteContext { protected _version: V2; protected _solution: InviteContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InviteContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InvitePayload extends TwilioResponsePayload { invites: InviteResource[]; } interface InviteResource { sid: string; account_sid: string; channel_sid: string; service_sid: string; identity: string; date_created: Date; date_updated: Date; role_sid: string; created_by: string; url: string; } export declare class InviteInstance { protected _version: V2; protected _solution: InviteContextSolution; protected _context?: InviteContext; constructor(_version: V2, payload: InviteResource, serviceSid: string, channelSid: string, sid?: string); /** * The unique string that we created to identify the Invite resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Invite resource. */ accountSid: string; /** * The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Invite resource belongs to. */ channelSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Invite resource is associated with. */ serviceSid: string; /** * The application-defined string that uniquely identifies the resource\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. */ identity: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the resource. */ roleSid: string; /** * The `identity` of the User that created the invite. */ createdBy: string; /** * The absolute URL of the Invite resource. */ url: string; private get _proxy(); /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; createdBy: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InviteSolution { serviceSid: string; channelSid: string; } export interface InviteListInstance { _version: V2; _solution: InviteSolution; _uri: string; (sid: string): InviteContext; get(sid: string): InviteContext; /** * Create a InviteInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ create(params: InviteListInstanceCreateOptions, callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Streams InviteInstance 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 { InviteListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InviteInstance, done: (err?: Error) => void) => void): void; each(params: InviteListInstanceEachOptions, callback?: (item: InviteInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InviteInstance 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: InvitePage) => any): Promise<InvitePage>; /** * Lists InviteInstance 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 { InviteListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InviteInstance[]) => any): Promise<InviteInstance[]>; list(params: InviteListInstanceOptions, callback?: (error: Error | null, items: InviteInstance[]) => any): Promise<InviteInstance[]>; /** * Retrieve a single page of InviteInstance 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 { InviteListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InvitePage) => any): Promise<InvitePage>; page(params: InviteListInstancePageOptions, callback?: (error: Error | null, items: InvitePage) => any): Promise<InvitePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InviteListInstance(version: V2, serviceSid: string, channelSid: string): InviteListInstance; export declare class InvitePage extends Page<V2, InvitePayload, InviteResource, InviteInstance> { /** * Initialize the InvitePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: InviteSolution); /** * Build an instance of InviteInstance * * @param payload - Payload response from the API */ getInstance(payload: InviteResource): InviteInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/channel/webhook.js000064400000027325151677225100014052 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.WebhookPage = exports.WebhookListInstance = exports.WebhookInstance = exports.WebhookContextImpl = void 0; 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 WebhookContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Webhooks/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["configuration.url"] !== undefined) data["Configuration.Url"] = params["configuration.url"]; if (params["configuration.method"] !== undefined) data["Configuration.Method"] = params["configuration.method"]; if (params["configuration.filters"] !== undefined) data["Configuration.Filters"] = serialize.map(params["configuration.filters"], (e) => e); if (params["configuration.triggers"] !== undefined) data["Configuration.Triggers"] = serialize.map(params["configuration.triggers"], (e) => e); if (params["configuration.flowSid"] !== undefined) data["Configuration.FlowSid"] = params["configuration.flowSid"]; if (params["configuration.retryCount"] !== undefined) data["Configuration.RetryCount"] = params["configuration.retryCount"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.WebhookContextImpl = WebhookContextImpl; class WebhookInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.channelSid = payload.channel_sid; this.type = payload.type; this.url = payload.url; this.configuration = payload.configuration; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WebhookContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, channelSid: this.channelSid, type: this.type, url: this.url, configuration: this.configuration, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookInstance = WebhookInstance; function WebhookListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WebhookContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Webhooks`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["Type"] = params["type"]; if (params["configuration.url"] !== undefined) data["Configuration.Url"] = params["configuration.url"]; if (params["configuration.method"] !== undefined) data["Configuration.Method"] = params["configuration.method"]; if (params["configuration.filters"] !== undefined) data["Configuration.Filters"] = serialize.map(params["configuration.filters"], (e) => e); if (params["configuration.triggers"] !== undefined) data["Configuration.Triggers"] = serialize.map(params["configuration.triggers"], (e) => e); if (params["configuration.flowSid"] !== undefined) data["Configuration.FlowSid"] = params["configuration.flowSid"]; if (params["configuration.retryCount"] !== undefined) data["Configuration.RetryCount"] = params["configuration.retryCount"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookPage(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 WebhookPage(instance._version, payload, 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; } exports.WebhookListInstance = WebhookListInstance; class WebhookPage extends Page_1.default { /** * Initialize the WebhookPage * * @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 WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WebhookInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookPage = WebhookPage; rest/chat/v2/service/user.js000064400000027110151677225100011752 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.UserPage = exports.UserListInstance = exports.UserInstance = exports.UserContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const userBinding_1 = require("./user/userBinding"); const userChannel_1 = require("./user/userChannel"); class UserContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Users/${sid}`; } get userBindings() { this._userBindings = this._userBindings || (0, userBinding_1.UserBindingListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._userBindings; } get userChannels() { this._userChannels = this._userChannels || (0, userChannel_1.UserChannelListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._userChannels; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid, 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["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid, 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.UserContextImpl = UserContextImpl; class UserInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.attributes = payload.attributes; this.friendlyName = payload.friendly_name; this.roleSid = payload.role_sid; this.identity = payload.identity; this.isOnline = payload.is_online; this.isNotifiable = payload.is_notifiable; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.joinedChannelsCount = deserialize.integer(payload.joined_channels_count); this.links = payload.links; this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the userBindings. */ userBindings() { return this._proxy.userBindings; } /** * Access the userChannels. */ userChannels() { return this._proxy.userChannels; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, attributes: this.attributes, friendlyName: this.friendlyName, roleSid: this.roleSid, identity: this.identity, isOnline: this.isOnline, isNotifiable: this.isNotifiable, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, joinedChannelsCount: this.joinedChannelsCount, links: this.links, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserInstance = UserInstance; function UserListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Users`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserPage(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 UserPage(instance._version, payload, 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; } exports.UserListInstance = UserListInstance; class UserPage extends Page_1.default { /** * Initialize the UserPage * * @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 UserInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserPage = UserPage; rest/chat/v2/service/role.d.ts000064400000026177151677225100012205 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type RoleRoleType = "channel" | "deployment"; /** * Options to pass to update a RoleInstance */ export interface RoleContextUpdateOptions { /** A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role\\\'s `type`. */ permission: Array<string>; } /** * Options to pass to create a RoleInstance */ export interface RoleListInstanceCreateOptions { /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName: string; /** */ type: RoleRoleType; /** A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role\\\'s `type`. */ permission: Array<string>; } /** * Options to pass to each */ export interface RoleListInstanceEachOptions { /** 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: RoleInstance, 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 RoleListInstanceOptions { /** 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 RoleListInstancePageOptions { /** 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 RoleContext { /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RoleContextSolution { serviceSid: string; sid: string; } export declare class RoleContextImpl implements RoleContext { protected _version: V2; protected _solution: RoleContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RoleContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RolePayload extends TwilioResponsePayload { roles: RoleResource[]; } interface RoleResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; type: RoleRoleType; permissions: Array<string>; date_created: Date; date_updated: Date; url: string; } export declare class RoleInstance { protected _version: V2; protected _solution: RoleContextSolution; protected _context?: RoleContext; constructor(_version: V2, payload: RoleResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Role resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Role resource is associated with. */ serviceSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; type: RoleRoleType; /** * An array of the permissions the role has been granted. */ permissions: Array<string>; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Role resource. */ url: string; private get _proxy(); /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; type: RoleRoleType; permissions: string[]; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RoleSolution { serviceSid: string; } export interface RoleListInstance { _version: V2; _solution: RoleSolution; _uri: string; (sid: string): RoleContext; get(sid: string): RoleContext; /** * Create a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ create(params: RoleListInstanceCreateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Streams RoleInstance 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 { RoleListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; each(params: RoleListInstanceEachOptions, callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RoleInstance 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: RolePage) => any): Promise<RolePage>; /** * Lists RoleInstance 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 { RoleListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; list(params: RoleListInstanceOptions, callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; /** * Retrieve a single page of RoleInstance 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 { RoleListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; page(params: RoleListInstancePageOptions, callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RoleListInstance(version: V2, serviceSid: string): RoleListInstance; export declare class RolePage extends Page<V2, RolePayload, RoleResource, RoleInstance> { /** * Initialize the RolePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: RoleSolution); /** * Build an instance of RoleInstance * * @param payload - Payload response from the API */ getInstance(payload: RoleResource): RoleInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/user.d.ts000064400000035361151677225100012215 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; import { UserBindingListInstance } from "./user/userBinding"; import { UserChannelListInstance } from "./user/userChannel"; export type UserWebhookEnabledType = "true" | "false"; /** * Options to pass to update a UserInstance */ export interface UserContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; /** The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the User. */ roleSid?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; /** A descriptive string that you create to describe the resource. It is often used for display purposes. */ friendlyName?: string; } /** * Options to pass to create a UserInstance */ export interface UserListInstanceCreateOptions { /** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). This value is often a username or email address. See the Identity documentation for more info. */ identity: string; /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; /** The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the new User. */ roleSid?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; /** A descriptive string that you create to describe the new resource. This value is often used for display purposes. */ friendlyName?: string; } /** * Options to pass to each */ export interface UserListInstanceEachOptions { /** 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: UserInstance, 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 UserListInstanceOptions { /** 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 UserListInstancePageOptions { /** 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 UserContext { userBindings: UserBindingListInstance; userChannels: UserChannelListInstance; /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserContextSolution { serviceSid: string; sid: string; } export declare class UserContextImpl implements UserContext { protected _version: V2; protected _solution: UserContextSolution; protected _uri: string; protected _userBindings?: UserBindingListInstance; protected _userChannels?: UserChannelListInstance; constructor(_version: V2, serviceSid: string, sid: string); get userBindings(): UserBindingListInstance; get userChannels(): UserChannelListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; update(params?: UserContextUpdateOptions | ((error: Error | null, item?: UserInstance) => any), callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserPayload extends TwilioResponsePayload { users: UserResource[]; } interface UserResource { sid: string; account_sid: string; service_sid: string; attributes: string; friendly_name: string; role_sid: string; identity: string; is_online: boolean; is_notifiable: boolean; date_created: Date; date_updated: Date; joined_channels_count: number; links: Record<string, string>; url: string; } export declare class UserInstance { protected _version: V2; protected _solution: UserContextSolution; protected _context?: UserContext; constructor(_version: V2, payload: UserResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the User resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User resource is associated with. */ serviceSid: string; /** * The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the user. */ roleSid: string; /** * The application-defined string that uniquely identifies the resource\'s User within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). This value is often a username or an email address, and is case-sensitive. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. */ identity: string; /** * Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service\'s `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service\'s `reachability_enabled` is `true`. */ isOnline: boolean; /** * Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service\'s `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service\'s `reachability_enabled` is `true`. */ isNotifiable: boolean; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The number of Channels the User is a Member of. */ joinedChannelsCount: number; /** * The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/channels) and [Binding](https://www.twilio.com/docs/chat/rest/binding-resource) resources related to the user. */ links: Record<string, string>; /** * The absolute URL of the User resource. */ url: string; private get _proxy(); /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Access the userBindings. */ userBindings(): UserBindingListInstance; /** * Access the userChannels. */ userChannels(): UserChannelListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; attributes: string; friendlyName: string; roleSid: string; identity: string; isOnline: boolean; isNotifiable: boolean; dateCreated: Date; dateUpdated: Date; joinedChannelsCount: number; links: Record<string, string>; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserSolution { serviceSid: string; } export interface UserListInstance { _version: V2; _solution: UserSolution; _uri: string; (sid: string): UserContext; get(sid: string): UserContext; /** * Create a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ create(params: UserListInstanceCreateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Streams UserInstance 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 { UserListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; each(params: UserListInstanceEachOptions, callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserInstance 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: UserPage) => any): Promise<UserPage>; /** * Lists UserInstance 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 { UserListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; list(params: UserListInstanceOptions, callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; /** * Retrieve a single page of UserInstance 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 { UserListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; page(params: UserListInstancePageOptions, callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserListInstance(version: V2, serviceSid: string): UserListInstance; export declare class UserPage extends Page<V2, UserPayload, UserResource, UserInstance> { /** * Initialize the UserPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: UserSolution); /** * Build an instance of UserInstance * * @param payload - Payload response from the API */ getInstance(payload: UserResource): UserInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v2/service/channel.js000064400000032456151677225100012415 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.ChannelPage = exports.ChannelListInstance = exports.ChannelInstance = exports.ChannelContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const invite_1 = require("./channel/invite"); const member_1 = require("./channel/member"); const message_1 = require("./channel/message"); const webhook_1 = require("./channel/webhook"); class ChannelContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${sid}`; } get invites() { this._invites = this._invites || (0, invite_1.InviteListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._invites; } get members() { this._members = this._members || (0, member_1.MemberListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._members; } get messages() { this._messages = this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._messages; } get webhooks() { this._webhooks = this._webhooks || (0, webhook_1.WebhookListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._webhooks; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["createdBy"] !== undefined) data["CreatedBy"] = params["createdBy"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid, 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.ChannelContextImpl = ChannelContextImpl; class ChannelInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.attributes = payload.attributes; this.type = payload.type; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this.membersCount = deserialize.integer(payload.members_count); this.messagesCount = deserialize.integer(payload.messages_count); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ChannelContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the invites. */ invites() { return this._proxy.invites; } /** * Access the members. */ members() { return this._proxy.members; } /** * Access the messages. */ messages() { return this._proxy.messages; } /** * Access the webhooks. */ webhooks() { return this._proxy.webhooks; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, uniqueName: this.uniqueName, attributes: this.attributes, type: this.type, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, membersCount: this.membersCount, messagesCount: this.messagesCount, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelInstance = ChannelInstance; function ChannelListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ChannelContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Channels`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["type"] !== undefined) data["Type"] = params["type"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["createdBy"] !== undefined) data["CreatedBy"] = params["createdBy"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid)); 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["type"] !== undefined) data["Type"] = serialize.map(params["type"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelPage(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 ChannelPage(instance._version, payload, 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; } exports.ChannelListInstance = ChannelListInstance; class ChannelPage extends Page_1.default { /** * Initialize the ChannelPage * * @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 ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ChannelInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelPage = ChannelPage; rest/chat/v2/service/role.js000064400000024144151677225100011741 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.RolePage = exports.RoleListInstance = exports.RoleInstance = exports.RoleContextImpl = void 0; 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 RoleContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Roles/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid, 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.RoleContextImpl = RoleContextImpl; class RoleInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.permissions = payload.permissions; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RoleContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, type: this.type, permissions: this.permissions, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoleInstance = RoleInstance; function RoleListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RoleContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Roles`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RolePage(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 RolePage(instance._version, payload, 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; } exports.RoleListInstance = RoleListInstance; class RolePage extends Page_1.default { /** * Initialize the RolePage * * @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 RoleInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RoleInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RolePage = RolePage; rest/chat/v1/service.d.ts000064400000061654151677225100011242 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { ChannelListInstance } from "./service/channel"; import { RoleListInstance } from "./service/role"; import { UserListInstance } from "./service/user"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The service role assigned to users when they are added to the service. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. */ defaultServiceRoleSid?: string; /** The channel role assigned to users when they are added to a channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. */ defaultChannelRoleSid?: string; /** The channel role assigned to a channel creator when they join a new channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. */ defaultChannelCreatorRoleSid?: string; /** Whether to enable the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature. The default is `true`. */ readStatusEnabled?: boolean; /** Whether to enable the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) for this Service instance. The default is `false`. */ reachabilityEnabled?: boolean; /** How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. */ typingIndicatorTimeout?: number; /** DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. */ consumptionReportInterval?: number; /** Whether to send a notification when a new message is added to a channel. Can be: `true` or `false` and the default is `false`. */ "notifications.newMessage.enabled"?: boolean; /** The template to use to create the notification text displayed when a new message is added to a channel and `notifications.new_message.enabled` is `true`. */ "notifications.newMessage.template"?: string; /** Whether to send a notification when a member is added to a channel. Can be: `true` or `false` and the default is `false`. */ "notifications.addedToChannel.enabled"?: boolean; /** The template to use to create the notification text displayed when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. */ "notifications.addedToChannel.template"?: string; /** Whether to send a notification to a user when they are removed from a channel. Can be: `true` or `false` and the default is `false`. */ "notifications.removedFromChannel.enabled"?: boolean; /** The template to use to create the notification text displayed to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. */ "notifications.removedFromChannel.template"?: string; /** Whether to send a notification when a user is invited to a channel. Can be: `true` or `false` and the default is `false`. */ "notifications.invitedToChannel.enabled"?: boolean; /** The template to use to create the notification text displayed when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. */ "notifications.invitedToChannel.template"?: string; /** The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. */ preWebhookUrl?: string; /** The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. */ postWebhookUrl?: string; /** The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ webhookMethod?: string; /** The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ webhookFilters?: Array<string>; /** The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. */ "webhooks.onMessageSend.url"?: string; /** The HTTP method to use when calling the `webhooks.on_message_send.url`. */ "webhooks.onMessageSend.method"?: string; /** The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. */ "webhooks.onMessageUpdate.url"?: string; /** The HTTP method to use when calling the `webhooks.on_message_update.url`. */ "webhooks.onMessageUpdate.method"?: string; /** The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. */ "webhooks.onMessageRemove.url"?: string; /** The HTTP method to use when calling the `webhooks.on_message_remove.url`. */ "webhooks.onMessageRemove.method"?: string; /** The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. */ "webhooks.onChannelAdd.url"?: string; /** The HTTP method to use when calling the `webhooks.on_channel_add.url`. */ "webhooks.onChannelAdd.method"?: string; /** The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. */ "webhooks.onChannelDestroy.url"?: string; /** The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. */ "webhooks.onChannelDestroy.method"?: string; /** The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. */ "webhooks.onChannelUpdate.url"?: string; /** The HTTP method to use when calling the `webhooks.on_channel_update.url`. */ "webhooks.onChannelUpdate.method"?: string; /** The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. */ "webhooks.onMemberAdd.url"?: string; /** The HTTP method to use when calling the `webhooks.on_member_add.url`. */ "webhooks.onMemberAdd.method"?: string; /** The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. */ "webhooks.onMemberRemove.url"?: string; /** The HTTP method to use when calling the `webhooks.on_member_remove.url`. */ "webhooks.onMemberRemove.method"?: string; /** The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. */ "webhooks.onMessageSent.url"?: string; /** The URL of the webhook to call in response to the `on_message_sent` event`. */ "webhooks.onMessageSent.method"?: string; /** The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. */ "webhooks.onMessageUpdated.url"?: string; /** The HTTP method to use when calling the `webhooks.on_message_updated.url`. */ "webhooks.onMessageUpdated.method"?: string; /** The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. */ "webhooks.onMessageRemoved.url"?: string; /** The HTTP method to use when calling the `webhooks.on_message_removed.url`. */ "webhooks.onMessageRemoved.method"?: string; /** The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. */ "webhooks.onChannelAdded.url"?: string; /** The URL of the webhook to call in response to the `on_channel_added` event`. */ "webhooks.onChannelAdded.method"?: string; /** The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. */ "webhooks.onChannelDestroyed.url"?: string; /** The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. */ "webhooks.onChannelDestroyed.method"?: string; /** The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. */ "webhooks.onChannelUpdated.url"?: string; /** The HTTP method to use when calling the `webhooks.on_channel_updated.url`. */ "webhooks.onChannelUpdated.method"?: string; /** The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. */ "webhooks.onMemberAdded.url"?: string; /** The HTTP method to use when calling the `webhooks.on_channel_updated.url`. */ "webhooks.onMemberAdded.method"?: string; /** The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. */ "webhooks.onMemberRemoved.url"?: string; /** The HTTP method to use when calling the `webhooks.on_member_removed.url`. */ "webhooks.onMemberRemoved.method"?: string; /** The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. */ "limits.channelMembers"?: number; /** The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. */ "limits.userChannels"?: number; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName: string; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { channels: ChannelListInstance; roles: RoleListInstance; users: UserListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V1; protected _solution: ServiceContextSolution; protected _uri: string; protected _channels?: ChannelListInstance; protected _roles?: RoleListInstance; protected _users?: UserListInstance; constructor(_version: V1, sid: string); get channels(): ChannelListInstance; get roles(): RoleListInstance; get users(): UserListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; date_created: Date; date_updated: Date; default_service_role_sid: string; default_channel_role_sid: string; default_channel_creator_role_sid: string; read_status_enabled: boolean; reachability_enabled: boolean; typing_indicator_timeout: number; consumption_report_interval: number; limits: any; webhooks: any; pre_webhook_url: string; post_webhook_url: string; webhook_method: string; webhook_filters: Array<string>; notifications: any; url: string; links: Record<string, string>; } export declare class ServiceInstance { protected _version: V1; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V1, payload: ServiceResource, sid?: string); /** * The unique string that we created to identify the Service resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Service 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](http://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](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The service role assigned to users when they are added to the service. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. */ defaultServiceRoleSid: string; /** * The channel role assigned to users when they are added to a channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. */ defaultChannelRoleSid: string; /** * The channel role assigned to a channel creator when they join a new channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. */ defaultChannelCreatorRoleSid: string; /** * Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. */ readStatusEnabled: boolean; /** * Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. */ reachabilityEnabled: boolean; /** * How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. */ typingIndicatorTimeout: number; /** * DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. */ consumptionReportInterval: number; /** * An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. */ limits: any; /** * An object that contains information about the webhooks configured for this service. */ webhooks: any; /** * The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. */ preWebhookUrl: string; /** * The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. */ postWebhookUrl: string; /** * The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ webhookMethod: string; /** * The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. */ webhookFilters: Array<string>; /** * The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more information. */ notifications: any; /** * The absolute URL of the Service resource. */ url: string; /** * The absolute URLs of the Service\'s [Channels](https://www.twilio.com/docs/chat/api/channels), [Roles](https://www.twilio.com/docs/chat/api/roles), and [Users](https://www.twilio.com/docs/chat/api/users). */ links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the channels. */ channels(): ChannelListInstance; /** * Access the roles. */ roles(): RoleListInstance; /** * Access the users. */ users(): UserListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; defaultServiceRoleSid: string; defaultChannelRoleSid: string; defaultChannelCreatorRoleSid: string; readStatusEnabled: boolean; reachabilityEnabled: boolean; typingIndicatorTimeout: number; consumptionReportInterval: number; limits: any; webhooks: any; preWebhookUrl: string; postWebhookUrl: string; webhookMethod: string; webhookFilters: string[]; notifications: any; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V1; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V1): ServiceListInstance; export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v1/service.js000064400000050273151677225100011001 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const channel_1 = require("./service/channel"); const role_1 = require("./service/role"); const user_1 = require("./service/user"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get channels() { this._channels = this._channels || (0, channel_1.ChannelListInstance)(this._version, this._solution.sid); return this._channels; } get roles() { this._roles = this._roles || (0, role_1.RoleListInstance)(this._version, this._solution.sid); return this._roles; } get users() { this._users = this._users || (0, user_1.UserListInstance)(this._version, this._solution.sid); return this._users; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["defaultServiceRoleSid"] !== undefined) data["DefaultServiceRoleSid"] = params["defaultServiceRoleSid"]; if (params["defaultChannelRoleSid"] !== undefined) data["DefaultChannelRoleSid"] = params["defaultChannelRoleSid"]; if (params["defaultChannelCreatorRoleSid"] !== undefined) data["DefaultChannelCreatorRoleSid"] = params["defaultChannelCreatorRoleSid"]; if (params["readStatusEnabled"] !== undefined) data["ReadStatusEnabled"] = serialize.bool(params["readStatusEnabled"]); if (params["reachabilityEnabled"] !== undefined) data["ReachabilityEnabled"] = serialize.bool(params["reachabilityEnabled"]); if (params["typingIndicatorTimeout"] !== undefined) data["TypingIndicatorTimeout"] = params["typingIndicatorTimeout"]; if (params["consumptionReportInterval"] !== undefined) data["ConsumptionReportInterval"] = params["consumptionReportInterval"]; if (params["notifications.newMessage.enabled"] !== undefined) data["Notifications.NewMessage.Enabled"] = serialize.bool(params["notifications.newMessage.enabled"]); if (params["notifications.newMessage.template"] !== undefined) data["Notifications.NewMessage.Template"] = params["notifications.newMessage.template"]; if (params["notifications.addedToChannel.enabled"] !== undefined) data["Notifications.AddedToChannel.Enabled"] = serialize.bool(params["notifications.addedToChannel.enabled"]); if (params["notifications.addedToChannel.template"] !== undefined) data["Notifications.AddedToChannel.Template"] = params["notifications.addedToChannel.template"]; if (params["notifications.removedFromChannel.enabled"] !== undefined) data["Notifications.RemovedFromChannel.Enabled"] = serialize.bool(params["notifications.removedFromChannel.enabled"]); if (params["notifications.removedFromChannel.template"] !== undefined) data["Notifications.RemovedFromChannel.Template"] = params["notifications.removedFromChannel.template"]; if (params["notifications.invitedToChannel.enabled"] !== undefined) data["Notifications.InvitedToChannel.Enabled"] = serialize.bool(params["notifications.invitedToChannel.enabled"]); if (params["notifications.invitedToChannel.template"] !== undefined) data["Notifications.InvitedToChannel.Template"] = params["notifications.invitedToChannel.template"]; if (params["preWebhookUrl"] !== undefined) data["PreWebhookUrl"] = params["preWebhookUrl"]; if (params["postWebhookUrl"] !== undefined) data["PostWebhookUrl"] = params["postWebhookUrl"]; if (params["webhookMethod"] !== undefined) data["WebhookMethod"] = params["webhookMethod"]; if (params["webhookFilters"] !== undefined) data["WebhookFilters"] = serialize.map(params["webhookFilters"], (e) => e); if (params["webhooks.onMessageSend.url"] !== undefined) data["Webhooks.OnMessageSend.Url"] = params["webhooks.onMessageSend.url"]; if (params["webhooks.onMessageSend.method"] !== undefined) data["Webhooks.OnMessageSend.Method"] = params["webhooks.onMessageSend.method"]; if (params["webhooks.onMessageUpdate.url"] !== undefined) data["Webhooks.OnMessageUpdate.Url"] = params["webhooks.onMessageUpdate.url"]; if (params["webhooks.onMessageUpdate.method"] !== undefined) data["Webhooks.OnMessageUpdate.Method"] = params["webhooks.onMessageUpdate.method"]; if (params["webhooks.onMessageRemove.url"] !== undefined) data["Webhooks.OnMessageRemove.Url"] = params["webhooks.onMessageRemove.url"]; if (params["webhooks.onMessageRemove.method"] !== undefined) data["Webhooks.OnMessageRemove.Method"] = params["webhooks.onMessageRemove.method"]; if (params["webhooks.onChannelAdd.url"] !== undefined) data["Webhooks.OnChannelAdd.Url"] = params["webhooks.onChannelAdd.url"]; if (params["webhooks.onChannelAdd.method"] !== undefined) data["Webhooks.OnChannelAdd.Method"] = params["webhooks.onChannelAdd.method"]; if (params["webhooks.onChannelDestroy.url"] !== undefined) data["Webhooks.OnChannelDestroy.Url"] = params["webhooks.onChannelDestroy.url"]; if (params["webhooks.onChannelDestroy.method"] !== undefined) data["Webhooks.OnChannelDestroy.Method"] = params["webhooks.onChannelDestroy.method"]; if (params["webhooks.onChannelUpdate.url"] !== undefined) data["Webhooks.OnChannelUpdate.Url"] = params["webhooks.onChannelUpdate.url"]; if (params["webhooks.onChannelUpdate.method"] !== undefined) data["Webhooks.OnChannelUpdate.Method"] = params["webhooks.onChannelUpdate.method"]; if (params["webhooks.onMemberAdd.url"] !== undefined) data["Webhooks.OnMemberAdd.Url"] = params["webhooks.onMemberAdd.url"]; if (params["webhooks.onMemberAdd.method"] !== undefined) data["Webhooks.OnMemberAdd.Method"] = params["webhooks.onMemberAdd.method"]; if (params["webhooks.onMemberRemove.url"] !== undefined) data["Webhooks.OnMemberRemove.Url"] = params["webhooks.onMemberRemove.url"]; if (params["webhooks.onMemberRemove.method"] !== undefined) data["Webhooks.OnMemberRemove.Method"] = params["webhooks.onMemberRemove.method"]; if (params["webhooks.onMessageSent.url"] !== undefined) data["Webhooks.OnMessageSent.Url"] = params["webhooks.onMessageSent.url"]; if (params["webhooks.onMessageSent.method"] !== undefined) data["Webhooks.OnMessageSent.Method"] = params["webhooks.onMessageSent.method"]; if (params["webhooks.onMessageUpdated.url"] !== undefined) data["Webhooks.OnMessageUpdated.Url"] = params["webhooks.onMessageUpdated.url"]; if (params["webhooks.onMessageUpdated.method"] !== undefined) data["Webhooks.OnMessageUpdated.Method"] = params["webhooks.onMessageUpdated.method"]; if (params["webhooks.onMessageRemoved.url"] !== undefined) data["Webhooks.OnMessageRemoved.Url"] = params["webhooks.onMessageRemoved.url"]; if (params["webhooks.onMessageRemoved.method"] !== undefined) data["Webhooks.OnMessageRemoved.Method"] = params["webhooks.onMessageRemoved.method"]; if (params["webhooks.onChannelAdded.url"] !== undefined) data["Webhooks.OnChannelAdded.Url"] = params["webhooks.onChannelAdded.url"]; if (params["webhooks.onChannelAdded.method"] !== undefined) data["Webhooks.OnChannelAdded.Method"] = params["webhooks.onChannelAdded.method"]; if (params["webhooks.onChannelDestroyed.url"] !== undefined) data["Webhooks.OnChannelDestroyed.Url"] = params["webhooks.onChannelDestroyed.url"]; if (params["webhooks.onChannelDestroyed.method"] !== undefined) data["Webhooks.OnChannelDestroyed.Method"] = params["webhooks.onChannelDestroyed.method"]; if (params["webhooks.onChannelUpdated.url"] !== undefined) data["Webhooks.OnChannelUpdated.Url"] = params["webhooks.onChannelUpdated.url"]; if (params["webhooks.onChannelUpdated.method"] !== undefined) data["Webhooks.OnChannelUpdated.Method"] = params["webhooks.onChannelUpdated.method"]; if (params["webhooks.onMemberAdded.url"] !== undefined) data["Webhooks.OnMemberAdded.Url"] = params["webhooks.onMemberAdded.url"]; if (params["webhooks.onMemberAdded.method"] !== undefined) data["Webhooks.OnMemberAdded.Method"] = params["webhooks.onMemberAdded.method"]; if (params["webhooks.onMemberRemoved.url"] !== undefined) data["Webhooks.OnMemberRemoved.Url"] = params["webhooks.onMemberRemoved.url"]; if (params["webhooks.onMemberRemoved.method"] !== undefined) data["Webhooks.OnMemberRemoved.Method"] = params["webhooks.onMemberRemoved.method"]; if (params["limits.channelMembers"] !== undefined) data["Limits.ChannelMembers"] = params["limits.channelMembers"]; if (params["limits.userChannels"] !== undefined) data["Limits.UserChannels"] = params["limits.userChannels"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { 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.defaultServiceRoleSid = payload.default_service_role_sid; this.defaultChannelRoleSid = payload.default_channel_role_sid; this.defaultChannelCreatorRoleSid = payload.default_channel_creator_role_sid; this.readStatusEnabled = payload.read_status_enabled; this.reachabilityEnabled = payload.reachability_enabled; this.typingIndicatorTimeout = deserialize.integer(payload.typing_indicator_timeout); this.consumptionReportInterval = deserialize.integer(payload.consumption_report_interval); this.limits = payload.limits; this.webhooks = payload.webhooks; this.preWebhookUrl = payload.pre_webhook_url; this.postWebhookUrl = payload.post_webhook_url; this.webhookMethod = payload.webhook_method; this.webhookFilters = payload.webhook_filters; this.notifications = payload.notifications; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the channels. */ channels() { return this._proxy.channels; } /** * Access the roles. */ roles() { return this._proxy.roles; } /** * Access the users. */ users() { return this._proxy.users; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, defaultServiceRoleSid: this.defaultServiceRoleSid, defaultChannelRoleSid: this.defaultChannelRoleSid, defaultChannelCreatorRoleSid: this.defaultChannelCreatorRoleSid, readStatusEnabled: this.readStatusEnabled, reachabilityEnabled: this.reachabilityEnabled, typingIndicatorTimeout: this.typingIndicatorTimeout, consumptionReportInterval: this.consumptionReportInterval, limits: this.limits, webhooks: this.webhooks, preWebhookUrl: this.preWebhookUrl, postWebhookUrl: this.postWebhookUrl, webhookMethod: this.webhookMethod, webhookFilters: this.webhookFilters, notifications: this.notifications, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/chat/v1/credential.d.ts000064400000032522151677225100011704 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type CredentialPushService = "gcm" | "apn" | "fcm"; /** * Options to pass to update a CredentialInstance */ export interface CredentialContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----` */ certificate?: string; /** [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR. -----END RSA PRIVATE KEY-----` */ privateKey?: string; /** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox?: boolean; /** [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. */ apiKey?: string; /** [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. */ secret?: string; } /** * Options to pass to create a CredentialInstance */ export interface CredentialListInstanceCreateOptions { /** */ type: CredentialPushService; /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName?: string; /** [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----` */ certificate?: string; /** [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR. -----END RSA PRIVATE KEY-----` */ privateKey?: string; /** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox?: boolean; /** [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. */ apiKey?: string; /** [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. */ secret?: string; } /** * Options to pass to each */ export interface CredentialListInstanceEachOptions { /** 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: CredentialInstance, 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 CredentialListInstanceOptions { /** 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 CredentialListInstancePageOptions { /** 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 CredentialContext { /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialContextSolution { sid: string; } export declare class CredentialContextImpl implements CredentialContext { protected _version: V1; protected _solution: CredentialContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; update(params?: CredentialContextUpdateOptions | ((error: Error | null, item?: CredentialInstance) => any), callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialPayload extends TwilioResponsePayload { credentials: CredentialResource[]; } interface CredentialResource { sid: string; account_sid: string; friendly_name: string; type: CredentialPushService; sandbox: string; date_created: Date; date_updated: Date; url: string; } export declare class CredentialInstance { protected _version: V1; protected _solution: CredentialContextSolution; protected _context?: CredentialContext; constructor(_version: V1, payload: CredentialResource, sid?: string); /** * The unique string that we created to identify the Credential resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Credential resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; type: CredentialPushService; /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox: string; /** * The date and time in GMT when the resource was created specified in [RFC 2822](http://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](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The absolute URL of the Credential resource. */ url: string; private get _proxy(); /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; type: CredentialPushService; sandbox: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialSolution { } export interface CredentialListInstance { _version: V1; _solution: CredentialSolution; _uri: string; (sid: string): CredentialContext; get(sid: string): CredentialContext; /** * Create a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ create(params: CredentialListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Streams CredentialInstance 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 { CredentialListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListInstanceEachOptions, callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialInstance 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: CredentialPage) => any): Promise<CredentialPage>; /** * Lists CredentialInstance 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 { CredentialListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; list(params: CredentialListInstanceOptions, callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; /** * Retrieve a single page of CredentialInstance 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 { CredentialListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; page(params: CredentialListInstancePageOptions, callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListInstance(version: V1): CredentialListInstance; export declare class CredentialPage extends Page<V1, CredentialPayload, CredentialResource, CredentialInstance> { /** * Initialize the CredentialPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CredentialSolution); /** * Build an instance of CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialResource): CredentialInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v1/credential.js000064400000024172151677225100011452 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.CredentialPage = exports.CredentialListInstance = exports.CredentialInstance = exports.CredentialContextImpl = void 0; 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 CredentialContextImpl { 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/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, 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.CredentialContextImpl = CredentialContextImpl; class CredentialInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.sandbox = payload.sandbox; 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 CredentialContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, type: this.type, sandbox: this.sandbox, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialInstance = CredentialInstance; function CredentialListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Credentials`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["Type"] = params["type"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialPage(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 CredentialPage(instance._version, payload, 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; } exports.CredentialListInstance = CredentialListInstance; class CredentialPage extends Page_1.default { /** * Initialize the CredentialPage * * @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 CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialPage = CredentialPage; rest/chat/v1/service/user/userChannel.js000064400000012525151677225100014224 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.UserChannelPage = exports.UserChannelInstance = exports.UserChannelListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function UserChannelListInstance(version, serviceSid, userSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { serviceSid, userSid }; instance._uri = `/Services/${serviceSid}/Users/${userSid}/Channels`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserChannelPage(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 UserChannelPage(instance._version, payload, 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; } exports.UserChannelListInstance = UserChannelListInstance; class UserChannelInstance { constructor(_version, payload, serviceSid, userSid) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.channelSid = payload.channel_sid; this.memberSid = payload.member_sid; this.status = payload.status; this.lastConsumedMessageIndex = deserialize.integer(payload.last_consumed_message_index); this.unreadMessagesCount = deserialize.integer(payload.unread_messages_count); this.links = payload.links; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, channelSid: this.channelSid, memberSid: this.memberSid, status: this.status, lastConsumedMessageIndex: this.lastConsumedMessageIndex, unreadMessagesCount: this.unreadMessagesCount, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserChannelInstance = UserChannelInstance; class UserChannelPage extends Page_1.default { /** * Initialize the UserChannelPage * * @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 UserChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserChannelInstance(this._version, payload, this._solution.serviceSid, this._solution.userSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserChannelPage = UserChannelPage; rest/chat/v1/service/user/userChannel.d.ts000064400000017441151677225100014462 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type UserChannelChannelStatus = "joined" | "invited" | "not_participating"; /** * Options to pass to each */ export interface UserChannelListInstanceEachOptions { /** 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: UserChannelInstance, 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 UserChannelListInstanceOptions { /** 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 UserChannelListInstancePageOptions { /** 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 UserChannelSolution { serviceSid: string; userSid: string; } export interface UserChannelListInstance { _version: V1; _solution: UserChannelSolution; _uri: string; /** * Streams UserChannelInstance 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 { UserChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserChannelInstance, done: (err?: Error) => void) => void): void; each(params: UserChannelListInstanceEachOptions, callback?: (item: UserChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserChannelInstance 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: UserChannelPage) => any): Promise<UserChannelPage>; /** * Lists UserChannelInstance 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 { UserChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserChannelInstance[]) => any): Promise<UserChannelInstance[]>; list(params: UserChannelListInstanceOptions, callback?: (error: Error | null, items: UserChannelInstance[]) => any): Promise<UserChannelInstance[]>; /** * Retrieve a single page of UserChannelInstance 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 { UserChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserChannelPage) => any): Promise<UserChannelPage>; page(params: UserChannelListInstancePageOptions, callback?: (error: Error | null, items: UserChannelPage) => any): Promise<UserChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserChannelListInstance(version: V1, serviceSid: string, userSid: string): UserChannelListInstance; interface UserChannelPayload extends TwilioResponsePayload { channels: UserChannelResource[]; } interface UserChannelResource { account_sid: string; service_sid: string; channel_sid: string; member_sid: string; status: UserChannelChannelStatus; last_consumed_message_index: number; unread_messages_count: number; links: Record<string, string>; } export declare class UserChannelInstance { protected _version: V1; constructor(_version: V1, payload: UserChannelResource, serviceSid: string, userSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User Channel resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. */ serviceSid: string; /** * The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. */ channelSid: string; /** * The SID of a [Member](https://www.twilio.com/docs/api/chat/rest/members) that represents the User on the Channel. */ memberSid: string; status: UserChannelChannelStatus; /** * The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. */ lastConsumedMessageIndex: number; /** * The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](/docs/api/chat/guides/consumption-horizon) to learn how to mark messages as consumed. */ unreadMessagesCount: number; /** * The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. */ links: Record<string, string>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; channelSid: string; memberSid: string; status: UserChannelChannelStatus; lastConsumedMessageIndex: number; unreadMessagesCount: number; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class UserChannelPage extends Page<V1, UserChannelPayload, UserChannelResource, UserChannelInstance> { /** * Initialize the UserChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UserChannelSolution); /** * Build an instance of UserChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: UserChannelResource): UserChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v1/service/channel.d.ts000064400000035672151677225100012653 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { InviteListInstance } from "./channel/invite"; import { MemberListInstance } from "./channel/member"; import { MessageListInstance } from "./channel/message"; export type ChannelChannelType = "public" | "private"; /** * Options to pass to update a ChannelInstance */ export interface ChannelContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\\\'s `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. */ uniqueName?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; } /** * Options to pass to create a ChannelInstance */ export interface ChannelListInstanceCreateOptions { /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName?: string; /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\\\'s `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. */ uniqueName?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; /** */ type?: ChannelChannelType; } /** * Options to pass to each */ export interface ChannelListInstanceEachOptions { /** The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. */ type?: Array<ChannelChannelType>; /** 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: ChannelInstance, 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 ChannelListInstanceOptions { /** The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. */ type?: Array<ChannelChannelType>; /** 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 ChannelListInstancePageOptions { /** The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. */ type?: Array<ChannelChannelType>; /** 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 ChannelContext { invites: InviteListInstance; members: MemberListInstance; messages: MessageListInstance; /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ChannelContextSolution { serviceSid: string; sid: string; } export declare class ChannelContextImpl implements ChannelContext { protected _version: V1; protected _solution: ChannelContextSolution; protected _uri: string; protected _invites?: InviteListInstance; protected _members?: MemberListInstance; protected _messages?: MessageListInstance; constructor(_version: V1, serviceSid: string, sid: string); get invites(): InviteListInstance; get members(): MemberListInstance; get messages(): MessageListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; update(params?: ChannelContextUpdateOptions | ((error: Error | null, item?: ChannelInstance) => any), callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ChannelPayload extends TwilioResponsePayload { channels: ChannelResource[]; } interface ChannelResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; unique_name: string; attributes: string; type: ChannelChannelType; date_created: Date; date_updated: Date; created_by: string; members_count: number; messages_count: number; url: string; links: Record<string, string>; } export declare class ChannelInstance { protected _version: V1; protected _solution: ChannelContextSolution; protected _context?: ChannelContext; constructor(_version: V1, payload: ChannelResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Channel resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Channel resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. */ serviceSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\'s `sid` in the URL. */ uniqueName: string; /** * The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it\'s only displayed in a FETCH action that returns a single resource; otherwise, it\'s null. If the attributes have not been set, `{}` is returned. */ attributes: string; type: ChannelChannelType; /** * The date and time in GMT when the resource was created specified in [RFC 2822](http://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](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. */ createdBy: string; /** * The number of Members in the Channel. */ membersCount: number; /** * The number of Messages in the Channel. */ messagesCount: number; /** * The absolute URL of the Channel resource. */ url: string; /** * The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. */ links: Record<string, string>; private get _proxy(); /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Access the invites. */ invites(): InviteListInstance; /** * Access the members. */ members(): MemberListInstance; /** * Access the messages. */ messages(): MessageListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; uniqueName: string; attributes: string; type: ChannelChannelType; dateCreated: Date; dateUpdated: Date; createdBy: string; membersCount: number; messagesCount: number; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ChannelSolution { serviceSid: string; } export interface ChannelListInstance { _version: V1; _solution: ChannelSolution; _uri: string; (sid: string): ChannelContext; get(sid: string): ChannelContext; /** * Create a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ create(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Create a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ create(params: ChannelListInstanceCreateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Streams ChannelInstance 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 { ChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; each(params: ChannelListInstanceEachOptions, callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ChannelInstance 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: ChannelPage) => any): Promise<ChannelPage>; /** * Lists ChannelInstance 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 { ChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; list(params: ChannelListInstanceOptions, callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; /** * Retrieve a single page of ChannelInstance 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 { ChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; page(params: ChannelListInstancePageOptions, callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ChannelListInstance(version: V1, serviceSid: string): ChannelListInstance; export declare class ChannelPage extends Page<V1, ChannelPayload, ChannelResource, ChannelInstance> { /** * Initialize the ChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ChannelSolution); /** * Build an instance of ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: ChannelResource): ChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v1/service/channel/member.d.ts000064400000033462151677225100014115 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to update a MemberInstance */ export interface MemberContextUpdateOptions { /** The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services). */ roleSid?: string; /** The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) that the Member has read within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels). */ lastConsumedMessageIndex?: number; } /** * Options to pass to create a MemberInstance */ export interface MemberListInstanceCreateOptions { /** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. */ identity: string; /** The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services). */ roleSid?: string; } /** * Options to pass to each */ export interface MemberListInstanceEachOptions { /** The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: MemberInstance, 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 MemberListInstanceOptions { /** The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface MemberListInstancePageOptions { /** The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface MemberContext { /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MemberContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class MemberContextImpl implements MemberContext { protected _version: V1; protected _solution: MemberContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; update(params?: MemberContextUpdateOptions | ((error: Error | null, item?: MemberInstance) => any), callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MemberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MemberPayload extends TwilioResponsePayload { members: MemberResource[]; } interface MemberResource { sid: string; account_sid: string; channel_sid: string; service_sid: string; identity: string; date_created: Date; date_updated: Date; role_sid: string; last_consumed_message_index: number; last_consumption_timestamp: Date; url: string; } export declare class MemberInstance { protected _version: V1; protected _solution: MemberContextSolution; protected _context?: MemberContext; constructor(_version: V1, payload: MemberResource, serviceSid: string, channelSid: string, sid?: string); /** * The unique string that we created to identify the Member resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Member resource. */ accountSid: string; /** * The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) for the member. */ channelSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. */ serviceSid: string; /** * The application-defined string that uniquely identifies the resource\'s [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. */ identity: string; /** * The date and time in GMT when the resource was created specified in [RFC 2822](http://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](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the member. */ roleSid: string; /** * The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. */ lastConsumedMessageIndex: number; /** * The ISO 8601 timestamp string that represents the date-time of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) read event for the Member within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels). */ lastConsumptionTimestamp: Date; /** * The absolute URL of the Member resource. */ url: string; private get _proxy(); /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; lastConsumedMessageIndex: number; lastConsumptionTimestamp: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MemberSolution { serviceSid: string; channelSid: string; } export interface MemberListInstance { _version: V1; _solution: MemberSolution; _uri: string; (sid: string): MemberContext; get(sid: string): MemberContext; /** * Create a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ create(params: MemberListInstanceCreateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Streams MemberInstance 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 { MemberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; each(params: MemberListInstanceEachOptions, callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MemberInstance 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: MemberPage) => any): Promise<MemberPage>; /** * Lists MemberInstance 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 { MemberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; list(params: MemberListInstanceOptions, callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; /** * Retrieve a single page of MemberInstance 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 { MemberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; page(params: MemberListInstancePageOptions, callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MemberListInstance(version: V1, serviceSid: string, channelSid: string): MemberListInstance; export declare class MemberPage extends Page<V1, MemberPayload, MemberResource, MemberInstance> { /** * Initialize the MemberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: MemberSolution); /** * Build an instance of MemberInstance * * @param payload - Payload response from the API */ getInstance(payload: MemberResource): MemberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v1/service/channel/message.js000064400000025375151677225100014042 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.MessagePage = exports.MessageListInstance = exports.MessageInstance = exports.MessageContextImpl = void 0; 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 MessageContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Messages/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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["body"] !== undefined) data["Body"] = params["body"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.MessageContextImpl = MessageContextImpl; class MessageInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.attributes = payload.attributes; this.serviceSid = payload.service_sid; this.to = payload.to; this.channelSid = payload.channel_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.wasEdited = payload.was_edited; this.from = payload.from; this.body = payload.body; this.index = deserialize.integer(payload.index); this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MessageContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, attributes: this.attributes, serviceSid: this.serviceSid, to: this.to, channelSid: this.channelSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, wasEdited: this.wasEdited, from: this.from, body: this.body, index: this.index, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessageInstance = MessageInstance; function MessageListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MessageContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Messages`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["body"] === null || params["body"] === undefined) { throw new Error("Required parameter \"params['body']\" missing."); } let data = {}; data["Body"] = params["body"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["order"] !== undefined) data["Order"] = params["order"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MessagePage(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 MessagePage(instance._version, payload, 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; } exports.MessageListInstance = MessageListInstance; class MessagePage extends Page_1.default { /** * Initialize the MessagePage * * @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 MessageInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MessageInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessagePage = MessagePage; rest/chat/v1/service/channel/invite.js000064400000022541151677225100013704 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.InvitePage = exports.InviteListInstance = exports.InviteInstance = exports.InviteContextImpl = void 0; 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 InviteContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Invites/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InviteInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.InviteContextImpl = InviteContextImpl; class InviteInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.channelSid = payload.channel_sid; this.serviceSid = payload.service_sid; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.roleSid = payload.role_sid; this.createdBy = payload.created_by; this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InviteContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, channelSid: this.channelSid, serviceSid: this.serviceSid, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, roleSid: this.roleSid, createdBy: this.createdBy, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InviteInstance = InviteInstance; function InviteListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InviteContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Invites`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InviteInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InvitePage(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 InvitePage(instance._version, payload, 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; } exports.InviteListInstance = InviteListInstance; class InvitePage extends Page_1.default { /** * Initialize the InvitePage * * @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 InviteInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InviteInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InvitePage = InvitePage; rest/chat/v1/service/channel/message.d.ts000064400000032621151677225100014266 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type MessageOrderType = "asc" | "desc"; /** * Options to pass to update a MessageInstance */ export interface MessageContextUpdateOptions { /** The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. */ body?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; } /** * Options to pass to create a MessageInstance */ export interface MessageListInstanceCreateOptions { /** The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. */ body: string; /** The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the new message\\\'s author. The default value is `system`. */ from?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; } /** * Options to pass to each */ export interface MessageListInstanceEachOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. */ order?: MessageOrderType; /** 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: MessageInstance, 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 MessageListInstanceOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. */ order?: MessageOrderType; /** 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 MessageListInstancePageOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. */ order?: MessageOrderType; /** 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 MessageContext { /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MessageContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class MessageContextImpl implements MessageContext { protected _version: V1; protected _solution: MessageContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; update(params?: MessageContextUpdateOptions | ((error: Error | null, item?: MessageInstance) => any), callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MessageContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MessagePayload extends TwilioResponsePayload { messages: MessageResource[]; } interface MessageResource { sid: string; account_sid: string; attributes: string; service_sid: string; to: string; channel_sid: string; date_created: Date; date_updated: Date; was_edited: boolean; from: string; body: string; index: number; url: string; } export declare class MessageInstance { protected _version: V1; protected _solution: MessageContextSolution; protected _context?: MessageContext; constructor(_version: V1, payload: MessageResource, serviceSid: string, channelSid: string, sid?: string); /** * The unique string that we created to identify the Message resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Message resource. */ accountSid: string; /** * The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it\'s only displayed in a FETCH action that returns a single resource; otherwise, it\'s null. If the attributes have not been set, `{}` is returned. */ attributes: string; /** * The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. */ serviceSid: string; /** * The SID of the [Channel](https://www.twilio.com/docs/chat/api/channels) that the message was sent to. */ to: string; /** * The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the Message resource belongs to. */ channelSid: string; /** * The date and time in GMT when the resource was created specified in [RFC 2822](http://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](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * Whether the message has been edited since it was created. */ wasEdited: boolean; /** * The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the message\'s author. The default value is `system`. */ from: string; /** * The content of the message. */ body: string; /** * The index of the message within the [Channel](https://www.twilio.com/docs/chat/api/channels). */ index: number; /** * The absolute URL of the Message resource. */ url: string; private get _proxy(); /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; attributes: string; serviceSid: string; to: string; channelSid: string; dateCreated: Date; dateUpdated: Date; wasEdited: boolean; from: string; body: string; index: number; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MessageSolution { serviceSid: string; channelSid: string; } export interface MessageListInstance { _version: V1; _solution: MessageSolution; _uri: string; (sid: string): MessageContext; get(sid: string): MessageContext; /** * Create a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(params: MessageListInstanceCreateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Streams MessageInstance 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 { MessageListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; each(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MessageInstance 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: MessagePage) => any): Promise<MessagePage>; /** * Lists MessageInstance 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 { MessageListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; list(params: MessageListInstanceOptions, callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; /** * Retrieve a single page of MessageInstance 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 { MessageListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; page(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessageListInstance(version: V1, serviceSid: string, channelSid: string): MessageListInstance; export declare class MessagePage extends Page<V1, MessagePayload, MessageResource, MessageInstance> { /** * Initialize the MessagePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: MessageSolution); /** * Build an instance of MessageInstance * * @param payload - Payload response from the API */ getInstance(payload: MessageResource): MessageInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v1/service/channel/member.js000064400000025441151677225100013657 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.MemberPage = exports.MemberListInstance = exports.MemberInstance = exports.MemberContextImpl = void 0; 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 MemberContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Members/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["lastConsumedMessageIndex"] !== undefined) data["LastConsumedMessageIndex"] = params["lastConsumedMessageIndex"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.MemberContextImpl = MemberContextImpl; class MemberInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.channelSid = payload.channel_sid; this.serviceSid = payload.service_sid; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.roleSid = payload.role_sid; this.lastConsumedMessageIndex = deserialize.integer(payload.last_consumed_message_index); this.lastConsumptionTimestamp = deserialize.iso8601DateTime(payload.last_consumption_timestamp); this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MemberContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, channelSid: this.channelSid, serviceSid: this.serviceSid, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, roleSid: this.roleSid, lastConsumedMessageIndex: this.lastConsumedMessageIndex, lastConsumptionTimestamp: this.lastConsumptionTimestamp, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberInstance = MemberInstance; function MemberListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MemberContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Members`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MemberPage(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 MemberPage(instance._version, payload, 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; } exports.MemberListInstance = MemberListInstance; class MemberPage extends Page_1.default { /** * Initialize the MemberPage * * @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 MemberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MemberInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberPage = MemberPage; rest/chat/v1/service/channel/invite.d.ts000064400000026306151677225100014143 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to create a InviteInstance */ export interface InviteListInstanceCreateOptions { /** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/v1/service). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. */ identity: string; /** The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the new member. */ roleSid?: string; } /** * Options to pass to each */ export interface InviteListInstanceEachOptions { /** The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InviteInstance, 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 InviteListInstanceOptions { /** The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InviteListInstancePageOptions { /** The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)\'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InviteContext { /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InviteContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class InviteContextImpl implements InviteContext { protected _version: V1; protected _solution: InviteContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InviteContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InvitePayload extends TwilioResponsePayload { invites: InviteResource[]; } interface InviteResource { sid: string; account_sid: string; channel_sid: string; service_sid: string; identity: string; date_created: Date; date_updated: Date; role_sid: string; created_by: string; url: string; } export declare class InviteInstance { protected _version: V1; protected _solution: InviteContextSolution; protected _context?: InviteContext; constructor(_version: V1, payload: InviteResource, serviceSid: string, channelSid: string, sid?: string); /** * The unique string that we created to identify the Invite resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Invite resource. */ accountSid: string; /** * The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. */ channelSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. */ serviceSid: string; /** * The application-defined string that uniquely identifies the resource\'s [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. */ identity: string; /** * The date and time in GMT when the resource was created specified in [RFC 2822](http://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](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the resource. */ roleSid: string; /** * The `identity` of the User that created the invite. */ createdBy: string; /** * The absolute URL of the Invite resource. */ url: string; private get _proxy(); /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; createdBy: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InviteSolution { serviceSid: string; channelSid: string; } export interface InviteListInstance { _version: V1; _solution: InviteSolution; _uri: string; (sid: string): InviteContext; get(sid: string): InviteContext; /** * Create a InviteInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ create(params: InviteListInstanceCreateOptions, callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Streams InviteInstance 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 { InviteListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InviteInstance, done: (err?: Error) => void) => void): void; each(params: InviteListInstanceEachOptions, callback?: (item: InviteInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InviteInstance 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: InvitePage) => any): Promise<InvitePage>; /** * Lists InviteInstance 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 { InviteListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InviteInstance[]) => any): Promise<InviteInstance[]>; list(params: InviteListInstanceOptions, callback?: (error: Error | null, items: InviteInstance[]) => any): Promise<InviteInstance[]>; /** * Retrieve a single page of InviteInstance 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 { InviteListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InvitePage) => any): Promise<InvitePage>; page(params: InviteListInstancePageOptions, callback?: (error: Error | null, items: InvitePage) => any): Promise<InvitePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InviteListInstance(version: V1, serviceSid: string, channelSid: string): InviteListInstance; export declare class InvitePage extends Page<V1, InvitePayload, InviteResource, InviteInstance> { /** * Initialize the InvitePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InviteSolution); /** * Build an instance of InviteInstance * * @param payload - Payload response from the API */ getInstance(payload: InviteResource): InviteInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v1/service/user.js000064400000025610151677225100011754 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.UserPage = exports.UserListInstance = exports.UserInstance = exports.UserContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const userChannel_1 = require("./user/userChannel"); class UserContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Users/${sid}`; } get userChannels() { this._userChannels = this._userChannels || (0, userChannel_1.UserChannelListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._userChannels; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid, 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["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid, 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.UserContextImpl = UserContextImpl; class UserInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.attributes = payload.attributes; this.friendlyName = payload.friendly_name; this.roleSid = payload.role_sid; this.identity = payload.identity; this.isOnline = payload.is_online; this.isNotifiable = payload.is_notifiable; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.joinedChannelsCount = deserialize.integer(payload.joined_channels_count); this.links = payload.links; this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the userChannels. */ userChannels() { return this._proxy.userChannels; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, attributes: this.attributes, friendlyName: this.friendlyName, roleSid: this.roleSid, identity: this.identity, isOnline: this.isOnline, isNotifiable: this.isNotifiable, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, joinedChannelsCount: this.joinedChannelsCount, links: this.links, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserInstance = UserInstance; function UserListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Users`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserPage(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 UserPage(instance._version, payload, 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; } exports.UserListInstance = UserListInstance; class UserPage extends Page_1.default { /** * Initialize the UserPage * * @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 UserInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserPage = UserPage; rest/chat/v1/service/role.d.ts000064400000026036151677225100012176 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type RoleRoleType = "channel" | "deployment"; /** * Options to pass to update a RoleInstance */ export interface RoleContextUpdateOptions { /** A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role\\\'s `type` and are described in the documentation. */ permission: Array<string>; } /** * Options to pass to create a RoleInstance */ export interface RoleListInstanceCreateOptions { /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName: string; /** */ type: RoleRoleType; /** A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role\\\'s `type` and are described in the documentation. */ permission: Array<string>; } /** * Options to pass to each */ export interface RoleListInstanceEachOptions { /** 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: RoleInstance, 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 RoleListInstanceOptions { /** 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 RoleListInstancePageOptions { /** 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 RoleContext { /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RoleContextSolution { serviceSid: string; sid: string; } export declare class RoleContextImpl implements RoleContext { protected _version: V1; protected _solution: RoleContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RoleContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RolePayload extends TwilioResponsePayload { roles: RoleResource[]; } interface RoleResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; type: RoleRoleType; permissions: Array<string>; date_created: Date; date_updated: Date; url: string; } export declare class RoleInstance { protected _version: V1; protected _solution: RoleContextSolution; protected _context?: RoleContext; constructor(_version: V1, payload: RoleResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Role resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Role resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. */ serviceSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; type: RoleRoleType; /** * An array of the permissions the role has been granted, formatted as a JSON string. */ permissions: Array<string>; /** * The date and time in GMT when the resource was created specified in [RFC 2822](http://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](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The absolute URL of the Role resource. */ url: string; private get _proxy(); /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; type: RoleRoleType; permissions: string[]; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RoleSolution { serviceSid: string; } export interface RoleListInstance { _version: V1; _solution: RoleSolution; _uri: string; (sid: string): RoleContext; get(sid: string): RoleContext; /** * Create a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ create(params: RoleListInstanceCreateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Streams RoleInstance 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 { RoleListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; each(params: RoleListInstanceEachOptions, callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RoleInstance 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: RolePage) => any): Promise<RolePage>; /** * Lists RoleInstance 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 { RoleListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; list(params: RoleListInstanceOptions, callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; /** * Retrieve a single page of RoleInstance 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 { RoleListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; page(params: RoleListInstancePageOptions, callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RoleListInstance(version: V1, serviceSid: string): RoleListInstance; export declare class RolePage extends Page<V1, RolePayload, RoleResource, RoleInstance> { /** * Initialize the RolePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RoleSolution); /** * Build an instance of RoleInstance * * @param payload - Payload response from the API */ getInstance(payload: RoleResource): RoleInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v1/service/user.d.ts000064400000034436151677225100012216 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { UserChannelListInstance } from "./user/userChannel"; /** * Options to pass to update a UserInstance */ export interface UserContextUpdateOptions { /** The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to this user. */ roleSid?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; /** A descriptive string that you create to describe the resource. It is often used for display purposes. */ friendlyName?: string; } /** * Options to pass to create a UserInstance */ export interface UserListInstanceCreateOptions { /** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/v1/service). This value is often a username or email address. See the Identity documentation for more details. */ identity: string; /** The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the new User. */ roleSid?: string; /** A valid JSON string that contains application-specific data. */ attributes?: string; /** A descriptive string that you create to describe the new resource. This value is often used for display purposes. */ friendlyName?: string; } /** * Options to pass to each */ export interface UserListInstanceEachOptions { /** 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: UserInstance, 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 UserListInstanceOptions { /** 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 UserListInstancePageOptions { /** 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 UserContext { userChannels: UserChannelListInstance; /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserContextSolution { serviceSid: string; sid: string; } export declare class UserContextImpl implements UserContext { protected _version: V1; protected _solution: UserContextSolution; protected _uri: string; protected _userChannels?: UserChannelListInstance; constructor(_version: V1, serviceSid: string, sid: string); get userChannels(): UserChannelListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; update(params?: UserContextUpdateOptions | ((error: Error | null, item?: UserInstance) => any), callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserPayload extends TwilioResponsePayload { users: UserResource[]; } interface UserResource { sid: string; account_sid: string; service_sid: string; attributes: string; friendly_name: string; role_sid: string; identity: string; is_online: boolean; is_notifiable: boolean; date_created: Date; date_updated: Date; joined_channels_count: number; links: Record<string, string>; url: string; } export declare class UserInstance { protected _version: V1; protected _solution: UserContextSolution; protected _context?: UserContext; constructor(_version: V1, payload: UserResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the User resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. */ serviceSid: string; /** * The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it\'s only displayed in a FETCH action that returns a single resource; otherwise, it\'s null. If the attributes have not been set, `{}` is returned. */ attributes: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the user. */ roleSid: string; /** * The application-defined string that uniquely identifies the resource\'s User within the [Service](https://www.twilio.com/docs/api/chat/rest/services). This value is often a username or an email address. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. */ identity: string; /** * Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service\'s `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service\'s `reachability_enabled` is `true`. */ isOnline: boolean; /** * Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service\'s `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service\'s `reachability_enabled` is `true`. */ isNotifiable: boolean; /** * The date and time in GMT when the resource was created specified in [RFC 2822](http://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](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The number of Channels this User is a Member of. */ joinedChannelsCount: number; /** * The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/api/channels) and [Binding](https://www.twilio.com/docs/chat/rest/bindings-resource) resources related to the user. */ links: Record<string, string>; /** * The absolute URL of the User resource. */ url: string; private get _proxy(); /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Access the userChannels. */ userChannels(): UserChannelListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; attributes: string; friendlyName: string; roleSid: string; identity: string; isOnline: boolean; isNotifiable: boolean; dateCreated: Date; dateUpdated: Date; joinedChannelsCount: number; links: Record<string, string>; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserSolution { serviceSid: string; } export interface UserListInstance { _version: V1; _solution: UserSolution; _uri: string; (sid: string): UserContext; get(sid: string): UserContext; /** * Create a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ create(params: UserListInstanceCreateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Streams UserInstance 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 { UserListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; each(params: UserListInstanceEachOptions, callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserInstance 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: UserPage) => any): Promise<UserPage>; /** * Lists UserInstance 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 { UserListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; list(params: UserListInstanceOptions, callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; /** * Retrieve a single page of UserInstance 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 { UserListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; page(params: UserListInstancePageOptions, callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserListInstance(version: V1, serviceSid: string): UserListInstance; export declare class UserPage extends Page<V1, UserPayload, UserResource, UserInstance> { /** * Initialize the UserPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UserSolution); /** * Build an instance of UserInstance * * @param payload - Payload response from the API */ getInstance(payload: UserResource): UserInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/chat/v1/service/channel.js000064400000027264151677225100012415 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.ChannelPage = exports.ChannelListInstance = exports.ChannelInstance = exports.ChannelContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const invite_1 = require("./channel/invite"); const member_1 = require("./channel/member"); const message_1 = require("./channel/message"); class ChannelContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${sid}`; } get invites() { this._invites = this._invites || (0, invite_1.InviteListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._invites; } get members() { this._members = this._members || (0, member_1.MemberListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._members; } get messages() { this._messages = this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._messages; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid, 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.ChannelContextImpl = ChannelContextImpl; class ChannelInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.attributes = payload.attributes; this.type = payload.type; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this.membersCount = deserialize.integer(payload.members_count); this.messagesCount = deserialize.integer(payload.messages_count); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ChannelContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the invites. */ invites() { return this._proxy.invites; } /** * Access the members. */ members() { return this._proxy.members; } /** * Access the messages. */ messages() { return this._proxy.messages; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, uniqueName: this.uniqueName, attributes: this.attributes, type: this.type, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, membersCount: this.membersCount, messagesCount: this.messagesCount, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelInstance = ChannelInstance; function ChannelListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ChannelContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Channels`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["type"] !== undefined) data["Type"] = params["type"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid)); 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["type"] !== undefined) data["Type"] = serialize.map(params["type"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelPage(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 ChannelPage(instance._version, payload, 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; } exports.ChannelListInstance = ChannelListInstance; class ChannelPage extends Page_1.default { /** * Initialize the ChannelPage * * @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 ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ChannelInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelPage = ChannelPage; rest/chat/v1/service/role.js000064400000024144151677225100011740 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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.RolePage = exports.RoleListInstance = exports.RoleInstance = exports.RoleContextImpl = void 0; 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 RoleContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Roles/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid, 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.RoleContextImpl = RoleContextImpl; class RoleInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.permissions = payload.permissions; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RoleContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, type: this.type, permissions: this.permissions, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoleInstance = RoleInstance; function RoleListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RoleContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Roles`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RolePage(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 RolePage(instance._version, payload, 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; } exports.RoleListInstance = RoleListInstance; class RolePage extends Page_1.default { /** * Initialize the RolePage * * @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 RoleInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RoleInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RolePage = RolePage; rest/chat/V1.js000064400000002725151677225100007300 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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 credential_1 = require("./v1/credential"); const service_1 = require("./v1/service"); class V1 extends Version_1.default { /** * Initialize the V1 version of Chat * * @param domain - The Twilio (Twilio.Chat) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for credentials resource */ get credentials() { this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this); return this._credentials; } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } } exports.default = V1; rest/chat/V3.js000064400000002330151677225100007272 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Chat * 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 channel_1 = require("./v3/channel"); class V3 extends Version_1.default { /** * Initialize the V3 version of Chat * * @param domain - The Twilio (Twilio.Chat) domain */ constructor(domain) { super(domain, "v3"); } /** Getter for channels resource */ get channels() { this._channels = this._channels || (0, channel_1.ChannelListInstance)(this); return this._channels; } } exports.default = V3; rest/voice/V1.d.ts000064400000004077151677225100007724 0ustar00import VoiceBase from "../VoiceBase"; import Version from "../../base/Version"; import { ArchivedCallListInstance } from "./v1/archivedCall"; import { ByocTrunkListInstance } from "./v1/byocTrunk"; import { ConnectionPolicyListInstance } from "./v1/connectionPolicy"; import { DialingPermissionsListInstance } from "./v1/dialingPermissions"; import { IpRecordListInstance } from "./v1/ipRecord"; import { SourceIpMappingListInstance } from "./v1/sourceIpMapping"; export default class V1 extends Version { /** * Initialize the V1 version of Voice * * @param domain - The Twilio (Twilio.Voice) domain */ constructor(domain: VoiceBase); /** archivedCalls - { Twilio.Voice.V1.ArchivedCallListInstance } resource */ protected _archivedCalls?: ArchivedCallListInstance; /** byocTrunks - { Twilio.Voice.V1.ByocTrunkListInstance } resource */ protected _byocTrunks?: ByocTrunkListInstance; /** connectionPolicies - { Twilio.Voice.V1.ConnectionPolicyListInstance } resource */ protected _connectionPolicies?: ConnectionPolicyListInstance; /** dialingPermissions - { Twilio.Voice.V1.DialingPermissionsListInstance } resource */ protected _dialingPermissions?: DialingPermissionsListInstance; /** ipRecords - { Twilio.Voice.V1.IpRecordListInstance } resource */ protected _ipRecords?: IpRecordListInstance; /** sourceIpMappings - { Twilio.Voice.V1.SourceIpMappingListInstance } resource */ protected _sourceIpMappings?: SourceIpMappingListInstance; /** Getter for archivedCalls resource */ get archivedCalls(): ArchivedCallListInstance; /** Getter for byocTrunks resource */ get byocTrunks(): ByocTrunkListInstance; /** Getter for connectionPolicies resource */ get connectionPolicies(): ConnectionPolicyListInstance; /** Getter for dialingPermissions resource */ get dialingPermissions(): DialingPermissionsListInstance; /** Getter for ipRecords resource */ get ipRecords(): IpRecordListInstance; /** Getter for sourceIpMappings resource */ get sourceIpMappings(): SourceIpMappingListInstance; } rest/voice/v1/archivedCall.js000064400000005047151677225100012107 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.ArchivedCallListInstance = exports.ArchivedCallContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class ArchivedCallContextImpl { constructor(_version, date, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(date)) { throw new Error("Parameter 'date' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { date, sid }; this._uri = `/Archives/${date}/Calls/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); 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.ArchivedCallContextImpl = ArchivedCallContextImpl; function ArchivedCallListInstance(version) { const instance = ((date, sid) => instance.get(date, sid)); instance.get = function get(date, sid) { return new ArchivedCallContextImpl(version, date, sid); }; 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; } exports.ArchivedCallListInstance = ArchivedCallListInstance; rest/voice/v1/ipRecord.d.ts000064400000027203151677225100011527 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to update a IpRecordInstance */ export interface IpRecordContextUpdateOptions { /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ friendlyName?: string; } /** * Options to pass to create a IpRecordInstance */ export interface IpRecordListInstanceCreateOptions { /** An IP address in dotted decimal notation, IPv4 only. */ ipAddress: string; /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ friendlyName?: string; /** An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. */ cidrPrefixLength?: number; } /** * Options to pass to each */ export interface IpRecordListInstanceEachOptions { /** 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: IpRecordInstance, 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 IpRecordListInstanceOptions { /** 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 IpRecordListInstancePageOptions { /** 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 IpRecordContext { /** * Remove a IpRecordInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpRecordInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpRecordInstance */ fetch(callback?: (error: Error | null, item?: IpRecordInstance) => any): Promise<IpRecordInstance>; /** * Update a IpRecordInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpRecordInstance */ update(callback?: (error: Error | null, item?: IpRecordInstance) => any): Promise<IpRecordInstance>; /** * Update a IpRecordInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpRecordInstance */ update(params: IpRecordContextUpdateOptions, callback?: (error: Error | null, item?: IpRecordInstance) => any): Promise<IpRecordInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface IpRecordContextSolution { sid: string; } export declare class IpRecordContextImpl implements IpRecordContext { protected _version: V1; protected _solution: IpRecordContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: IpRecordInstance) => any): Promise<IpRecordInstance>; update(params?: IpRecordContextUpdateOptions | ((error: Error | null, item?: IpRecordInstance) => any), callback?: (error: Error | null, item?: IpRecordInstance) => any): Promise<IpRecordInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): IpRecordContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface IpRecordPayload extends TwilioResponsePayload { ip_records: IpRecordResource[]; } interface IpRecordResource { account_sid: string; sid: string; friendly_name: string; ip_address: string; cidr_prefix_length: number; date_created: Date; date_updated: Date; url: string; } export declare class IpRecordInstance { protected _version: V1; protected _solution: IpRecordContextSolution; protected _context?: IpRecordContext; constructor(_version: V1, payload: IpRecordResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Record resource. */ accountSid: string; /** * The unique string that we created to identify the IP Record resource. */ sid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * An IP address in dotted decimal notation, IPv4 only. */ ipAddress: string; /** * An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. */ cidrPrefixLength: number; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a IpRecordInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpRecordInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpRecordInstance */ fetch(callback?: (error: Error | null, item?: IpRecordInstance) => any): Promise<IpRecordInstance>; /** * Update a IpRecordInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpRecordInstance */ update(callback?: (error: Error | null, item?: IpRecordInstance) => any): Promise<IpRecordInstance>; /** * Update a IpRecordInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpRecordInstance */ update(params: IpRecordContextUpdateOptions, callback?: (error: Error | null, item?: IpRecordInstance) => any): Promise<IpRecordInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; friendlyName: string; ipAddress: string; cidrPrefixLength: number; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface IpRecordSolution { } export interface IpRecordListInstance { _version: V1; _solution: IpRecordSolution; _uri: string; (sid: string): IpRecordContext; get(sid: string): IpRecordContext; /** * Create a IpRecordInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpRecordInstance */ create(params: IpRecordListInstanceCreateOptions, callback?: (error: Error | null, item?: IpRecordInstance) => any): Promise<IpRecordInstance>; /** * Streams IpRecordInstance 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 { IpRecordListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: IpRecordInstance, done: (err?: Error) => void) => void): void; each(params: IpRecordListInstanceEachOptions, callback?: (item: IpRecordInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of IpRecordInstance 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: IpRecordPage) => any): Promise<IpRecordPage>; /** * Lists IpRecordInstance 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 { IpRecordListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: IpRecordInstance[]) => any): Promise<IpRecordInstance[]>; list(params: IpRecordListInstanceOptions, callback?: (error: Error | null, items: IpRecordInstance[]) => any): Promise<IpRecordInstance[]>; /** * Retrieve a single page of IpRecordInstance 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 { IpRecordListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: IpRecordPage) => any): Promise<IpRecordPage>; page(params: IpRecordListInstancePageOptions, callback?: (error: Error | null, items: IpRecordPage) => any): Promise<IpRecordPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function IpRecordListInstance(version: V1): IpRecordListInstance; export declare class IpRecordPage extends Page<V1, IpRecordPayload, IpRecordResource, IpRecordInstance> { /** * Initialize the IpRecordPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: IpRecordSolution); /** * Build an instance of IpRecordInstance * * @param payload - Payload response from the API */ getInstance(payload: IpRecordResource): IpRecordInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/voice/v1/byocTrunk.d.ts000064400000041555151677225100011746 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to update a ByocTrunkInstance */ export interface ByocTrunkContextUpdateOptions { /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ friendlyName?: string; /** The URL we should call when the BYOC Trunk receives a call. */ voiceUrl?: string; /** The HTTP method we should use to call `voice_url` */ voiceMethod?: string; /** The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`. */ voiceFallbackUrl?: string; /** The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod?: string; /** The URL that we should call to pass status parameters (such as call ended) to your application. */ statusCallbackUrl?: string; /** The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`. */ statusCallbackMethod?: string; /** Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. */ cnamLookupEnabled?: boolean; /** The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. */ connectionPolicySid?: string; /** The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \\\"call back\\\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \\\"sip.twilio.com\\\". */ fromDomainSid?: string; } /** * Options to pass to create a ByocTrunkInstance */ export interface ByocTrunkListInstanceCreateOptions { /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ friendlyName?: string; /** The URL we should call when the BYOC Trunk receives a call. */ voiceUrl?: string; /** The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod?: string; /** The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`. */ voiceFallbackUrl?: string; /** The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod?: string; /** The URL that we should call to pass status parameters (such as call ended) to your application. */ statusCallbackUrl?: string; /** The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`. */ statusCallbackMethod?: string; /** Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. */ cnamLookupEnabled?: boolean; /** The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. */ connectionPolicySid?: string; /** The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \\\"call back\\\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \\\"sip.twilio.com\\\". */ fromDomainSid?: string; } /** * Options to pass to each */ export interface ByocTrunkListInstanceEachOptions { /** 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: ByocTrunkInstance, 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 ByocTrunkListInstanceOptions { /** 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 ByocTrunkListInstancePageOptions { /** 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 ByocTrunkContext { /** * Remove a ByocTrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ByocTrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ByocTrunkInstance */ fetch(callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; /** * Update a ByocTrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ByocTrunkInstance */ update(callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; /** * Update a ByocTrunkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ByocTrunkInstance */ update(params: ByocTrunkContextUpdateOptions, callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ByocTrunkContextSolution { sid: string; } export declare class ByocTrunkContextImpl implements ByocTrunkContext { protected _version: V1; protected _solution: ByocTrunkContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; update(params?: ByocTrunkContextUpdateOptions | ((error: Error | null, item?: ByocTrunkInstance) => any), callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ByocTrunkContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ByocTrunkPayload extends TwilioResponsePayload { byoc_trunks: ByocTrunkResource[]; } interface ByocTrunkResource { account_sid: string; sid: string; friendly_name: string; voice_url: string; voice_method: string; voice_fallback_url: string; voice_fallback_method: string; status_callback_url: string; status_callback_method: string; cnam_lookup_enabled: boolean; connection_policy_sid: string; from_domain_sid: string; date_created: Date; date_updated: Date; url: string; } export declare class ByocTrunkInstance { protected _version: V1; protected _solution: ByocTrunkContextSolution; protected _context?: ByocTrunkContext; constructor(_version: V1, payload: ByocTrunkResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the BYOC Trunk resource. */ accountSid: string; /** * The unique string that that we created to identify the BYOC Trunk resource. */ sid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The URL we call using the `voice_method` when the BYOC Trunk receives a call. */ voiceUrl: string; /** * The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod: string; /** * The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. */ voiceFallbackUrl: string; /** * The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod: string; /** * The URL that we call to pass status parameters (such as call ended) to your application. */ statusCallbackUrl: string; /** * The HTTP method we use to call `status_callback_url`. Either `GET` or `POST`. */ statusCallbackMethod: string; /** * Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. */ cnamLookupEnabled: boolean; /** * The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. */ connectionPolicySid: string; /** * The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\". */ fromDomainSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a ByocTrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ByocTrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ByocTrunkInstance */ fetch(callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; /** * Update a ByocTrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ByocTrunkInstance */ update(callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; /** * Update a ByocTrunkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ByocTrunkInstance */ update(params: ByocTrunkContextUpdateOptions, callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; friendlyName: string; voiceUrl: string; voiceMethod: string; voiceFallbackUrl: string; voiceFallbackMethod: string; statusCallbackUrl: string; statusCallbackMethod: string; cnamLookupEnabled: boolean; connectionPolicySid: string; fromDomainSid: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ByocTrunkSolution { } export interface ByocTrunkListInstance { _version: V1; _solution: ByocTrunkSolution; _uri: string; (sid: string): ByocTrunkContext; get(sid: string): ByocTrunkContext; /** * Create a ByocTrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ByocTrunkInstance */ create(callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; /** * Create a ByocTrunkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ByocTrunkInstance */ create(params: ByocTrunkListInstanceCreateOptions, callback?: (error: Error | null, item?: ByocTrunkInstance) => any): Promise<ByocTrunkInstance>; /** * Streams ByocTrunkInstance 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 { ByocTrunkListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ByocTrunkInstance, done: (err?: Error) => void) => void): void; each(params: ByocTrunkListInstanceEachOptions, callback?: (item: ByocTrunkInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ByocTrunkInstance 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: ByocTrunkPage) => any): Promise<ByocTrunkPage>; /** * Lists ByocTrunkInstance 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 { ByocTrunkListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ByocTrunkInstance[]) => any): Promise<ByocTrunkInstance[]>; list(params: ByocTrunkListInstanceOptions, callback?: (error: Error | null, items: ByocTrunkInstance[]) => any): Promise<ByocTrunkInstance[]>; /** * Retrieve a single page of ByocTrunkInstance 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 { ByocTrunkListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ByocTrunkPage) => any): Promise<ByocTrunkPage>; page(params: ByocTrunkListInstancePageOptions, callback?: (error: Error | null, items: ByocTrunkPage) => any): Promise<ByocTrunkPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ByocTrunkListInstance(version: V1): ByocTrunkListInstance; export declare class ByocTrunkPage extends Page<V1, ByocTrunkPayload, ByocTrunkResource, ByocTrunkInstance> { /** * Initialize the ByocTrunkPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ByocTrunkSolution); /** * Build an instance of ByocTrunkInstance * * @param payload - Payload response from the API */ getInstance(payload: ByocTrunkResource): ByocTrunkInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/voice/v1/sourceIpMapping.js000064400000022705151677225100012633 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.SourceIpMappingPage = exports.SourceIpMappingListInstance = exports.SourceIpMappingInstance = exports.SourceIpMappingContextImpl = void 0; 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 SourceIpMappingContextImpl { 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 = `/SourceIpMappings/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SourceIpMappingInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["sipDomainSid"] === null || params["sipDomainSid"] === undefined) { throw new Error("Required parameter \"params['sipDomainSid']\" missing."); } let data = {}; data["SipDomainSid"] = params["sipDomainSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SourceIpMappingInstance(operationVersion, payload, 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.SourceIpMappingContextImpl = SourceIpMappingContextImpl; class SourceIpMappingInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.ipRecordSid = payload.ip_record_sid; this.sipDomainSid = payload.sip_domain_sid; 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 SourceIpMappingContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a SourceIpMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SourceIpMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SourceIpMappingInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, ipRecordSid: this.ipRecordSid, sipDomainSid: this.sipDomainSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SourceIpMappingInstance = SourceIpMappingInstance; function SourceIpMappingListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SourceIpMappingContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/SourceIpMappings`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["ipRecordSid"] === null || params["ipRecordSid"] === undefined) { throw new Error("Required parameter \"params['ipRecordSid']\" missing."); } if (params["sipDomainSid"] === null || params["sipDomainSid"] === undefined) { throw new Error("Required parameter \"params['sipDomainSid']\" missing."); } let data = {}; data["IpRecordSid"] = params["ipRecordSid"]; data["SipDomainSid"] = params["sipDomainSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SourceIpMappingInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SourceIpMappingPage(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 SourceIpMappingPage(instance._version, payload, 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; } exports.SourceIpMappingListInstance = SourceIpMappingListInstance; class SourceIpMappingPage extends Page_1.default { /** * Initialize the SourceIpMappingPage * * @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 SourceIpMappingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SourceIpMappingInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SourceIpMappingPage = SourceIpMappingPage; rest/voice/v1/dialingPermissions.d.ts000064400000001767151677225100013632 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; import { BulkCountryUpdateListInstance } from "./dialingPermissions/bulkCountryUpdate"; import { CountryListInstance } from "./dialingPermissions/country"; import { SettingsListInstance } from "./dialingPermissions/settings"; export interface DialingPermissionsSolution { } export interface DialingPermissionsListInstance { _version: V1; _solution: DialingPermissionsSolution; _uri: string; _bulkCountryUpdates?: BulkCountryUpdateListInstance; bulkCountryUpdates: BulkCountryUpdateListInstance; _countries?: CountryListInstance; countries: CountryListInstance; _settings?: SettingsListInstance; settings: SettingsListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DialingPermissionsListInstance(version: V1): DialingPermissionsListInstance; rest/voice/v1/ipRecord.js000064400000022465151677225100011300 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.IpRecordPage = exports.IpRecordListInstance = exports.IpRecordInstance = exports.IpRecordContextImpl = void 0; 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 IpRecordContextImpl { 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 = `/IpRecords/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new IpRecordInstance(operationVersion, payload, 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"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IpRecordInstance(operationVersion, payload, 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.IpRecordContextImpl = IpRecordContextImpl; class IpRecordInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.ipAddress = payload.ip_address; this.cidrPrefixLength = deserialize.integer(payload.cidr_prefix_length); 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 IpRecordContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a IpRecordInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a IpRecordInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpRecordInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, friendlyName: this.friendlyName, ipAddress: this.ipAddress, cidrPrefixLength: this.cidrPrefixLength, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpRecordInstance = IpRecordInstance; function IpRecordListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new IpRecordContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/IpRecords`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["ipAddress"] === null || params["ipAddress"] === undefined) { throw new Error("Required parameter \"params['ipAddress']\" missing."); } let data = {}; data["IpAddress"] = params["ipAddress"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["cidrPrefixLength"] !== undefined) data["CidrPrefixLength"] = params["cidrPrefixLength"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IpRecordInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new IpRecordPage(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 IpRecordPage(instance._version, payload, 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; } exports.IpRecordListInstance = IpRecordListInstance; class IpRecordPage extends Page_1.default { /** * Initialize the IpRecordPage * * @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 IpRecordInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new IpRecordInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpRecordPage = IpRecordPage; rest/voice/v1/connectionPolicy/connectionPolicyTarget.d.ts000064400000035644151677225100017775 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to update a ConnectionPolicyTargetInstance */ export interface ConnectionPolicyTargetContextUpdateOptions { /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ friendlyName?: string; /** The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. */ target?: string; /** The relative importance of the target. Can be an integer from 0 to 65535, inclusive. The lowest number represents the most important target. */ priority?: number; /** The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive. Targets with higher values receive more load than those with lower ones with the same priority. */ weight?: number; /** Whether the Target is enabled. */ enabled?: boolean; } /** * Options to pass to create a ConnectionPolicyTargetInstance */ export interface ConnectionPolicyTargetListInstanceCreateOptions { /** The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. */ target: string; /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ friendlyName?: string; /** The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target. */ priority?: number; /** The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority. */ weight?: number; /** Whether the Target is enabled. The default is `true`. */ enabled?: boolean; } /** * Options to pass to each */ export interface ConnectionPolicyTargetListInstanceEachOptions { /** 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: ConnectionPolicyTargetInstance, 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 ConnectionPolicyTargetListInstanceOptions { /** 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 ConnectionPolicyTargetListInstancePageOptions { /** 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 ConnectionPolicyTargetContext { /** * Remove a ConnectionPolicyTargetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConnectionPolicyTargetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyTargetInstance */ fetch(callback?: (error: Error | null, item?: ConnectionPolicyTargetInstance) => any): Promise<ConnectionPolicyTargetInstance>; /** * Update a ConnectionPolicyTargetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyTargetInstance */ update(callback?: (error: Error | null, item?: ConnectionPolicyTargetInstance) => any): Promise<ConnectionPolicyTargetInstance>; /** * Update a ConnectionPolicyTargetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyTargetInstance */ update(params: ConnectionPolicyTargetContextUpdateOptions, callback?: (error: Error | null, item?: ConnectionPolicyTargetInstance) => any): Promise<ConnectionPolicyTargetInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConnectionPolicyTargetContextSolution { connectionPolicySid: string; sid: string; } export declare class ConnectionPolicyTargetContextImpl implements ConnectionPolicyTargetContext { protected _version: V1; protected _solution: ConnectionPolicyTargetContextSolution; protected _uri: string; constructor(_version: V1, connectionPolicySid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ConnectionPolicyTargetInstance) => any): Promise<ConnectionPolicyTargetInstance>; update(params?: ConnectionPolicyTargetContextUpdateOptions | ((error: Error | null, item?: ConnectionPolicyTargetInstance) => any), callback?: (error: Error | null, item?: ConnectionPolicyTargetInstance) => any): Promise<ConnectionPolicyTargetInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConnectionPolicyTargetContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConnectionPolicyTargetPayload extends TwilioResponsePayload { targets: ConnectionPolicyTargetResource[]; } interface ConnectionPolicyTargetResource { account_sid: string; connection_policy_sid: string; sid: string; friendly_name: string; target: string; priority: number; weight: number; enabled: boolean; date_created: Date; date_updated: Date; url: string; } export declare class ConnectionPolicyTargetInstance { protected _version: V1; protected _solution: ConnectionPolicyTargetContextSolution; protected _context?: ConnectionPolicyTargetContext; constructor(_version: V1, payload: ConnectionPolicyTargetResource, connectionPolicySid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Target resource. */ accountSid: string; /** * The SID of the Connection Policy that owns the Target. */ connectionPolicySid: string; /** * The unique string that we created to identify the Target resource. */ sid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. */ target: string; /** * The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target. */ priority: number; /** * The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority. */ weight: number; /** * Whether the target is enabled. The default is `true`. */ enabled: boolean; /** * 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 absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a ConnectionPolicyTargetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConnectionPolicyTargetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyTargetInstance */ fetch(callback?: (error: Error | null, item?: ConnectionPolicyTargetInstance) => any): Promise<ConnectionPolicyTargetInstance>; /** * Update a ConnectionPolicyTargetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyTargetInstance */ update(callback?: (error: Error | null, item?: ConnectionPolicyTargetInstance) => any): Promise<ConnectionPolicyTargetInstance>; /** * Update a ConnectionPolicyTargetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyTargetInstance */ update(params: ConnectionPolicyTargetContextUpdateOptions, callback?: (error: Error | null, item?: ConnectionPolicyTargetInstance) => any): Promise<ConnectionPolicyTargetInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; connectionPolicySid: string; sid: string; friendlyName: string; target: string; priority: number; weight: number; enabled: boolean; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConnectionPolicyTargetSolution { connectionPolicySid: string; } export interface ConnectionPolicyTargetListInstance { _version: V1; _solution: ConnectionPolicyTargetSolution; _uri: string; (sid: string): ConnectionPolicyTargetContext; get(sid: string): ConnectionPolicyTargetContext; /** * Create a ConnectionPolicyTargetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyTargetInstance */ create(params: ConnectionPolicyTargetListInstanceCreateOptions, callback?: (error: Error | null, item?: ConnectionPolicyTargetInstance) => any): Promise<ConnectionPolicyTargetInstance>; /** * Streams ConnectionPolicyTargetInstance 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 { ConnectionPolicyTargetListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ConnectionPolicyTargetInstance, done: (err?: Error) => void) => void): void; each(params: ConnectionPolicyTargetListInstanceEachOptions, callback?: (item: ConnectionPolicyTargetInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ConnectionPolicyTargetInstance 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: ConnectionPolicyTargetPage) => any): Promise<ConnectionPolicyTargetPage>; /** * Lists ConnectionPolicyTargetInstance 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 { ConnectionPolicyTargetListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ConnectionPolicyTargetInstance[]) => any): Promise<ConnectionPolicyTargetInstance[]>; list(params: ConnectionPolicyTargetListInstanceOptions, callback?: (error: Error | null, items: ConnectionPolicyTargetInstance[]) => any): Promise<ConnectionPolicyTargetInstance[]>; /** * Retrieve a single page of ConnectionPolicyTargetInstance 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 { ConnectionPolicyTargetListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ConnectionPolicyTargetPage) => any): Promise<ConnectionPolicyTargetPage>; page(params: ConnectionPolicyTargetListInstancePageOptions, callback?: (error: Error | null, items: ConnectionPolicyTargetPage) => any): Promise<ConnectionPolicyTargetPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConnectionPolicyTargetListInstance(version: V1, connectionPolicySid: string): ConnectionPolicyTargetListInstance; export declare class ConnectionPolicyTargetPage extends Page<V1, ConnectionPolicyTargetPayload, ConnectionPolicyTargetResource, ConnectionPolicyTargetInstance> { /** * Initialize the ConnectionPolicyTargetPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ConnectionPolicyTargetSolution); /** * Build an instance of ConnectionPolicyTargetInstance * * @param payload - Payload response from the API */ getInstance(payload: ConnectionPolicyTargetResource): ConnectionPolicyTargetInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/voice/v1/connectionPolicy/connectionPolicyTarget.js000064400000026304151677225100017532 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.ConnectionPolicyTargetPage = exports.ConnectionPolicyTargetListInstance = exports.ConnectionPolicyTargetInstance = exports.ConnectionPolicyTargetContextImpl = void 0; 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 ConnectionPolicyTargetContextImpl { constructor(_version, connectionPolicySid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(connectionPolicySid)) { throw new Error("Parameter 'connectionPolicySid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { connectionPolicySid, sid }; this._uri = `/ConnectionPolicies/${connectionPolicySid}/Targets/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ConnectionPolicyTargetInstance(operationVersion, payload, instance._solution.connectionPolicySid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["target"] !== undefined) data["Target"] = params["target"]; if (params["priority"] !== undefined) data["Priority"] = params["priority"]; if (params["weight"] !== undefined) data["Weight"] = params["weight"]; if (params["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConnectionPolicyTargetInstance(operationVersion, payload, instance._solution.connectionPolicySid, 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.ConnectionPolicyTargetContextImpl = ConnectionPolicyTargetContextImpl; class ConnectionPolicyTargetInstance { constructor(_version, payload, connectionPolicySid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.connectionPolicySid = payload.connection_policy_sid; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.target = payload.target; this.priority = deserialize.integer(payload.priority); this.weight = deserialize.integer(payload.weight); this.enabled = payload.enabled; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { connectionPolicySid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ConnectionPolicyTargetContextImpl(this._version, this._solution.connectionPolicySid, this._solution.sid); return this._context; } /** * Remove a ConnectionPolicyTargetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ConnectionPolicyTargetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyTargetInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, connectionPolicySid: this.connectionPolicySid, sid: this.sid, friendlyName: this.friendlyName, target: this.target, priority: this.priority, weight: this.weight, enabled: this.enabled, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConnectionPolicyTargetInstance = ConnectionPolicyTargetInstance; function ConnectionPolicyTargetListInstance(version, connectionPolicySid) { if (!(0, utility_1.isValidPathParam)(connectionPolicySid)) { throw new Error("Parameter 'connectionPolicySid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ConnectionPolicyTargetContextImpl(version, connectionPolicySid, sid); }; instance._version = version; instance._solution = { connectionPolicySid }; instance._uri = `/ConnectionPolicies/${connectionPolicySid}/Targets`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["target"] === null || params["target"] === undefined) { throw new Error("Required parameter \"params['target']\" missing."); } let data = {}; data["Target"] = params["target"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["priority"] !== undefined) data["Priority"] = params["priority"]; if (params["weight"] !== undefined) data["Weight"] = params["weight"]; if (params["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConnectionPolicyTargetInstance(operationVersion, payload, instance._solution.connectionPolicySid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConnectionPolicyTargetPage(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 ConnectionPolicyTargetPage(instance._version, payload, 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; } exports.ConnectionPolicyTargetListInstance = ConnectionPolicyTargetListInstance; class ConnectionPolicyTargetPage extends Page_1.default { /** * Initialize the ConnectionPolicyTargetPage * * @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 ConnectionPolicyTargetInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ConnectionPolicyTargetInstance(this._version, payload, this._solution.connectionPolicySid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConnectionPolicyTargetPage = ConnectionPolicyTargetPage; rest/voice/v1/archivedCall.d.ts000064400000003210151677225100012331 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export interface ArchivedCallContext { /** * Remove a ArchivedCallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ArchivedCallContextSolution { date: Date; sid: string; } export declare class ArchivedCallContextImpl implements ArchivedCallContext { protected _version: V1; protected _solution: ArchivedCallContextSolution; protected _uri: string; constructor(_version: V1, date: Date, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ArchivedCallContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ArchivedCallSolution { } export interface ArchivedCallListInstance { _version: V1; _solution: ArchivedCallSolution; _uri: string; (date: Date, sid: string): ArchivedCallContext; get(date: Date, sid: string): ArchivedCallContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ArchivedCallListInstance(version: V1): ArchivedCallListInstance; rest/voice/v1/dialingPermissions/country.d.ts000064400000031066151677225100015330 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { HighriskSpecialPrefixListInstance } from "./country/highriskSpecialPrefix"; /** * Options to pass to each */ export interface CountryListInstanceEachOptions { /** Filter to retrieve the country permissions by specifying the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) */ isoCode?: string; /** Filter to retrieve the country permissions by specifying the continent */ continent?: string; /** Filter the results by specified [country codes](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) */ countryCode?: string; /** Filter to retrieve the country permissions with dialing to low-risk numbers enabled. Can be: `true` or `false`. */ lowRiskNumbersEnabled?: boolean; /** Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled. Can be: `true` or `false` */ highRiskSpecialNumbersEnabled?: boolean; /** Filter to retrieve the country permissions with dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers enabled. Can be: `true` or `false`. */ highRiskTollfraudNumbersEnabled?: boolean; /** 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: CountryInstance, 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 CountryListInstanceOptions { /** Filter to retrieve the country permissions by specifying the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) */ isoCode?: string; /** Filter to retrieve the country permissions by specifying the continent */ continent?: string; /** Filter the results by specified [country codes](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) */ countryCode?: string; /** Filter to retrieve the country permissions with dialing to low-risk numbers enabled. Can be: `true` or `false`. */ lowRiskNumbersEnabled?: boolean; /** Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled. Can be: `true` or `false` */ highRiskSpecialNumbersEnabled?: boolean; /** Filter to retrieve the country permissions with dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers enabled. Can be: `true` or `false`. */ highRiskTollfraudNumbersEnabled?: boolean; /** 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 CountryListInstancePageOptions { /** Filter to retrieve the country permissions by specifying the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) */ isoCode?: string; /** Filter to retrieve the country permissions by specifying the continent */ continent?: string; /** Filter the results by specified [country codes](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) */ countryCode?: string; /** Filter to retrieve the country permissions with dialing to low-risk numbers enabled. Can be: `true` or `false`. */ lowRiskNumbersEnabled?: boolean; /** Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled. Can be: `true` or `false` */ highRiskSpecialNumbersEnabled?: boolean; /** Filter to retrieve the country permissions with dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers enabled. Can be: `true` or `false`. */ highRiskTollfraudNumbersEnabled?: boolean; /** 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 CountryContext { highriskSpecialPrefixes: HighriskSpecialPrefixListInstance; /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CountryContextSolution { isoCode: string; } export declare class CountryContextImpl implements CountryContext { protected _version: V1; protected _solution: CountryContextSolution; protected _uri: string; protected _highriskSpecialPrefixes?: HighriskSpecialPrefixListInstance; constructor(_version: V1, isoCode: string); get highriskSpecialPrefixes(): HighriskSpecialPrefixListInstance; fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CountryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CountryPayload extends TwilioResponsePayload { content: CountryResource[]; } interface CountryResource { iso_code: string; name: string; continent: string; country_codes: Array<string>; low_risk_numbers_enabled: boolean; high_risk_special_numbers_enabled: boolean; high_risk_tollfraud_numbers_enabled: boolean; url: string; links: Record<string, string>; } export declare class CountryInstance { protected _version: V1; protected _solution: CountryContextSolution; protected _context?: CountryContext; constructor(_version: V1, payload: CountryResource, isoCode?: string); /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). */ isoCode: string; /** * The name of the country. */ name: string; /** * The name of the continent in which the country is located. */ continent: string; /** * The E.164 assigned [country codes(s)](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) */ countryCodes: Array<string>; /** * Whether dialing to low-risk numbers is enabled. */ lowRiskNumbersEnabled: boolean; /** * Whether dialing to high-risk special services numbers is enabled. These prefixes include number ranges allocated by the country and include premium numbers, special services, shared cost, and others */ highRiskSpecialNumbersEnabled: boolean; /** * Whether dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers is enabled. These prefixes include narrow number ranges that have a high-risk of international revenue sharing fraud (IRSF) attacks, also known as [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html). These prefixes are collected from anti-fraud databases and verified by analyzing calls on our network. These prefixes are not available for download and are updated frequently */ highRiskTollfraudNumbersEnabled: boolean; /** * The absolute URL of this resource. */ url: string; /** * A list of URLs related to this resource. */ links: Record<string, string>; private get _proxy(); /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Access the highriskSpecialPrefixes. */ highriskSpecialPrefixes(): HighriskSpecialPrefixListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { isoCode: string; name: string; continent: string; countryCodes: string[]; lowRiskNumbersEnabled: boolean; highRiskSpecialNumbersEnabled: boolean; highRiskTollfraudNumbersEnabled: boolean; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CountrySolution { } export interface CountryListInstance { _version: V1; _solution: CountrySolution; _uri: string; (isoCode: string): CountryContext; get(isoCode: string): CountryContext; /** * Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>; /** * Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; /** * Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CountryListInstance(version: V1): CountryListInstance; export declare class CountryPage extends Page<V1, CountryPayload, CountryResource, CountryInstance> { /** * Initialize the CountryPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CountrySolution); /** * Build an instance of CountryInstance * * @param payload - Payload response from the API */ getInstance(payload: CountryResource): CountryInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/voice/v1/dialingPermissions/bulkCountryUpdate.js000064400000005660151677225100017056 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.BulkCountryUpdateInstance = exports.BulkCountryUpdateListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); function BulkCountryUpdateListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/DialingPermissions/BulkCountryUpdates`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["updateRequest"] === null || params["updateRequest"] === undefined) { throw new Error("Required parameter \"params['updateRequest']\" missing."); } let data = {}; data["UpdateRequest"] = params["updateRequest"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BulkCountryUpdateInstance(operationVersion, payload)); 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; } exports.BulkCountryUpdateListInstance = BulkCountryUpdateListInstance; class BulkCountryUpdateInstance { constructor(_version, payload) { this._version = _version; this.updateCount = deserialize.integer(payload.update_count); this.updateRequest = payload.update_request; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { updateCount: this.updateCount, updateRequest: this.updateRequest, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BulkCountryUpdateInstance = BulkCountryUpdateInstance; rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.js000064400000011171151677225100021356 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.HighriskSpecialPrefixPage = exports.HighriskSpecialPrefixInstance = exports.HighriskSpecialPrefixListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function HighriskSpecialPrefixListInstance(version, isoCode) { if (!(0, utility_1.isValidPathParam)(isoCode)) { throw new Error("Parameter 'isoCode' is not valid."); } const instance = {}; instance._version = version; instance._solution = { isoCode }; instance._uri = `/DialingPermissions/Countries/${isoCode}/HighRiskSpecialPrefixes`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new HighriskSpecialPrefixPage(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 HighriskSpecialPrefixPage(instance._version, payload, 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; } exports.HighriskSpecialPrefixListInstance = HighriskSpecialPrefixListInstance; class HighriskSpecialPrefixInstance { constructor(_version, payload, isoCode) { this._version = _version; this.prefix = payload.prefix; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { prefix: this.prefix, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.HighriskSpecialPrefixInstance = HighriskSpecialPrefixInstance; class HighriskSpecialPrefixPage extends Page_1.default { /** * Initialize the HighriskSpecialPrefixPage * * @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 HighriskSpecialPrefixInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new HighriskSpecialPrefixInstance(this._version, payload, this._solution.isoCode); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.HighriskSpecialPrefixPage = HighriskSpecialPrefixPage; rest/voice/v1/dialingPermissions/country/highriskSpecialPrefix.d.ts000064400000014601151677225100021613 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to each */ export interface HighriskSpecialPrefixListInstanceEachOptions { /** 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: HighriskSpecialPrefixInstance, 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 HighriskSpecialPrefixListInstanceOptions { /** 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 HighriskSpecialPrefixListInstancePageOptions { /** 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 HighriskSpecialPrefixSolution { isoCode: string; } export interface HighriskSpecialPrefixListInstance { _version: V1; _solution: HighriskSpecialPrefixSolution; _uri: string; /** * Streams HighriskSpecialPrefixInstance 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 { HighriskSpecialPrefixListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: HighriskSpecialPrefixInstance, done: (err?: Error) => void) => void): void; each(params: HighriskSpecialPrefixListInstanceEachOptions, callback?: (item: HighriskSpecialPrefixInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of HighriskSpecialPrefixInstance 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: HighriskSpecialPrefixPage) => any): Promise<HighriskSpecialPrefixPage>; /** * Lists HighriskSpecialPrefixInstance 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 { HighriskSpecialPrefixListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: HighriskSpecialPrefixInstance[]) => any): Promise<HighriskSpecialPrefixInstance[]>; list(params: HighriskSpecialPrefixListInstanceOptions, callback?: (error: Error | null, items: HighriskSpecialPrefixInstance[]) => any): Promise<HighriskSpecialPrefixInstance[]>; /** * Retrieve a single page of HighriskSpecialPrefixInstance 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 { HighriskSpecialPrefixListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: HighriskSpecialPrefixPage) => any): Promise<HighriskSpecialPrefixPage>; page(params: HighriskSpecialPrefixListInstancePageOptions, callback?: (error: Error | null, items: HighriskSpecialPrefixPage) => any): Promise<HighriskSpecialPrefixPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function HighriskSpecialPrefixListInstance(version: V1, isoCode: string): HighriskSpecialPrefixListInstance; interface HighriskSpecialPrefixPayload extends TwilioResponsePayload { content: HighriskSpecialPrefixResource[]; } interface HighriskSpecialPrefixResource { prefix: string; } export declare class HighriskSpecialPrefixInstance { protected _version: V1; constructor(_version: V1, payload: HighriskSpecialPrefixResource, isoCode: string); /** * A prefix is a contiguous number range for a block of E.164 numbers that includes the E.164 assigned country code. For example, a North American Numbering Plan prefix like `+1510720` written like `+1(510) 720` matches all numbers inclusive from `+1(510) 720-0000` to `+1(510) 720-9999`. */ prefix: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { prefix: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class HighriskSpecialPrefixPage extends Page<V1, HighriskSpecialPrefixPayload, HighriskSpecialPrefixResource, HighriskSpecialPrefixInstance> { /** * Initialize the HighriskSpecialPrefixPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: HighriskSpecialPrefixSolution); /** * Build an instance of HighriskSpecialPrefixInstance * * @param payload - Payload response from the API */ getInstance(payload: HighriskSpecialPrefixResource): HighriskSpecialPrefixInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/voice/v1/dialingPermissions/country.js000064400000020135151677225100015067 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.CountryPage = exports.CountryListInstance = exports.CountryInstance = exports.CountryContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const highriskSpecialPrefix_1 = require("./country/highriskSpecialPrefix"); class CountryContextImpl { constructor(_version, isoCode) { this._version = _version; if (!(0, utility_1.isValidPathParam)(isoCode)) { throw new Error("Parameter 'isoCode' is not valid."); } this._solution = { isoCode }; this._uri = `/DialingPermissions/Countries/${isoCode}`; } get highriskSpecialPrefixes() { this._highriskSpecialPrefixes = this._highriskSpecialPrefixes || (0, highriskSpecialPrefix_1.HighriskSpecialPrefixListInstance)(this._version, this._solution.isoCode); return this._highriskSpecialPrefixes; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CountryInstance(operationVersion, payload, instance._solution.isoCode)); 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.CountryContextImpl = CountryContextImpl; class CountryInstance { constructor(_version, payload, isoCode) { this._version = _version; this.isoCode = payload.iso_code; this.name = payload.name; this.continent = payload.continent; this.countryCodes = payload.country_codes; this.lowRiskNumbersEnabled = payload.low_risk_numbers_enabled; this.highRiskSpecialNumbersEnabled = payload.high_risk_special_numbers_enabled; this.highRiskTollfraudNumbersEnabled = payload.high_risk_tollfraud_numbers_enabled; this.url = payload.url; this.links = payload.links; this._solution = { isoCode: isoCode || this.isoCode }; } get _proxy() { this._context = this._context || new CountryContextImpl(this._version, this._solution.isoCode); return this._context; } /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the highriskSpecialPrefixes. */ highriskSpecialPrefixes() { return this._proxy.highriskSpecialPrefixes; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { isoCode: this.isoCode, name: this.name, continent: this.continent, countryCodes: this.countryCodes, lowRiskNumbersEnabled: this.lowRiskNumbersEnabled, highRiskSpecialNumbersEnabled: this.highRiskSpecialNumbersEnabled, highRiskTollfraudNumbersEnabled: this.highRiskTollfraudNumbersEnabled, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryInstance = CountryInstance; function CountryListInstance(version) { const instance = ((isoCode) => instance.get(isoCode)); instance.get = function get(isoCode) { return new CountryContextImpl(version, isoCode); }; instance._version = version; instance._solution = {}; instance._uri = `/DialingPermissions/Countries`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["isoCode"] !== undefined) data["IsoCode"] = params["isoCode"]; if (params["continent"] !== undefined) data["Continent"] = params["continent"]; if (params["countryCode"] !== undefined) data["CountryCode"] = params["countryCode"]; if (params["lowRiskNumbersEnabled"] !== undefined) data["LowRiskNumbersEnabled"] = serialize.bool(params["lowRiskNumbersEnabled"]); if (params["highRiskSpecialNumbersEnabled"] !== undefined) data["HighRiskSpecialNumbersEnabled"] = serialize.bool(params["highRiskSpecialNumbersEnabled"]); if (params["highRiskTollfraudNumbersEnabled"] !== undefined) data["HighRiskTollfraudNumbersEnabled"] = serialize.bool(params["highRiskTollfraudNumbersEnabled"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CountryPage(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 CountryPage(instance._version, payload, 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; } exports.CountryListInstance = CountryListInstance; class CountryPage extends Page_1.default { /** * Initialize the CountryPage * * @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 CountryInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CountryInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryPage = CountryPage; rest/voice/v1/dialingPermissions/settings.d.ts000064400000010563151677225100015464 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; /** * Options to pass to update a SettingsInstance */ export interface SettingsContextUpdateOptions { /** `true` for the sub-account to inherit voice dialing permissions from the Master Project; otherwise `false`. */ dialingPermissionsInheritance?: boolean; } export interface SettingsContext { /** * Fetch a SettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingsInstance */ fetch(callback?: (error: Error | null, item?: SettingsInstance) => any): Promise<SettingsInstance>; /** * Update a SettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingsInstance */ update(callback?: (error: Error | null, item?: SettingsInstance) => any): Promise<SettingsInstance>; /** * Update a SettingsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingsInstance */ update(params: SettingsContextUpdateOptions, callback?: (error: Error | null, item?: SettingsInstance) => any): Promise<SettingsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SettingsContextSolution { } export declare class SettingsContextImpl implements SettingsContext { protected _version: V1; protected _solution: SettingsContextSolution; protected _uri: string; constructor(_version: V1); fetch(callback?: (error: Error | null, item?: SettingsInstance) => any): Promise<SettingsInstance>; update(params?: SettingsContextUpdateOptions | ((error: Error | null, item?: SettingsInstance) => any), callback?: (error: Error | null, item?: SettingsInstance) => any): Promise<SettingsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SettingsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SettingsResource { dialing_permissions_inheritance: boolean; url: string; } export declare class SettingsInstance { protected _version: V1; protected _solution: SettingsContextSolution; protected _context?: SettingsContext; constructor(_version: V1, payload: SettingsResource); /** * `true` if the sub-account will inherit voice dialing permissions from the Master Project; otherwise `false`. */ dialingPermissionsInheritance: boolean; /** * The absolute URL of this resource. */ url: string; private get _proxy(); /** * Fetch a SettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingsInstance */ fetch(callback?: (error: Error | null, item?: SettingsInstance) => any): Promise<SettingsInstance>; /** * Update a SettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingsInstance */ update(callback?: (error: Error | null, item?: SettingsInstance) => any): Promise<SettingsInstance>; /** * Update a SettingsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingsInstance */ update(params: SettingsContextUpdateOptions, callback?: (error: Error | null, item?: SettingsInstance) => any): Promise<SettingsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { dialingPermissionsInheritance: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SettingsSolution { } export interface SettingsListInstance { _version: V1; _solution: SettingsSolution; _uri: string; (): SettingsContext; get(): SettingsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SettingsListInstance(version: V1): SettingsListInstance; export {}; rest/voice/v1/dialingPermissions/bulkCountryUpdate.d.ts000064400000004370151677225100017307 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; /** * Options to pass to create a BulkCountryUpdateInstance */ export interface BulkCountryUpdateListInstanceCreateOptions { /** URL encoded JSON array of update objects. example : `[ { \\\"iso_code\\\": \\\"GB\\\", \\\"low_risk_numbers_enabled\\\": \\\"true\\\", \\\"high_risk_special_numbers_enabled\\\":\\\"true\\\", \\\"high_risk_tollfraud_numbers_enabled\\\": \\\"false\\\" } ]` */ updateRequest: string; } export interface BulkCountryUpdateSolution { } export interface BulkCountryUpdateListInstance { _version: V1; _solution: BulkCountryUpdateSolution; _uri: string; /** * Create a BulkCountryUpdateInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkCountryUpdateInstance */ create(params: BulkCountryUpdateListInstanceCreateOptions, callback?: (error: Error | null, item?: BulkCountryUpdateInstance) => any): Promise<BulkCountryUpdateInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BulkCountryUpdateListInstance(version: V1): BulkCountryUpdateListInstance; interface BulkCountryUpdateResource { update_count: number; update_request: string; } export declare class BulkCountryUpdateInstance { protected _version: V1; constructor(_version: V1, payload: BulkCountryUpdateResource); /** * The number of countries updated */ updateCount: number; /** * A bulk update request to change voice dialing country permissions stored as a URL-encoded, JSON array of update objects. For example : `[ { \"iso_code\": \"GB\", \"low_risk_numbers_enabled\": \"true\", \"high_risk_special_numbers_enabled\":\"true\", \"high_risk_tollfraud_numbers_enabled\": \"false\" } ]` */ updateRequest: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { updateCount: number; updateRequest: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/voice/v1/dialingPermissions/settings.js000064400000010530151677225100015222 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.SettingsListInstance = exports.SettingsInstance = exports.SettingsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); class SettingsContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/Settings`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SettingsInstance(operationVersion, payload)); 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["dialingPermissionsInheritance"] !== undefined) data["DialingPermissionsInheritance"] = serialize.bool(params["dialingPermissionsInheritance"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SettingsInstance(operationVersion, payload)); 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.SettingsContextImpl = SettingsContextImpl; class SettingsInstance { constructor(_version, payload) { this._version = _version; this.dialingPermissionsInheritance = payload.dialing_permissions_inheritance; this.url = payload.url; this._solution = {}; } get _proxy() { this._context = this._context || new SettingsContextImpl(this._version); return this._context; } /** * Fetch a SettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingsInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { dialingPermissionsInheritance: this.dialingPermissionsInheritance, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SettingsInstance = SettingsInstance; function SettingsListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new SettingsContextImpl(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; } exports.SettingsListInstance = SettingsListInstance; rest/voice/v1/connectionPolicy.js000064400000022777151677225100013056 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.ConnectionPolicyPage = exports.ConnectionPolicyListInstance = exports.ConnectionPolicyInstance = exports.ConnectionPolicyContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const connectionPolicyTarget_1 = require("./connectionPolicy/connectionPolicyTarget"); class ConnectionPolicyContextImpl { 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 = `/ConnectionPolicies/${sid}`; } get targets() { this._targets = this._targets || (0, connectionPolicyTarget_1.ConnectionPolicyTargetListInstance)(this._version, this._solution.sid); return this._targets; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ConnectionPolicyInstance(operationVersion, payload, 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"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConnectionPolicyInstance(operationVersion, payload, 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.ConnectionPolicyContextImpl = ConnectionPolicyContextImpl; class ConnectionPolicyInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.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.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ConnectionPolicyContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ConnectionPolicyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ConnectionPolicyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the targets. */ targets() { return this._proxy.targets; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConnectionPolicyInstance = ConnectionPolicyInstance; function ConnectionPolicyListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ConnectionPolicyContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/ConnectionPolicies`; instance.create = function create(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"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConnectionPolicyInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConnectionPolicyPage(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 ConnectionPolicyPage(instance._version, payload, 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; } exports.ConnectionPolicyListInstance = ConnectionPolicyListInstance; class ConnectionPolicyPage extends Page_1.default { /** * Initialize the ConnectionPolicyPage * * @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 ConnectionPolicyInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ConnectionPolicyInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConnectionPolicyPage = ConnectionPolicyPage; rest/voice/v1/sourceIpMapping.d.ts000064400000025601151677225100013065 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to update a SourceIpMappingInstance */ export interface SourceIpMappingContextUpdateOptions { /** The SID of the SIP Domain that the IP Record should be mapped to. */ sipDomainSid: string; } /** * Options to pass to create a SourceIpMappingInstance */ export interface SourceIpMappingListInstanceCreateOptions { /** The Twilio-provided string that uniquely identifies the IP Record resource to map from. */ ipRecordSid: string; /** The SID of the SIP Domain that the IP Record should be mapped to. */ sipDomainSid: string; } /** * Options to pass to each */ export interface SourceIpMappingListInstanceEachOptions { /** 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: SourceIpMappingInstance, 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 SourceIpMappingListInstanceOptions { /** 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 SourceIpMappingListInstancePageOptions { /** 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 SourceIpMappingContext { /** * Remove a SourceIpMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SourceIpMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SourceIpMappingInstance */ fetch(callback?: (error: Error | null, item?: SourceIpMappingInstance) => any): Promise<SourceIpMappingInstance>; /** * Update a SourceIpMappingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SourceIpMappingInstance */ update(params: SourceIpMappingContextUpdateOptions, callback?: (error: Error | null, item?: SourceIpMappingInstance) => any): Promise<SourceIpMappingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SourceIpMappingContextSolution { sid: string; } export declare class SourceIpMappingContextImpl implements SourceIpMappingContext { protected _version: V1; protected _solution: SourceIpMappingContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SourceIpMappingInstance) => any): Promise<SourceIpMappingInstance>; update(params: SourceIpMappingContextUpdateOptions, callback?: (error: Error | null, item?: SourceIpMappingInstance) => any): Promise<SourceIpMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SourceIpMappingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SourceIpMappingPayload extends TwilioResponsePayload { source_ip_mappings: SourceIpMappingResource[]; } interface SourceIpMappingResource { sid: string; ip_record_sid: string; sip_domain_sid: string; date_created: Date; date_updated: Date; url: string; } export declare class SourceIpMappingInstance { protected _version: V1; protected _solution: SourceIpMappingContextSolution; protected _context?: SourceIpMappingContext; constructor(_version: V1, payload: SourceIpMappingResource, sid?: string); /** * The unique string that we created to identify the IP Record resource. */ sid: string; /** * The Twilio-provided string that uniquely identifies the IP Record resource to map from. */ ipRecordSid: string; /** * The SID of the SIP Domain that the IP Record is mapped to. */ sipDomainSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a SourceIpMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SourceIpMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SourceIpMappingInstance */ fetch(callback?: (error: Error | null, item?: SourceIpMappingInstance) => any): Promise<SourceIpMappingInstance>; /** * Update a SourceIpMappingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SourceIpMappingInstance */ update(params: SourceIpMappingContextUpdateOptions, callback?: (error: Error | null, item?: SourceIpMappingInstance) => any): Promise<SourceIpMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; ipRecordSid: string; sipDomainSid: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SourceIpMappingSolution { } export interface SourceIpMappingListInstance { _version: V1; _solution: SourceIpMappingSolution; _uri: string; (sid: string): SourceIpMappingContext; get(sid: string): SourceIpMappingContext; /** * Create a SourceIpMappingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SourceIpMappingInstance */ create(params: SourceIpMappingListInstanceCreateOptions, callback?: (error: Error | null, item?: SourceIpMappingInstance) => any): Promise<SourceIpMappingInstance>; /** * Streams SourceIpMappingInstance 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 { SourceIpMappingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SourceIpMappingInstance, done: (err?: Error) => void) => void): void; each(params: SourceIpMappingListInstanceEachOptions, callback?: (item: SourceIpMappingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SourceIpMappingInstance 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: SourceIpMappingPage) => any): Promise<SourceIpMappingPage>; /** * Lists SourceIpMappingInstance 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 { SourceIpMappingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SourceIpMappingInstance[]) => any): Promise<SourceIpMappingInstance[]>; list(params: SourceIpMappingListInstanceOptions, callback?: (error: Error | null, items: SourceIpMappingInstance[]) => any): Promise<SourceIpMappingInstance[]>; /** * Retrieve a single page of SourceIpMappingInstance 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 { SourceIpMappingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SourceIpMappingPage) => any): Promise<SourceIpMappingPage>; page(params: SourceIpMappingListInstancePageOptions, callback?: (error: Error | null, items: SourceIpMappingPage) => any): Promise<SourceIpMappingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SourceIpMappingListInstance(version: V1): SourceIpMappingListInstance; export declare class SourceIpMappingPage extends Page<V1, SourceIpMappingPayload, SourceIpMappingResource, SourceIpMappingInstance> { /** * Initialize the SourceIpMappingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SourceIpMappingSolution); /** * Build an instance of SourceIpMappingInstance * * @param payload - Payload response from the API */ getInstance(payload: SourceIpMappingResource): SourceIpMappingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/voice/v1/connectionPolicy.d.ts000064400000030740151677225100013277 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { ConnectionPolicyTargetListInstance } from "./connectionPolicy/connectionPolicyTarget"; /** * Options to pass to update a ConnectionPolicyInstance */ export interface ConnectionPolicyContextUpdateOptions { /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ friendlyName?: string; } /** * Options to pass to create a ConnectionPolicyInstance */ export interface ConnectionPolicyListInstanceCreateOptions { /** A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. */ friendlyName?: string; } /** * Options to pass to each */ export interface ConnectionPolicyListInstanceEachOptions { /** 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: ConnectionPolicyInstance, 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 ConnectionPolicyListInstanceOptions { /** 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 ConnectionPolicyListInstancePageOptions { /** 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 ConnectionPolicyContext { targets: ConnectionPolicyTargetListInstance; /** * Remove a ConnectionPolicyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConnectionPolicyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyInstance */ fetch(callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; /** * Update a ConnectionPolicyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyInstance */ update(callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; /** * Update a ConnectionPolicyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyInstance */ update(params: ConnectionPolicyContextUpdateOptions, callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConnectionPolicyContextSolution { sid: string; } export declare class ConnectionPolicyContextImpl implements ConnectionPolicyContext { protected _version: V1; protected _solution: ConnectionPolicyContextSolution; protected _uri: string; protected _targets?: ConnectionPolicyTargetListInstance; constructor(_version: V1, sid: string); get targets(): ConnectionPolicyTargetListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; update(params?: ConnectionPolicyContextUpdateOptions | ((error: Error | null, item?: ConnectionPolicyInstance) => any), callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConnectionPolicyContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConnectionPolicyPayload extends TwilioResponsePayload { connection_policies: ConnectionPolicyResource[]; } interface ConnectionPolicyResource { account_sid: string; sid: string; friendly_name: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ConnectionPolicyInstance { protected _version: V1; protected _solution: ConnectionPolicyContextSolution; protected _context?: ConnectionPolicyContext; constructor(_version: V1, payload: ConnectionPolicyResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Connection Policy resource. */ accountSid: string; /** * The unique string that we created to identify the Connection Policy resource. */ sid: 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 absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a ConnectionPolicyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConnectionPolicyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyInstance */ fetch(callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; /** * Update a ConnectionPolicyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyInstance */ update(callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; /** * Update a ConnectionPolicyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyInstance */ update(params: ConnectionPolicyContextUpdateOptions, callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; /** * Access the targets. */ targets(): ConnectionPolicyTargetListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConnectionPolicySolution { } export interface ConnectionPolicyListInstance { _version: V1; _solution: ConnectionPolicySolution; _uri: string; (sid: string): ConnectionPolicyContext; get(sid: string): ConnectionPolicyContext; /** * Create a ConnectionPolicyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyInstance */ create(callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; /** * Create a ConnectionPolicyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectionPolicyInstance */ create(params: ConnectionPolicyListInstanceCreateOptions, callback?: (error: Error | null, item?: ConnectionPolicyInstance) => any): Promise<ConnectionPolicyInstance>; /** * Streams ConnectionPolicyInstance 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 { ConnectionPolicyListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ConnectionPolicyInstance, done: (err?: Error) => void) => void): void; each(params: ConnectionPolicyListInstanceEachOptions, callback?: (item: ConnectionPolicyInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ConnectionPolicyInstance 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: ConnectionPolicyPage) => any): Promise<ConnectionPolicyPage>; /** * Lists ConnectionPolicyInstance 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 { ConnectionPolicyListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ConnectionPolicyInstance[]) => any): Promise<ConnectionPolicyInstance[]>; list(params: ConnectionPolicyListInstanceOptions, callback?: (error: Error | null, items: ConnectionPolicyInstance[]) => any): Promise<ConnectionPolicyInstance[]>; /** * Retrieve a single page of ConnectionPolicyInstance 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 { ConnectionPolicyListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ConnectionPolicyPage) => any): Promise<ConnectionPolicyPage>; page(params: ConnectionPolicyListInstancePageOptions, callback?: (error: Error | null, items: ConnectionPolicyPage) => any): Promise<ConnectionPolicyPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConnectionPolicyListInstance(version: V1): ConnectionPolicyListInstance; export declare class ConnectionPolicyPage extends Page<V1, ConnectionPolicyPayload, ConnectionPolicyResource, ConnectionPolicyInstance> { /** * Initialize the ConnectionPolicyPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ConnectionPolicySolution); /** * Build an instance of ConnectionPolicyInstance * * @param payload - Payload response from the API */ getInstance(payload: ConnectionPolicyResource): ConnectionPolicyInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/voice/v1/byocTrunk.js000064400000027664151677225100011517 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.ByocTrunkPage = exports.ByocTrunkListInstance = exports.ByocTrunkInstance = exports.ByocTrunkContextImpl = void 0; 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 ByocTrunkContextImpl { 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 = `/ByocTrunks/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ByocTrunkInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["statusCallbackUrl"] !== undefined) data["StatusCallbackUrl"] = params["statusCallbackUrl"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["cnamLookupEnabled"] !== undefined) data["CnamLookupEnabled"] = serialize.bool(params["cnamLookupEnabled"]); if (params["connectionPolicySid"] !== undefined) data["ConnectionPolicySid"] = params["connectionPolicySid"]; if (params["fromDomainSid"] !== undefined) data["FromDomainSid"] = params["fromDomainSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ByocTrunkInstance(operationVersion, payload, 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.ByocTrunkContextImpl = ByocTrunkContextImpl; class ByocTrunkInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.voiceUrl = payload.voice_url; this.voiceMethod = payload.voice_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceFallbackMethod = payload.voice_fallback_method; this.statusCallbackUrl = payload.status_callback_url; this.statusCallbackMethod = payload.status_callback_method; this.cnamLookupEnabled = payload.cnam_lookup_enabled; this.connectionPolicySid = payload.connection_policy_sid; this.fromDomainSid = payload.from_domain_sid; 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 ByocTrunkContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ByocTrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ByocTrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ByocTrunkInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, friendlyName: this.friendlyName, voiceUrl: this.voiceUrl, voiceMethod: this.voiceMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceFallbackMethod: this.voiceFallbackMethod, statusCallbackUrl: this.statusCallbackUrl, statusCallbackMethod: this.statusCallbackMethod, cnamLookupEnabled: this.cnamLookupEnabled, connectionPolicySid: this.connectionPolicySid, fromDomainSid: this.fromDomainSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ByocTrunkInstance = ByocTrunkInstance; function ByocTrunkListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ByocTrunkContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/ByocTrunks`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["statusCallbackUrl"] !== undefined) data["StatusCallbackUrl"] = params["statusCallbackUrl"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["cnamLookupEnabled"] !== undefined) data["CnamLookupEnabled"] = serialize.bool(params["cnamLookupEnabled"]); if (params["connectionPolicySid"] !== undefined) data["ConnectionPolicySid"] = params["connectionPolicySid"]; if (params["fromDomainSid"] !== undefined) data["FromDomainSid"] = params["fromDomainSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ByocTrunkInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ByocTrunkPage(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 ByocTrunkPage(instance._version, payload, 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; } exports.ByocTrunkListInstance = ByocTrunkListInstance; class ByocTrunkPage extends Page_1.default { /** * Initialize the ByocTrunkPage * * @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 ByocTrunkInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ByocTrunkInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ByocTrunkPage = ByocTrunkPage; rest/voice/v1/dialingPermissions.js000064400000004554151677225100013373 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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.DialingPermissionsListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const bulkCountryUpdate_1 = require("./dialingPermissions/bulkCountryUpdate"); const country_1 = require("./dialingPermissions/country"); const settings_1 = require("./dialingPermissions/settings"); function DialingPermissionsListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/DialingPermissions`; Object.defineProperty(instance, "bulkCountryUpdates", { get: function bulkCountryUpdates() { if (!instance._bulkCountryUpdates) { instance._bulkCountryUpdates = (0, bulkCountryUpdate_1.BulkCountryUpdateListInstance)(instance._version); } return instance._bulkCountryUpdates; }, }); Object.defineProperty(instance, "countries", { get: function countries() { if (!instance._countries) { instance._countries = (0, country_1.CountryListInstance)(instance._version); } return instance._countries; }, }); Object.defineProperty(instance, "settings", { get: function settings() { if (!instance._settings) { instance._settings = (0, settings_1.SettingsListInstance)(instance._version); } return instance._settings; }, }); 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; } exports.DialingPermissionsListInstance = DialingPermissionsListInstance; rest/voice/V1.js000064400000005255151677225100007467 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Voice * 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 archivedCall_1 = require("./v1/archivedCall"); const byocTrunk_1 = require("./v1/byocTrunk"); const connectionPolicy_1 = require("./v1/connectionPolicy"); const dialingPermissions_1 = require("./v1/dialingPermissions"); const ipRecord_1 = require("./v1/ipRecord"); const sourceIpMapping_1 = require("./v1/sourceIpMapping"); class V1 extends Version_1.default { /** * Initialize the V1 version of Voice * * @param domain - The Twilio (Twilio.Voice) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for archivedCalls resource */ get archivedCalls() { this._archivedCalls = this._archivedCalls || (0, archivedCall_1.ArchivedCallListInstance)(this); return this._archivedCalls; } /** Getter for byocTrunks resource */ get byocTrunks() { this._byocTrunks = this._byocTrunks || (0, byocTrunk_1.ByocTrunkListInstance)(this); return this._byocTrunks; } /** Getter for connectionPolicies resource */ get connectionPolicies() { this._connectionPolicies = this._connectionPolicies || (0, connectionPolicy_1.ConnectionPolicyListInstance)(this); return this._connectionPolicies; } /** Getter for dialingPermissions resource */ get dialingPermissions() { this._dialingPermissions = this._dialingPermissions || (0, dialingPermissions_1.DialingPermissionsListInstance)(this); return this._dialingPermissions; } /** Getter for ipRecords resource */ get ipRecords() { this._ipRecords = this._ipRecords || (0, ipRecord_1.IpRecordListInstance)(this); return this._ipRecords; } /** Getter for sourceIpMappings resource */ get sourceIpMappings() { this._sourceIpMappings = this._sourceIpMappings || (0, sourceIpMapping_1.SourceIpMappingListInstance)(this); return this._sourceIpMappings; } } exports.default = V1; rest/FrontlineApi.js000064400000000761151677225100010463 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const FrontlineApiBase_1 = __importDefault(require("./FrontlineApiBase")); class FrontlineApi extends FrontlineApiBase_1.default { /** * @deprecated - Use v1.users instead */ get users() { console.warn("users is deprecated. Use v1.users instead."); return this.v1.users; } } module.exports = FrontlineApi; rest/LookupsBase.d.ts000064400000000545151677225100010554 0ustar00import Domain from "../base/Domain"; import V1 from "./lookups/V1"; import V2 from "./lookups/V2"; declare class LookupsBase extends Domain { _v1?: V1; _v2?: V2; /** * Initialize lookups domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; get v2(): V2; } export = LookupsBase; rest/Notify.js000064400000001264151677225100007340 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const NotifyBase_1 = __importDefault(require("./NotifyBase")); class Notify extends NotifyBase_1.default { /** * @deprecated - Use v1.credentials instead */ get credentials() { console.warn("credentials is deprecated. Use v1.credentials instead."); return this.v1.credentials; } /** * @deprecated - Use v1.services instead */ get services() { console.warn("services is deprecated. Use v1.services instead."); return this.v1.services; } } module.exports = Notify; rest/video/V1.d.ts000064400000004034151677225100007716 0ustar00import VideoBase from "../VideoBase"; import Version from "../../base/Version"; import { CompositionListInstance } from "./v1/composition"; import { CompositionHookListInstance } from "./v1/compositionHook"; import { CompositionSettingsListInstance } from "./v1/compositionSettings"; import { RecordingListInstance } from "./v1/recording"; import { RecordingSettingsListInstance } from "./v1/recordingSettings"; import { RoomListInstance } from "./v1/room"; export default class V1 extends Version { /** * Initialize the V1 version of Video * * @param domain - The Twilio (Twilio.Video) domain */ constructor(domain: VideoBase); /** compositions - { Twilio.Video.V1.CompositionListInstance } resource */ protected _compositions?: CompositionListInstance; /** compositionHooks - { Twilio.Video.V1.CompositionHookListInstance } resource */ protected _compositionHooks?: CompositionHookListInstance; /** compositionSettings - { Twilio.Video.V1.CompositionSettingsListInstance } resource */ protected _compositionSettings?: CompositionSettingsListInstance; /** recordings - { Twilio.Video.V1.RecordingListInstance } resource */ protected _recordings?: RecordingListInstance; /** recordingSettings - { Twilio.Video.V1.RecordingSettingsListInstance } resource */ protected _recordingSettings?: RecordingSettingsListInstance; /** rooms - { Twilio.Video.V1.RoomListInstance } resource */ protected _rooms?: RoomListInstance; /** Getter for compositions resource */ get compositions(): CompositionListInstance; /** Getter for compositionHooks resource */ get compositionHooks(): CompositionHookListInstance; /** Getter for compositionSettings resource */ get compositionSettings(): CompositionSettingsListInstance; /** Getter for recordings resource */ get recordings(): RecordingListInstance; /** Getter for recordingSettings resource */ get recordingSettings(): RecordingSettingsListInstance; /** Getter for rooms resource */ get rooms(): RoomListInstance; } rest/video/v1/compositionSettings.d.ts000064400000014645151677225100014053 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a CompositionSettingsInstance */ export interface CompositionSettingsContextCreateOptions { /** A descriptive string that you create to describe the resource and show to the user in the console */ friendlyName: string; /** The SID of the stored Credential resource. */ awsCredentialsSid?: string; /** The SID of the Public Key resource to use for encryption. */ encryptionKeySid?: string; /** The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). */ awsS3Url?: string; /** Whether all compositions should be written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. */ awsStorageEnabled?: boolean; /** Whether all compositions should be stored in an encrypted form. The default is `false`. */ encryptionEnabled?: boolean; } export interface CompositionSettingsContext { /** * Create a CompositionSettingsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionSettingsInstance */ create(params: CompositionSettingsContextCreateOptions, callback?: (error: Error | null, item?: CompositionSettingsInstance) => any): Promise<CompositionSettingsInstance>; /** * Fetch a CompositionSettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionSettingsInstance */ fetch(callback?: (error: Error | null, item?: CompositionSettingsInstance) => any): Promise<CompositionSettingsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CompositionSettingsContextSolution { } export declare class CompositionSettingsContextImpl implements CompositionSettingsContext { protected _version: V1; protected _solution: CompositionSettingsContextSolution; protected _uri: string; constructor(_version: V1); create(params: CompositionSettingsContextCreateOptions, callback?: (error: Error | null, item?: CompositionSettingsInstance) => any): Promise<CompositionSettingsInstance>; fetch(callback?: (error: Error | null, item?: CompositionSettingsInstance) => any): Promise<CompositionSettingsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CompositionSettingsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CompositionSettingsResource { account_sid: string; friendly_name: string; aws_credentials_sid: string; aws_s3_url: string; aws_storage_enabled: boolean; encryption_key_sid: string; encryption_enabled: boolean; url: string; } export declare class CompositionSettingsInstance { protected _version: V1; protected _solution: CompositionSettingsContextSolution; protected _context?: CompositionSettingsContext; constructor(_version: V1, payload: CompositionSettingsResource); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionSettings resource. */ accountSid: string; /** * The string that you assigned to describe the resource and that will be shown in the console */ friendlyName: string; /** * The SID of the stored Credential resource. */ awsCredentialsSid: string; /** * The URL of the AWS S3 bucket where the compositions are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). */ awsS3Url: string; /** * Whether all compositions are written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. */ awsStorageEnabled: boolean; /** * The SID of the Public Key resource used for encryption. */ encryptionKeySid: string; /** * Whether all compositions are stored in an encrypted form. The default is `false`. */ encryptionEnabled: boolean; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Create a CompositionSettingsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionSettingsInstance */ create(params: CompositionSettingsContextCreateOptions, callback?: (error: Error | null, item?: CompositionSettingsInstance) => any): Promise<CompositionSettingsInstance>; /** * Fetch a CompositionSettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionSettingsInstance */ fetch(callback?: (error: Error | null, item?: CompositionSettingsInstance) => any): Promise<CompositionSettingsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; friendlyName: string; awsCredentialsSid: string; awsS3Url: string; awsStorageEnabled: boolean; encryptionKeySid: string; encryptionEnabled: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CompositionSettingsSolution { } export interface CompositionSettingsListInstance { _version: V1; _solution: CompositionSettingsSolution; _uri: string; (): CompositionSettingsContext; get(): CompositionSettingsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CompositionSettingsListInstance(version: V1): CompositionSettingsListInstance; export {}; rest/video/v1/compositionSettings.js000064400000013365151677225100013615 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.CompositionSettingsListInstance = exports.CompositionSettingsInstance = exports.CompositionSettingsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class CompositionSettingsContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/CompositionSettings/Default`; } create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["awsCredentialsSid"] !== undefined) data["AwsCredentialsSid"] = params["awsCredentialsSid"]; if (params["encryptionKeySid"] !== undefined) data["EncryptionKeySid"] = params["encryptionKeySid"]; if (params["awsS3Url"] !== undefined) data["AwsS3Url"] = params["awsS3Url"]; if (params["awsStorageEnabled"] !== undefined) data["AwsStorageEnabled"] = serialize.bool(params["awsStorageEnabled"]); if (params["encryptionEnabled"] !== undefined) data["EncryptionEnabled"] = serialize.bool(params["encryptionEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CompositionSettingsInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CompositionSettingsInstance(operationVersion, payload)); 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.CompositionSettingsContextImpl = CompositionSettingsContextImpl; class CompositionSettingsInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.awsCredentialsSid = payload.aws_credentials_sid; this.awsS3Url = payload.aws_s3_url; this.awsStorageEnabled = payload.aws_storage_enabled; this.encryptionKeySid = payload.encryption_key_sid; this.encryptionEnabled = payload.encryption_enabled; this.url = payload.url; this._solution = {}; } get _proxy() { this._context = this._context || new CompositionSettingsContextImpl(this._version); return this._context; } create(params, callback) { return this._proxy.create(params, callback); } /** * Fetch a CompositionSettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionSettingsInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, friendlyName: this.friendlyName, awsCredentialsSid: this.awsCredentialsSid, awsS3Url: this.awsS3Url, awsStorageEnabled: this.awsStorageEnabled, encryptionKeySid: this.encryptionKeySid, encryptionEnabled: this.encryptionEnabled, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CompositionSettingsInstance = CompositionSettingsInstance; function CompositionSettingsListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new CompositionSettingsContextImpl(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; } exports.CompositionSettingsListInstance = CompositionSettingsListInstance; rest/video/v1/recordingSettings.d.ts000064400000014455151677225100013463 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a RecordingSettingsInstance */ export interface RecordingSettingsContextCreateOptions { /** A descriptive string that you create to describe the resource and be shown to users in the console */ friendlyName: string; /** The SID of the stored Credential resource. */ awsCredentialsSid?: string; /** The SID of the Public Key resource to use for encryption. */ encryptionKeySid?: string; /** The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). */ awsS3Url?: string; /** Whether all recordings should be written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. */ awsStorageEnabled?: boolean; /** Whether all recordings should be stored in an encrypted form. The default is `false`. */ encryptionEnabled?: boolean; } export interface RecordingSettingsContext { /** * Create a RecordingSettingsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingSettingsInstance */ create(params: RecordingSettingsContextCreateOptions, callback?: (error: Error | null, item?: RecordingSettingsInstance) => any): Promise<RecordingSettingsInstance>; /** * Fetch a RecordingSettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingSettingsInstance */ fetch(callback?: (error: Error | null, item?: RecordingSettingsInstance) => any): Promise<RecordingSettingsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RecordingSettingsContextSolution { } export declare class RecordingSettingsContextImpl implements RecordingSettingsContext { protected _version: V1; protected _solution: RecordingSettingsContextSolution; protected _uri: string; constructor(_version: V1); create(params: RecordingSettingsContextCreateOptions, callback?: (error: Error | null, item?: RecordingSettingsInstance) => any): Promise<RecordingSettingsInstance>; fetch(callback?: (error: Error | null, item?: RecordingSettingsInstance) => any): Promise<RecordingSettingsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RecordingSettingsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RecordingSettingsResource { account_sid: string; friendly_name: string; aws_credentials_sid: string; aws_s3_url: string; aws_storage_enabled: boolean; encryption_key_sid: string; encryption_enabled: boolean; url: string; } export declare class RecordingSettingsInstance { protected _version: V1; protected _solution: RecordingSettingsContextSolution; protected _context?: RecordingSettingsContext; constructor(_version: V1, payload: RecordingSettingsResource); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RecordingSettings resource. */ accountSid: string; /** * The string that you assigned to describe the resource and show the user in the console */ friendlyName: string; /** * The SID of the stored Credential resource. */ awsCredentialsSid: string; /** * The URL of the AWS S3 bucket where the recordings are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). */ awsS3Url: string; /** * Whether all recordings are written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. */ awsStorageEnabled: boolean; /** * The SID of the Public Key resource used for encryption. */ encryptionKeySid: string; /** * Whether all recordings are stored in an encrypted form. The default is `false`. */ encryptionEnabled: boolean; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Create a RecordingSettingsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingSettingsInstance */ create(params: RecordingSettingsContextCreateOptions, callback?: (error: Error | null, item?: RecordingSettingsInstance) => any): Promise<RecordingSettingsInstance>; /** * Fetch a RecordingSettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingSettingsInstance */ fetch(callback?: (error: Error | null, item?: RecordingSettingsInstance) => any): Promise<RecordingSettingsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; friendlyName: string; awsCredentialsSid: string; awsS3Url: string; awsStorageEnabled: boolean; encryptionKeySid: string; encryptionEnabled: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RecordingSettingsSolution { } export interface RecordingSettingsListInstance { _version: V1; _solution: RecordingSettingsSolution; _uri: string; (): RecordingSettingsContext; get(): RecordingSettingsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RecordingSettingsListInstance(version: V1): RecordingSettingsListInstance; export {}; rest/video/v1/room.js000064400000032616151677225100010505 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.RoomPage = exports.RoomListInstance = exports.RoomInstance = exports.RoomContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const participant_1 = require("./room/participant"); const recordingRules_1 = require("./room/recordingRules"); const roomRecording_1 = require("./room/roomRecording"); class RoomContextImpl { 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 = `/Rooms/${sid}`; } get participants() { this._participants = this._participants || (0, participant_1.ParticipantListInstance)(this._version, this._solution.sid); return this._participants; } get recordingRules() { this._recordingRules = this._recordingRules || (0, recordingRules_1.RecordingRulesListInstance)(this._version, this._solution.sid); return this._recordingRules; } get recordings() { this._recordings = this._recordings || (0, roomRecording_1.RoomRecordingListInstance)(this._version, this._solution.sid); return this._recordings; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RoomInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoomInstance(operationVersion, payload, 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.RoomContextImpl = RoomContextImpl; class RoomInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.status = payload.status; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.accountSid = payload.account_sid; this.enableTurn = payload.enable_turn; this.uniqueName = payload.unique_name; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.endTime = deserialize.iso8601DateTime(payload.end_time); this.duration = deserialize.integer(payload.duration); this.type = payload.type; this.maxParticipants = deserialize.integer(payload.max_participants); this.maxParticipantDuration = deserialize.integer(payload.max_participant_duration); this.maxConcurrentPublishedTracks = deserialize.integer(payload.max_concurrent_published_tracks); this.recordParticipantsOnConnect = payload.record_participants_on_connect; this.videoCodecs = payload.video_codecs; this.mediaRegion = payload.media_region; this.audioOnly = payload.audio_only; this.emptyRoomTimeout = deserialize.integer(payload.empty_room_timeout); this.unusedRoomTimeout = deserialize.integer(payload.unused_room_timeout); this.largeRoom = payload.large_room; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RoomContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a RoomInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the participants. */ participants() { return this._proxy.participants; } /** * Access the recordingRules. */ recordingRules() { return this._proxy.recordingRules; } /** * Access the recordings. */ recordings() { return this._proxy.recordings; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, status: this.status, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, accountSid: this.accountSid, enableTurn: this.enableTurn, uniqueName: this.uniqueName, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, endTime: this.endTime, duration: this.duration, type: this.type, maxParticipants: this.maxParticipants, maxParticipantDuration: this.maxParticipantDuration, maxConcurrentPublishedTracks: this.maxConcurrentPublishedTracks, recordParticipantsOnConnect: this.recordParticipantsOnConnect, videoCodecs: this.videoCodecs, mediaRegion: this.mediaRegion, audioOnly: this.audioOnly, emptyRoomTimeout: this.emptyRoomTimeout, unusedRoomTimeout: this.unusedRoomTimeout, largeRoom: this.largeRoom, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoomInstance = RoomInstance; function RoomListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RoomContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Rooms`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["enableTurn"] !== undefined) data["EnableTurn"] = serialize.bool(params["enableTurn"]); if (params["type"] !== undefined) data["Type"] = params["type"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["maxParticipants"] !== undefined) data["MaxParticipants"] = params["maxParticipants"]; if (params["recordParticipantsOnConnect"] !== undefined) data["RecordParticipantsOnConnect"] = serialize.bool(params["recordParticipantsOnConnect"]); if (params["videoCodecs"] !== undefined) data["VideoCodecs"] = serialize.map(params["videoCodecs"], (e) => e); if (params["mediaRegion"] !== undefined) data["MediaRegion"] = params["mediaRegion"]; if (params["recordingRules"] !== undefined) data["RecordingRules"] = serialize.object(params["recordingRules"]); if (params["audioOnly"] !== undefined) data["AudioOnly"] = serialize.bool(params["audioOnly"]); if (params["maxParticipantDuration"] !== undefined) data["MaxParticipantDuration"] = params["maxParticipantDuration"]; if (params["emptyRoomTimeout"] !== undefined) data["EmptyRoomTimeout"] = params["emptyRoomTimeout"]; if (params["unusedRoomTimeout"] !== undefined) data["UnusedRoomTimeout"] = params["unusedRoomTimeout"]; if (params["largeRoom"] !== undefined) data["LargeRoom"] = serialize.bool(params["largeRoom"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoomInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RoomPage(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 RoomPage(instance._version, payload, 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; } exports.RoomListInstance = RoomListInstance; class RoomPage extends Page_1.default { /** * Initialize the RoomPage * * @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 RoomInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RoomInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoomPage = RoomPage; rest/video/v1/compositionHook.d.ts000064400000055313151677225100013150 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type CompositionHookFormat = "mp4" | "webm"; /** * Options to pass to update a CompositionHookInstance */ export interface CompositionHookContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 100 characters long and it must be unique within the account. */ friendlyName: string; /** Whether the composition hook is active. When `true`, the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook never triggers. */ enabled?: boolean; /** A JSON object that describes the video layout of the composition hook in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ videoLayout?: any; /** An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. */ audioSources?: Array<string>; /** An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. */ audioSourcesExcluded?: Array<string>; /** Whether to clip the intervals where there is no active media in the compositions triggered by the composition hook. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ trim?: boolean; /** */ format?: CompositionHookFormat; /** A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string\\\'s format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ resolution?: string; /** The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. */ statusCallbackMethod?: string; } /** * Options to pass to create a CompositionHookInstance */ export interface CompositionHookListInstanceCreateOptions { /** A descriptive string that you create to describe the resource. It can be up to 100 characters long and it must be unique within the account. */ friendlyName: string; /** Whether the composition hook is active. When `true`, the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook will never be triggered. */ enabled?: boolean; /** An object that describes the video layout of the composition hook in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ videoLayout?: any; /** An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. */ audioSources?: Array<string>; /** An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. */ audioSourcesExcluded?: Array<string>; /** A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string\\\'s format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ resolution?: string; /** */ format?: CompositionHookFormat; /** The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. */ statusCallbackMethod?: string; /** Whether to clip the intervals where there is no active media in the Compositions triggered by the composition hook. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ trim?: boolean; } /** * Options to pass to each */ export interface CompositionHookListInstanceEachOptions { /** Read only CompositionHook resources with an `enabled` value that matches this parameter. */ enabled?: boolean; /** Read only CompositionHook resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedAfter?: Date; /** Read only CompositionHook resources created before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedBefore?: Date; /** Read only CompositionHook resources with friendly names that match this string. The match is not case sensitive and can include asterisk `*` characters as wildcard match. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CompositionHookInstance, 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 CompositionHookListInstanceOptions { /** Read only CompositionHook resources with an `enabled` value that matches this parameter. */ enabled?: boolean; /** Read only CompositionHook resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedAfter?: Date; /** Read only CompositionHook resources created before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedBefore?: Date; /** Read only CompositionHook resources with friendly names that match this string. The match is not case sensitive and can include asterisk `*` characters as wildcard match. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CompositionHookListInstancePageOptions { /** Read only CompositionHook resources with an `enabled` value that matches this parameter. */ enabled?: boolean; /** Read only CompositionHook resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedAfter?: Date; /** Read only CompositionHook resources created before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedBefore?: Date; /** Read only CompositionHook resources with friendly names that match this string. The match is not case sensitive and can include asterisk `*` characters as wildcard match. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CompositionHookContext { /** * Remove a CompositionHookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CompositionHookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionHookInstance */ fetch(callback?: (error: Error | null, item?: CompositionHookInstance) => any): Promise<CompositionHookInstance>; /** * Update a CompositionHookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionHookInstance */ update(params: CompositionHookContextUpdateOptions, callback?: (error: Error | null, item?: CompositionHookInstance) => any): Promise<CompositionHookInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CompositionHookContextSolution { sid: string; } export declare class CompositionHookContextImpl implements CompositionHookContext { protected _version: V1; protected _solution: CompositionHookContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CompositionHookInstance) => any): Promise<CompositionHookInstance>; update(params: CompositionHookContextUpdateOptions, callback?: (error: Error | null, item?: CompositionHookInstance) => any): Promise<CompositionHookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CompositionHookContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CompositionHookPayload extends TwilioResponsePayload { composition_hooks: CompositionHookResource[]; } interface CompositionHookResource { account_sid: string; friendly_name: string; enabled: boolean; date_created: Date; date_updated: Date; sid: string; audio_sources: Array<string>; audio_sources_excluded: Array<string>; video_layout: any; resolution: string; trim: boolean; format: CompositionHookFormat; status_callback: string; status_callback_method: string; url: string; } export declare class CompositionHookInstance { protected _version: V1; protected _solution: CompositionHookContextSolution; protected _context?: CompositionHookContext; constructor(_version: V1, payload: CompositionHookResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionHook resource. */ accountSid: string; /** * The string that you assigned to describe the resource. Can be up to 100 characters long and must be unique within the account. */ friendlyName: string; /** * Whether the CompositionHook is active. When `true`, the CompositionHook is triggered for every completed Group Room on the account. When `false`, the CompositionHook is never triggered. */ enabled: boolean; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The unique string that we created to identify the CompositionHook resource. */ sid: string; /** * The array of track names to include in the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request */ audioSources: Array<string>; /** * The array of track names to exclude from the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. */ audioSourcesExcluded: Array<string>; /** * A JSON object that describes the video layout of the composition in terms of regions as specified in the HTTP POST request that created the CompositionHook resource. See [POST Parameters](https://www.twilio.com/docs/video/api/compositions-resource#http-post-parameters) for more information. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request */ videoLayout: any; /** * The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string\'s format is `{width}x{height}`, such as `640x480`. */ resolution: string; /** * Whether intervals with no media are clipped, as specified in the POST request that created the CompositionHook resource. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ trim: boolean; format: CompositionHookFormat; /** * The URL we call using the `status_callback_method` to send status information to your application. */ statusCallback: string; /** * The HTTP method we should use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. */ statusCallbackMethod: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a CompositionHookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CompositionHookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionHookInstance */ fetch(callback?: (error: Error | null, item?: CompositionHookInstance) => any): Promise<CompositionHookInstance>; /** * Update a CompositionHookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionHookInstance */ update(params: CompositionHookContextUpdateOptions, callback?: (error: Error | null, item?: CompositionHookInstance) => any): Promise<CompositionHookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; friendlyName: string; enabled: boolean; dateCreated: Date; dateUpdated: Date; sid: string; audioSources: string[]; audioSourcesExcluded: string[]; videoLayout: any; resolution: string; trim: boolean; format: CompositionHookFormat; statusCallback: string; statusCallbackMethod: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CompositionHookSolution { } export interface CompositionHookListInstance { _version: V1; _solution: CompositionHookSolution; _uri: string; (sid: string): CompositionHookContext; get(sid: string): CompositionHookContext; /** * Create a CompositionHookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionHookInstance */ create(params: CompositionHookListInstanceCreateOptions, callback?: (error: Error | null, item?: CompositionHookInstance) => any): Promise<CompositionHookInstance>; /** * Streams CompositionHookInstance 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 { CompositionHookListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CompositionHookInstance, done: (err?: Error) => void) => void): void; each(params: CompositionHookListInstanceEachOptions, callback?: (item: CompositionHookInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CompositionHookInstance 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: CompositionHookPage) => any): Promise<CompositionHookPage>; /** * Lists CompositionHookInstance 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 { CompositionHookListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CompositionHookInstance[]) => any): Promise<CompositionHookInstance[]>; list(params: CompositionHookListInstanceOptions, callback?: (error: Error | null, items: CompositionHookInstance[]) => any): Promise<CompositionHookInstance[]>; /** * Retrieve a single page of CompositionHookInstance 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 { CompositionHookListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CompositionHookPage) => any): Promise<CompositionHookPage>; page(params: CompositionHookListInstancePageOptions, callback?: (error: Error | null, items: CompositionHookPage) => any): Promise<CompositionHookPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CompositionHookListInstance(version: V1): CompositionHookListInstance; export declare class CompositionHookPage extends Page<V1, CompositionHookPayload, CompositionHookResource, CompositionHookInstance> { /** * Initialize the CompositionHookPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CompositionHookSolution); /** * Build an instance of CompositionHookInstance * * @param payload - Payload response from the API */ getInstance(payload: CompositionHookResource): CompositionHookInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/video/v1/room.d.ts000064400000046164151677225100010744 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { ParticipantListInstance } from "./room/participant"; import { RecordingRulesListInstance } from "./room/recordingRules"; import { RoomRecordingListInstance } from "./room/roomRecording"; export type RoomRoomStatus = "in-progress" | "completed" | "failed"; export type RoomRoomType = "go" | "peer-to-peer" | "group" | "group-small"; export type RoomVideoCodec = "VP8" | "H264"; /** * Options to pass to update a RoomInstance */ export interface RoomContextUpdateOptions { /** */ status: RoomRoomStatus; } /** * Options to pass to create a RoomInstance */ export interface RoomListInstanceCreateOptions { /** Deprecated, now always considered to be true. */ enableTurn?: boolean; /** */ type?: RoomRoomType; /** An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource\\\'s `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. */ uniqueName?: string; /** The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. */ statusCallbackMethod?: string; /** The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. */ maxParticipants?: number; /** Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** */ recordParticipantsOnConnect?: boolean; /** An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** */ videoCodecs?: Array<RoomVideoCodec>; /** The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** */ mediaRegion?: string; /** A collection of Recording Rules that describe how to include or exclude matching tracks for recording */ recordingRules?: any; /** When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. */ audioOnly?: boolean; /** The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). */ maxParticipantDuration?: number; /** Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). */ emptyRoomTimeout?: number; /** Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions). */ unusedRoomTimeout?: number; /** When set to true, indicated that this is the large room. */ largeRoom?: boolean; } /** * Options to pass to each */ export interface RoomListInstanceEachOptions { /** Read only the rooms with this status. Can be: `in-progress` (default) or `completed` */ status?: RoomRoomStatus; /** Read only rooms with the this `unique_name`. */ uniqueName?: string; /** Read only rooms that started on or after this date, given as `YYYY-MM-DD`. */ dateCreatedAfter?: Date; /** Read only rooms that started before this date, given as `YYYY-MM-DD`. */ dateCreatedBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: RoomInstance, 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 RoomListInstanceOptions { /** Read only the rooms with this status. Can be: `in-progress` (default) or `completed` */ status?: RoomRoomStatus; /** Read only rooms with the this `unique_name`. */ uniqueName?: string; /** Read only rooms that started on or after this date, given as `YYYY-MM-DD`. */ dateCreatedAfter?: Date; /** Read only rooms that started before this date, given as `YYYY-MM-DD`. */ dateCreatedBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface RoomListInstancePageOptions { /** Read only the rooms with this status. Can be: `in-progress` (default) or `completed` */ status?: RoomRoomStatus; /** Read only rooms with the this `unique_name`. */ uniqueName?: string; /** Read only rooms that started on or after this date, given as `YYYY-MM-DD`. */ dateCreatedAfter?: Date; /** Read only rooms that started before this date, given as `YYYY-MM-DD`. */ dateCreatedBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface RoomContext { participants: ParticipantListInstance; recordingRules: RecordingRulesListInstance; recordings: RoomRecordingListInstance; /** * Fetch a RoomInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ fetch(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Update a RoomInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ update(params: RoomContextUpdateOptions, callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RoomContextSolution { sid: string; } export declare class RoomContextImpl implements RoomContext { protected _version: V1; protected _solution: RoomContextSolution; protected _uri: string; protected _participants?: ParticipantListInstance; protected _recordingRules?: RecordingRulesListInstance; protected _recordings?: RoomRecordingListInstance; constructor(_version: V1, sid: string); get participants(): ParticipantListInstance; get recordingRules(): RecordingRulesListInstance; get recordings(): RoomRecordingListInstance; fetch(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; update(params: RoomContextUpdateOptions, callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RoomContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RoomPayload extends TwilioResponsePayload { rooms: RoomResource[]; } interface RoomResource { sid: string; status: RoomRoomStatus; date_created: Date; date_updated: Date; account_sid: string; enable_turn: boolean; unique_name: string; status_callback: string; status_callback_method: string; end_time: Date; duration: number; type: RoomRoomType; max_participants: number; max_participant_duration: number; max_concurrent_published_tracks: number; record_participants_on_connect: boolean; video_codecs: Array<RoomVideoCodec>; media_region: string; audio_only: boolean; empty_room_timeout: number; unused_room_timeout: number; large_room: boolean; url: string; links: Record<string, string>; } export declare class RoomInstance { protected _version: V1; protected _solution: RoomContextSolution; protected _context?: RoomContext; constructor(_version: V1, payload: RoomResource, sid?: string); /** * The unique string that we created to identify the Room resource. */ sid: string; status: RoomRoomStatus; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. */ accountSid: string; /** * Deprecated, now always considered to be true. */ enableTurn: boolean; /** * An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource\'s `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. */ uniqueName: string; /** * The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. */ statusCallback: string; /** * The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. */ statusCallbackMethod: string; /** * The UTC end time of the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ endTime: Date; /** * The duration of the room in seconds. */ duration: number; type: RoomRoomType; /** * The maximum number of concurrent Participants allowed in the room. */ maxParticipants: number; /** * The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). */ maxParticipantDuration: number; /** * The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](https://www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained. */ maxConcurrentPublishedTracks: number; /** * Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** */ recordParticipantsOnConnect: boolean; /** * An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** */ videoCodecs: Array<RoomVideoCodec>; /** * The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** */ mediaRegion: string; /** * When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. */ audioOnly: boolean; /** * Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. */ emptyRoomTimeout: number; /** * Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. */ unusedRoomTimeout: number; /** * Indicates if this is a large room. */ largeRoom: boolean; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a RoomInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ fetch(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Update a RoomInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ update(params: RoomContextUpdateOptions, callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Access the participants. */ participants(): ParticipantListInstance; /** * Access the recordingRules. */ recordingRules(): RecordingRulesListInstance; /** * Access the recordings. */ recordings(): RoomRecordingListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; status: RoomRoomStatus; dateCreated: Date; dateUpdated: Date; accountSid: string; enableTurn: boolean; uniqueName: string; statusCallback: string; statusCallbackMethod: string; endTime: Date; duration: number; type: RoomRoomType; maxParticipants: number; maxParticipantDuration: number; maxConcurrentPublishedTracks: number; recordParticipantsOnConnect: boolean; videoCodecs: RoomVideoCodec[]; mediaRegion: string; audioOnly: boolean; emptyRoomTimeout: number; unusedRoomTimeout: number; largeRoom: boolean; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RoomSolution { } export interface RoomListInstance { _version: V1; _solution: RoomSolution; _uri: string; (sid: string): RoomContext; get(sid: string): RoomContext; /** * Create a RoomInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ create(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Create a RoomInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ create(params: RoomListInstanceCreateOptions, callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Streams RoomInstance 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 { RoomListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void; each(params: RoomListInstanceEachOptions, callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RoomInstance 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: RoomPage) => any): Promise<RoomPage>; /** * Lists RoomInstance 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 { RoomListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoomInstance[]) => any): Promise<RoomInstance[]>; list(params: RoomListInstanceOptions, callback?: (error: Error | null, items: RoomInstance[]) => any): Promise<RoomInstance[]>; /** * Retrieve a single page of RoomInstance 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 { RoomListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>; page(params: RoomListInstancePageOptions, callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RoomListInstance(version: V1): RoomListInstance; export declare class RoomPage extends Page<V1, RoomPayload, RoomResource, RoomInstance> { /** * Initialize the RoomPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RoomSolution); /** * Build an instance of RoomInstance * * @param payload - Payload response from the API */ getInstance(payload: RoomResource): RoomInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/video/v1/composition.d.ts000064400000044140151677225100012323 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type CompositionFormat = "mp4" | "webm"; export type CompositionStatus = "enqueued" | "processing" | "completed" | "deleted" | "failed"; /** * Options to pass to create a CompositionInstance */ export interface CompositionListInstanceCreateOptions { /** The SID of the Group Room with the media tracks to be used as composition sources. */ roomSid: string; /** An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request */ videoLayout?: any; /** An array of track names from the same group room to merge into the new composition. Can include zero or more track names. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` includes `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request */ audioSources?: Array<string>; /** An array of track names to exclude. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. */ audioSourcesExcluded?: Array<string>; /** A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string\\\'s format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ resolution?: string; /** */ format?: CompositionFormat; /** The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. */ statusCallbackMethod?: string; /** Whether to clip the intervals where there is no active media in the composition. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ trim?: boolean; } /** * Options to pass to each */ export interface CompositionListInstanceEachOptions { /** Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`. */ status?: CompositionStatus; /** Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. */ dateCreatedAfter?: Date; /** Read only Composition resources created before this ISO 8601 date-time with time zone. */ dateCreatedBefore?: Date; /** Read only Composition resources with this Room SID. */ roomSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CompositionInstance, 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 CompositionListInstanceOptions { /** Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`. */ status?: CompositionStatus; /** Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. */ dateCreatedAfter?: Date; /** Read only Composition resources created before this ISO 8601 date-time with time zone. */ dateCreatedBefore?: Date; /** Read only Composition resources with this Room SID. */ roomSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CompositionListInstancePageOptions { /** Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`. */ status?: CompositionStatus; /** Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. */ dateCreatedAfter?: Date; /** Read only Composition resources created before this ISO 8601 date-time with time zone. */ dateCreatedBefore?: Date; /** Read only Composition resources with this Room SID. */ roomSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CompositionContext { /** * Remove a CompositionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CompositionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionInstance */ fetch(callback?: (error: Error | null, item?: CompositionInstance) => any): Promise<CompositionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CompositionContextSolution { sid: string; } export declare class CompositionContextImpl implements CompositionContext { protected _version: V1; protected _solution: CompositionContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CompositionInstance) => any): Promise<CompositionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CompositionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CompositionPayload extends TwilioResponsePayload { compositions: CompositionResource[]; } interface CompositionResource { account_sid: string; status: CompositionStatus; date_created: Date; date_completed: Date; date_deleted: Date; sid: string; room_sid: string; audio_sources: Array<string>; audio_sources_excluded: Array<string>; video_layout: any; resolution: string; trim: boolean; format: CompositionFormat; bitrate: number; size: number; duration: number; media_external_location: string; status_callback: string; status_callback_method: string; url: string; links: Record<string, string>; } export declare class CompositionInstance { protected _version: V1; protected _solution: CompositionContextSolution; protected _context?: CompositionContext; constructor(_version: V1, payload: CompositionResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Composition resource. */ accountSid: string; status: CompositionStatus; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the composition\'s media processing task finished, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCompleted: Date; /** * The date and time in GMT when the composition generated media was deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateDeleted: Date; /** * The unique string that we created to identify the Composition resource. */ sid: string; /** * The SID of the Group Room that generated the audio and video tracks used in the composition. All media sources included in a composition must belong to the same Group Room. */ roomSid: string; /** * The array of track names to include in the composition. The composition includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. */ audioSources: Array<string>; /** * The array of track names to exclude from the composition. The composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. */ audioSourcesExcluded: Array<string>; /** * An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ videoLayout: any; /** * The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string\'s format is `{width}x{height}`, such as `640x480`. */ resolution: string; /** * Whether to remove intervals with no media, as specified in the POST request that created the composition. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. */ trim: boolean; format: CompositionFormat; /** * The average bit rate of the composition\'s media. */ bitrate: number; /** * The size of the composed media file in bytes. */ size: number; /** * The duration of the composition\'s media file in seconds. */ duration: number; /** * The URL of the media file associated with the composition when stored externally. See [External S3 Compositions](/docs/video/api/external-s3-compositions) for more details. */ mediaExternalLocation: string; /** * The URL called using the `status_callback_method` to send status information on every composition event. */ statusCallback: string; /** * The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. */ statusCallbackMethod: string; /** * The absolute URL of the resource. */ url: string; /** * The URL of the media file associated with the composition. */ links: Record<string, string>; private get _proxy(); /** * Remove a CompositionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CompositionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionInstance */ fetch(callback?: (error: Error | null, item?: CompositionInstance) => any): Promise<CompositionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; status: CompositionStatus; dateCreated: Date; dateCompleted: Date; dateDeleted: Date; sid: string; roomSid: string; audioSources: string[]; audioSourcesExcluded: string[]; videoLayout: any; resolution: string; trim: boolean; format: CompositionFormat; bitrate: number; size: number; duration: number; mediaExternalLocation: string; statusCallback: string; statusCallbackMethod: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CompositionSolution { } export interface CompositionListInstance { _version: V1; _solution: CompositionSolution; _uri: string; (sid: string): CompositionContext; get(sid: string): CompositionContext; /** * Create a CompositionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionInstance */ create(params: CompositionListInstanceCreateOptions, callback?: (error: Error | null, item?: CompositionInstance) => any): Promise<CompositionInstance>; /** * Streams CompositionInstance 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 { CompositionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CompositionInstance, done: (err?: Error) => void) => void): void; each(params: CompositionListInstanceEachOptions, callback?: (item: CompositionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CompositionInstance 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: CompositionPage) => any): Promise<CompositionPage>; /** * Lists CompositionInstance 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 { CompositionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CompositionInstance[]) => any): Promise<CompositionInstance[]>; list(params: CompositionListInstanceOptions, callback?: (error: Error | null, items: CompositionInstance[]) => any): Promise<CompositionInstance[]>; /** * Retrieve a single page of CompositionInstance 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 { CompositionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CompositionPage) => any): Promise<CompositionPage>; page(params: CompositionListInstancePageOptions, callback?: (error: Error | null, items: CompositionPage) => any): Promise<CompositionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CompositionListInstance(version: V1): CompositionListInstance; export declare class CompositionPage extends Page<V1, CompositionPayload, CompositionResource, CompositionInstance> { /** * Initialize the CompositionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CompositionSolution); /** * Build an instance of CompositionInstance * * @param payload - Payload response from the API */ getInstance(payload: CompositionResource): CompositionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/video/v1/composition.js000064400000025351151677225100012072 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.CompositionPage = exports.CompositionListInstance = exports.CompositionInstance = exports.CompositionContextImpl = void 0; 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 CompositionContextImpl { 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 = `/Compositions/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CompositionInstance(operationVersion, payload, 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.CompositionContextImpl = CompositionContextImpl; class CompositionInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.status = payload.status; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateCompleted = deserialize.iso8601DateTime(payload.date_completed); this.dateDeleted = deserialize.iso8601DateTime(payload.date_deleted); this.sid = payload.sid; this.roomSid = payload.room_sid; this.audioSources = payload.audio_sources; this.audioSourcesExcluded = payload.audio_sources_excluded; this.videoLayout = payload.video_layout; this.resolution = payload.resolution; this.trim = payload.trim; this.format = payload.format; this.bitrate = deserialize.integer(payload.bitrate); this.size = payload.size; this.duration = deserialize.integer(payload.duration); this.mediaExternalLocation = payload.media_external_location; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CompositionContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CompositionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CompositionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, status: this.status, dateCreated: this.dateCreated, dateCompleted: this.dateCompleted, dateDeleted: this.dateDeleted, sid: this.sid, roomSid: this.roomSid, audioSources: this.audioSources, audioSourcesExcluded: this.audioSourcesExcluded, videoLayout: this.videoLayout, resolution: this.resolution, trim: this.trim, format: this.format, bitrate: this.bitrate, size: this.size, duration: this.duration, mediaExternalLocation: this.mediaExternalLocation, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CompositionInstance = CompositionInstance; function CompositionListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CompositionContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Compositions`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["roomSid"] === null || params["roomSid"] === undefined) { throw new Error("Required parameter \"params['roomSid']\" missing."); } let data = {}; data["RoomSid"] = params["roomSid"]; if (params["videoLayout"] !== undefined) data["VideoLayout"] = serialize.object(params["videoLayout"]); if (params["audioSources"] !== undefined) data["AudioSources"] = serialize.map(params["audioSources"], (e) => e); if (params["audioSourcesExcluded"] !== undefined) data["AudioSourcesExcluded"] = serialize.map(params["audioSourcesExcluded"], (e) => e); if (params["resolution"] !== undefined) data["Resolution"] = params["resolution"]; if (params["format"] !== undefined) data["Format"] = params["format"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["trim"] !== undefined) data["Trim"] = serialize.bool(params["trim"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CompositionInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); if (params["roomSid"] !== undefined) data["RoomSid"] = params["roomSid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CompositionPage(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 CompositionPage(instance._version, payload, 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; } exports.CompositionListInstance = CompositionListInstance; class CompositionPage extends Page_1.default { /** * Initialize the CompositionPage * * @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 CompositionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CompositionInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CompositionPage = CompositionPage; rest/video/v1/compositionHook.js000064400000031203151677225100012704 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.CompositionHookPage = exports.CompositionHookListInstance = exports.CompositionHookInstance = exports.CompositionHookContextImpl = void 0; 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 CompositionHookContextImpl { 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 = `/CompositionHooks/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CompositionHookInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); if (params["videoLayout"] !== undefined) data["VideoLayout"] = serialize.object(params["videoLayout"]); if (params["audioSources"] !== undefined) data["AudioSources"] = serialize.map(params["audioSources"], (e) => e); if (params["audioSourcesExcluded"] !== undefined) data["AudioSourcesExcluded"] = serialize.map(params["audioSourcesExcluded"], (e) => e); if (params["trim"] !== undefined) data["Trim"] = serialize.bool(params["trim"]); if (params["format"] !== undefined) data["Format"] = params["format"]; if (params["resolution"] !== undefined) data["Resolution"] = params["resolution"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CompositionHookInstance(operationVersion, payload, 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.CompositionHookContextImpl = CompositionHookContextImpl; class CompositionHookInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.enabled = payload.enabled; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sid = payload.sid; this.audioSources = payload.audio_sources; this.audioSourcesExcluded = payload.audio_sources_excluded; this.videoLayout = payload.video_layout; this.resolution = payload.resolution; this.trim = payload.trim; this.format = payload.format; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CompositionHookContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CompositionHookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CompositionHookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CompositionHookInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, friendlyName: this.friendlyName, enabled: this.enabled, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sid: this.sid, audioSources: this.audioSources, audioSourcesExcluded: this.audioSourcesExcluded, videoLayout: this.videoLayout, resolution: this.resolution, trim: this.trim, format: this.format, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CompositionHookInstance = CompositionHookInstance; function CompositionHookListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CompositionHookContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/CompositionHooks`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); if (params["videoLayout"] !== undefined) data["VideoLayout"] = serialize.object(params["videoLayout"]); if (params["audioSources"] !== undefined) data["AudioSources"] = serialize.map(params["audioSources"], (e) => e); if (params["audioSourcesExcluded"] !== undefined) data["AudioSourcesExcluded"] = serialize.map(params["audioSourcesExcluded"], (e) => e); if (params["resolution"] !== undefined) data["Resolution"] = params["resolution"]; if (params["format"] !== undefined) data["Format"] = params["format"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["trim"] !== undefined) data["Trim"] = serialize.bool(params["trim"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CompositionHookInstance(operationVersion, payload)); 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["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CompositionHookPage(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 CompositionHookPage(instance._version, payload, 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; } exports.CompositionHookListInstance = CompositionHookListInstance; class CompositionHookPage extends Page_1.default { /** * Initialize the CompositionHookPage * * @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 CompositionHookInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CompositionHookInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CompositionHookPage = CompositionHookPage; rest/video/v1/room/recordingRules.js000064400000007467151677225100013502 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.RecordingRulesInstance = exports.RecordingRulesListInstance = exports.VideoV1RoomRoomRecordingRuleRules = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class VideoV1RoomRoomRecordingRuleRules { } exports.VideoV1RoomRoomRecordingRuleRules = VideoV1RoomRoomRecordingRuleRules; function RecordingRulesListInstance(version, roomSid) { if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { roomSid }; instance._uri = `/Rooms/${roomSid}/RecordingRules`; instance.fetch = function fetch(callback) { let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RecordingRulesInstance(operationVersion, payload, instance._solution.roomSid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.update = function update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["rules"] !== undefined) data["Rules"] = serialize.object(params["rules"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingRulesInstance(operationVersion, payload, instance._solution.roomSid)); 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; } exports.RecordingRulesListInstance = RecordingRulesListInstance; class RecordingRulesInstance { constructor(_version, payload, roomSid) { this._version = _version; this.roomSid = payload.room_sid; this.rules = payload.rules; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { roomSid: this.roomSid, rules: this.rules, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingRulesInstance = RecordingRulesInstance; rest/video/v1/room/participant/subscribedTrack.js000064400000017437151677225100016141 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.SubscribedTrackPage = exports.SubscribedTrackListInstance = exports.SubscribedTrackInstance = exports.SubscribedTrackContextImpl = void 0; 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 SubscribedTrackContextImpl { constructor(_version, roomSid, participantSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(participantSid)) { throw new Error("Parameter 'participantSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { roomSid, participantSid, sid }; this._uri = `/Rooms/${roomSid}/Participants/${participantSid}/SubscribedTracks/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SubscribedTrackInstance(operationVersion, payload, instance._solution.roomSid, instance._solution.participantSid, 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.SubscribedTrackContextImpl = SubscribedTrackContextImpl; class SubscribedTrackInstance { constructor(_version, payload, roomSid, participantSid, sid) { this._version = _version; this.sid = payload.sid; this.participantSid = payload.participant_sid; this.publisherSid = payload.publisher_sid; this.roomSid = payload.room_sid; this.name = payload.name; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.enabled = payload.enabled; this.kind = payload.kind; this.url = payload.url; this._solution = { roomSid, participantSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SubscribedTrackContextImpl(this._version, this._solution.roomSid, this._solution.participantSid, this._solution.sid); return this._context; } /** * Fetch a SubscribedTrackInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedTrackInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, participantSid: this.participantSid, publisherSid: this.publisherSid, roomSid: this.roomSid, name: this.name, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, enabled: this.enabled, kind: this.kind, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SubscribedTrackInstance = SubscribedTrackInstance; function SubscribedTrackListInstance(version, roomSid, participantSid) { if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(participantSid)) { throw new Error("Parameter 'participantSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SubscribedTrackContextImpl(version, roomSid, participantSid, sid); }; instance._version = version; instance._solution = { roomSid, participantSid }; instance._uri = `/Rooms/${roomSid}/Participants/${participantSid}/SubscribedTracks`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SubscribedTrackPage(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 SubscribedTrackPage(instance._version, payload, 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; } exports.SubscribedTrackListInstance = SubscribedTrackListInstance; class SubscribedTrackPage extends Page_1.default { /** * Initialize the SubscribedTrackPage * * @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 SubscribedTrackInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SubscribedTrackInstance(this._version, payload, this._solution.roomSid, this._solution.participantSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SubscribedTrackPage = SubscribedTrackPage; rest/video/v1/room/participant/subscribedTrack.d.ts000064400000022314151677225100016363 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type SubscribedTrackKind = "audio" | "video" | "data"; /** * Options to pass to each */ export interface SubscribedTrackListInstanceEachOptions { /** 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: SubscribedTrackInstance, 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 SubscribedTrackListInstanceOptions { /** 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 SubscribedTrackListInstancePageOptions { /** 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 SubscribedTrackContext { /** * Fetch a SubscribedTrackInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedTrackInstance */ fetch(callback?: (error: Error | null, item?: SubscribedTrackInstance) => any): Promise<SubscribedTrackInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SubscribedTrackContextSolution { roomSid: string; participantSid: string; sid: string; } export declare class SubscribedTrackContextImpl implements SubscribedTrackContext { protected _version: V1; protected _solution: SubscribedTrackContextSolution; protected _uri: string; constructor(_version: V1, roomSid: string, participantSid: string, sid: string); fetch(callback?: (error: Error | null, item?: SubscribedTrackInstance) => any): Promise<SubscribedTrackInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SubscribedTrackContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SubscribedTrackPayload extends TwilioResponsePayload { subscribed_tracks: SubscribedTrackResource[]; } interface SubscribedTrackResource { sid: string; participant_sid: string; publisher_sid: string; room_sid: string; name: string; date_created: Date; date_updated: Date; enabled: boolean; kind: SubscribedTrackKind; url: string; } export declare class SubscribedTrackInstance { protected _version: V1; protected _solution: SubscribedTrackContextSolution; protected _context?: SubscribedTrackContext; constructor(_version: V1, payload: SubscribedTrackResource, roomSid: string, participantSid: string, sid?: string); /** * The unique string that we created to identify the RoomParticipantSubscribedTrack resource. */ sid: string; /** * The SID of the participant that subscribes to the track. */ participantSid: string; /** * The SID of the participant that publishes the track. */ publisherSid: string; /** * The SID of the room where the track is published. */ roomSid: string; /** * The track name. Must have no more than 128 characters and be unique among the participant\'s published tracks. */ name: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * Whether the track is enabled. */ enabled: boolean; kind: SubscribedTrackKind; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a SubscribedTrackInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedTrackInstance */ fetch(callback?: (error: Error | null, item?: SubscribedTrackInstance) => any): Promise<SubscribedTrackInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; participantSid: string; publisherSid: string; roomSid: string; name: string; dateCreated: Date; dateUpdated: Date; enabled: boolean; kind: SubscribedTrackKind; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SubscribedTrackSolution { roomSid: string; participantSid: string; } export interface SubscribedTrackListInstance { _version: V1; _solution: SubscribedTrackSolution; _uri: string; (sid: string): SubscribedTrackContext; get(sid: string): SubscribedTrackContext; /** * Streams SubscribedTrackInstance 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 { SubscribedTrackListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SubscribedTrackInstance, done: (err?: Error) => void) => void): void; each(params: SubscribedTrackListInstanceEachOptions, callback?: (item: SubscribedTrackInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SubscribedTrackInstance 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: SubscribedTrackPage) => any): Promise<SubscribedTrackPage>; /** * Lists SubscribedTrackInstance 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 { SubscribedTrackListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SubscribedTrackInstance[]) => any): Promise<SubscribedTrackInstance[]>; list(params: SubscribedTrackListInstanceOptions, callback?: (error: Error | null, items: SubscribedTrackInstance[]) => any): Promise<SubscribedTrackInstance[]>; /** * Retrieve a single page of SubscribedTrackInstance 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 { SubscribedTrackListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SubscribedTrackPage) => any): Promise<SubscribedTrackPage>; page(params: SubscribedTrackListInstancePageOptions, callback?: (error: Error | null, items: SubscribedTrackPage) => any): Promise<SubscribedTrackPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SubscribedTrackListInstance(version: V1, roomSid: string, participantSid: string): SubscribedTrackListInstance; export declare class SubscribedTrackPage extends Page<V1, SubscribedTrackPayload, SubscribedTrackResource, SubscribedTrackInstance> { /** * Initialize the SubscribedTrackPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SubscribedTrackSolution); /** * Build an instance of SubscribedTrackInstance * * @param payload - Payload response from the API */ getInstance(payload: SubscribedTrackResource): SubscribedTrackInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/video/v1/room/participant/anonymize.js000064400000011547151677225100015034 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.AnonymizeListInstance = exports.AnonymizeInstance = exports.AnonymizeContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class AnonymizeContextImpl { constructor(_version, roomSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { roomSid, sid }; this._uri = `/Rooms/${roomSid}/Participants/${sid}/Anonymize`; } update(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", }); operationPromise = operationPromise.then((payload) => new AnonymizeInstance(operationVersion, payload, instance._solution.roomSid, 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.AnonymizeContextImpl = AnonymizeContextImpl; class AnonymizeInstance { constructor(_version, payload, roomSid, sid) { this._version = _version; this.sid = payload.sid; this.roomSid = payload.room_sid; this.accountSid = payload.account_sid; this.status = payload.status; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.duration = deserialize.integer(payload.duration); this.url = payload.url; this._solution = { roomSid, sid }; } get _proxy() { this._context = this._context || new AnonymizeContextImpl(this._version, this._solution.roomSid, this._solution.sid); return this._context; } /** * Update a AnonymizeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AnonymizeInstance */ update(callback) { return this._proxy.update(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, roomSid: this.roomSid, accountSid: this.accountSid, status: this.status, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, startTime: this.startTime, endTime: this.endTime, duration: this.duration, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AnonymizeInstance = AnonymizeInstance; function AnonymizeListInstance(version, roomSid, sid) { if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new AnonymizeContextImpl(version, roomSid, sid); }; instance._version = version; instance._solution = { roomSid, sid }; 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; } exports.AnonymizeListInstance = AnonymizeListInstance; rest/video/v1/room/participant/publishedTrack.js000064400000017243151677225100015766 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.PublishedTrackPage = exports.PublishedTrackListInstance = exports.PublishedTrackInstance = exports.PublishedTrackContextImpl = void 0; 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 PublishedTrackContextImpl { constructor(_version, roomSid, participantSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(participantSid)) { throw new Error("Parameter 'participantSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { roomSid, participantSid, sid }; this._uri = `/Rooms/${roomSid}/Participants/${participantSid}/PublishedTracks/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PublishedTrackInstance(operationVersion, payload, instance._solution.roomSid, instance._solution.participantSid, 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.PublishedTrackContextImpl = PublishedTrackContextImpl; class PublishedTrackInstance { constructor(_version, payload, roomSid, participantSid, sid) { this._version = _version; this.sid = payload.sid; this.participantSid = payload.participant_sid; this.roomSid = payload.room_sid; this.name = payload.name; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.enabled = payload.enabled; this.kind = payload.kind; this.url = payload.url; this._solution = { roomSid, participantSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PublishedTrackContextImpl(this._version, this._solution.roomSid, this._solution.participantSid, this._solution.sid); return this._context; } /** * Fetch a PublishedTrackInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PublishedTrackInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, participantSid: this.participantSid, roomSid: this.roomSid, name: this.name, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, enabled: this.enabled, kind: this.kind, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PublishedTrackInstance = PublishedTrackInstance; function PublishedTrackListInstance(version, roomSid, participantSid) { if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(participantSid)) { throw new Error("Parameter 'participantSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PublishedTrackContextImpl(version, roomSid, participantSid, sid); }; instance._version = version; instance._solution = { roomSid, participantSid }; instance._uri = `/Rooms/${roomSid}/Participants/${participantSid}/PublishedTracks`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PublishedTrackPage(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 PublishedTrackPage(instance._version, payload, 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; } exports.PublishedTrackListInstance = PublishedTrackListInstance; class PublishedTrackPage extends Page_1.default { /** * Initialize the PublishedTrackPage * * @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 PublishedTrackInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PublishedTrackInstance(this._version, payload, this._solution.roomSid, this._solution.participantSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PublishedTrackPage = PublishedTrackPage; rest/video/v1/room/participant/anonymize.d.ts000064400000010561151677225100015263 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; export type AnonymizeStatus = "connected" | "disconnected"; export interface AnonymizeContext { /** * Update a AnonymizeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AnonymizeInstance */ update(callback?: (error: Error | null, item?: AnonymizeInstance) => any): Promise<AnonymizeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AnonymizeContextSolution { roomSid: string; sid: string; } export declare class AnonymizeContextImpl implements AnonymizeContext { protected _version: V1; protected _solution: AnonymizeContextSolution; protected _uri: string; constructor(_version: V1, roomSid: string, sid: string); update(callback?: (error: Error | null, item?: AnonymizeInstance) => any): Promise<AnonymizeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AnonymizeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AnonymizeResource { sid: string; room_sid: string; account_sid: string; status: AnonymizeStatus; identity: string; date_created: Date; date_updated: Date; start_time: Date; end_time: Date; duration: number; url: string; } export declare class AnonymizeInstance { protected _version: V1; protected _solution: AnonymizeContextSolution; protected _context?: AnonymizeContext; constructor(_version: V1, payload: AnonymizeResource, roomSid: string, sid: string); /** * The unique string that we created to identify the RoomParticipant resource. */ sid: string; /** * The SID of the participant\'s room. */ roomSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. */ accountSid: string; status: AnonymizeStatus; /** * The SID of the participant. */ identity: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ startTime: Date; /** * The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ endTime: Date; /** * The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. */ duration: number; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Update a AnonymizeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AnonymizeInstance */ update(callback?: (error: Error | null, item?: AnonymizeInstance) => any): Promise<AnonymizeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; roomSid: string; accountSid: string; status: AnonymizeStatus; identity: string; dateCreated: Date; dateUpdated: Date; startTime: Date; endTime: Date; duration: number; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AnonymizeSolution { roomSid: string; sid: string; } export interface AnonymizeListInstance { _version: V1; _solution: AnonymizeSolution; _uri: string; (): AnonymizeContext; get(): AnonymizeContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AnonymizeListInstance(version: V1, roomSid: string, sid: string): AnonymizeListInstance; export {}; rest/video/v1/room/participant/publishedTrack.d.ts000064400000021763151677225100016224 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type PublishedTrackKind = "audio" | "video" | "data"; /** * Options to pass to each */ export interface PublishedTrackListInstanceEachOptions { /** 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: PublishedTrackInstance, 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 PublishedTrackListInstanceOptions { /** 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 PublishedTrackListInstancePageOptions { /** 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 PublishedTrackContext { /** * Fetch a PublishedTrackInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PublishedTrackInstance */ fetch(callback?: (error: Error | null, item?: PublishedTrackInstance) => any): Promise<PublishedTrackInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PublishedTrackContextSolution { roomSid: string; participantSid: string; sid: string; } export declare class PublishedTrackContextImpl implements PublishedTrackContext { protected _version: V1; protected _solution: PublishedTrackContextSolution; protected _uri: string; constructor(_version: V1, roomSid: string, participantSid: string, sid: string); fetch(callback?: (error: Error | null, item?: PublishedTrackInstance) => any): Promise<PublishedTrackInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PublishedTrackContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PublishedTrackPayload extends TwilioResponsePayload { published_tracks: PublishedTrackResource[]; } interface PublishedTrackResource { sid: string; participant_sid: string; room_sid: string; name: string; date_created: Date; date_updated: Date; enabled: boolean; kind: PublishedTrackKind; url: string; } export declare class PublishedTrackInstance { protected _version: V1; protected _solution: PublishedTrackContextSolution; protected _context?: PublishedTrackContext; constructor(_version: V1, payload: PublishedTrackResource, roomSid: string, participantSid: string, sid?: string); /** * The unique string that we created to identify the RoomParticipantPublishedTrack resource. */ sid: string; /** * The SID of the Participant resource with the published track. */ participantSid: string; /** * The SID of the Room resource where the track is published. */ roomSid: string; /** * The track name. Must be no more than 128 characters, and be unique among the participant\'s published tracks. */ name: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * Whether the track is enabled. */ enabled: boolean; kind: PublishedTrackKind; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a PublishedTrackInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PublishedTrackInstance */ fetch(callback?: (error: Error | null, item?: PublishedTrackInstance) => any): Promise<PublishedTrackInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; participantSid: string; roomSid: string; name: string; dateCreated: Date; dateUpdated: Date; enabled: boolean; kind: PublishedTrackKind; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PublishedTrackSolution { roomSid: string; participantSid: string; } export interface PublishedTrackListInstance { _version: V1; _solution: PublishedTrackSolution; _uri: string; (sid: string): PublishedTrackContext; get(sid: string): PublishedTrackContext; /** * Streams PublishedTrackInstance 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 { PublishedTrackListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PublishedTrackInstance, done: (err?: Error) => void) => void): void; each(params: PublishedTrackListInstanceEachOptions, callback?: (item: PublishedTrackInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PublishedTrackInstance 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: PublishedTrackPage) => any): Promise<PublishedTrackPage>; /** * Lists PublishedTrackInstance 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 { PublishedTrackListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PublishedTrackInstance[]) => any): Promise<PublishedTrackInstance[]>; list(params: PublishedTrackListInstanceOptions, callback?: (error: Error | null, items: PublishedTrackInstance[]) => any): Promise<PublishedTrackInstance[]>; /** * Retrieve a single page of PublishedTrackInstance 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 { PublishedTrackListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PublishedTrackPage) => any): Promise<PublishedTrackPage>; page(params: PublishedTrackListInstancePageOptions, callback?: (error: Error | null, items: PublishedTrackPage) => any): Promise<PublishedTrackPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PublishedTrackListInstance(version: V1, roomSid: string, participantSid: string): PublishedTrackListInstance; export declare class PublishedTrackPage extends Page<V1, PublishedTrackPayload, PublishedTrackResource, PublishedTrackInstance> { /** * Initialize the PublishedTrackPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: PublishedTrackSolution); /** * Build an instance of PublishedTrackInstance * * @param payload - Payload response from the API */ getInstance(payload: PublishedTrackResource): PublishedTrackInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/video/v1/room/participant/subscribeRules.js000064400000010454151677225100016013 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.SubscribeRulesInstance = exports.SubscribeRulesListInstance = exports.VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules { } exports.VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules = VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules; function SubscribeRulesListInstance(version, roomSid, participantSid) { if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(participantSid)) { throw new Error("Parameter 'participantSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { roomSid, participantSid }; instance._uri = `/Rooms/${roomSid}/Participants/${participantSid}/SubscribeRules`; instance.fetch = function fetch(callback) { let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SubscribeRulesInstance(operationVersion, payload, instance._solution.roomSid, instance._solution.participantSid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.update = function update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["rules"] !== undefined) data["Rules"] = serialize.object(params["rules"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SubscribeRulesInstance(operationVersion, payload, instance._solution.roomSid, instance._solution.participantSid)); 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; } exports.SubscribeRulesListInstance = SubscribeRulesListInstance; class SubscribeRulesInstance { constructor(_version, payload, roomSid, participantSid) { this._version = _version; this.participantSid = payload.participant_sid; this.roomSid = payload.room_sid; this.rules = payload.rules; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { participantSid: this.participantSid, roomSid: this.roomSid, rules: this.rules, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SubscribeRulesInstance = SubscribeRulesInstance; rest/video/v1/room/participant/subscribeRules.d.ts000064400000007412151677225100016247 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; export declare class VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules { "type"?: string; "all"?: boolean; "publisher"?: string; "track"?: string; "kind"?: string; "priority"?: string; } /** * Options to pass to update a SubscribeRulesInstance */ export interface SubscribeRulesListInstanceUpdateOptions { /** A JSON-encoded array of subscribe rules. See the [Specifying Subscribe Rules](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr) section for further information. */ rules?: any; } export interface SubscribeRulesSolution { roomSid: string; participantSid: string; } export interface SubscribeRulesListInstance { _version: V1; _solution: SubscribeRulesSolution; _uri: string; /** * Fetch a SubscribeRulesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribeRulesInstance */ fetch(callback?: (error: Error | null, item?: SubscribeRulesInstance) => any): Promise<SubscribeRulesInstance>; /** * Update a SubscribeRulesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribeRulesInstance */ update(callback?: (error: Error | null, item?: SubscribeRulesInstance) => any): Promise<SubscribeRulesInstance>; /** * Update a SubscribeRulesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribeRulesInstance */ update(params: SubscribeRulesListInstanceUpdateOptions, callback?: (error: Error | null, item?: SubscribeRulesInstance) => any): Promise<SubscribeRulesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SubscribeRulesListInstance(version: V1, roomSid: string, participantSid: string): SubscribeRulesListInstance; interface SubscribeRulesResource { participant_sid: string; room_sid: string; rules: Array<VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules>; date_created: Date; date_updated: Date; } export declare class SubscribeRulesInstance { protected _version: V1; constructor(_version: V1, payload: SubscribeRulesResource, roomSid: string, participantSid: string); /** * The SID of the Participant resource for the Subscribe Rules. */ participantSid: string; /** * The SID of the Room resource for the Subscribe Rules */ roomSid: string; /** * A collection of Subscribe Rules that describe how to include or exclude matching tracks. See the [Specifying Subscribe Rules](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr) section for further information. */ rules: Array<VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules>; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { participantSid: string; roomSid: string; rules: VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules[]; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/video/v1/room/participant.js000064400000025067151677225100013025 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.ParticipantPage = exports.ParticipantListInstance = exports.ParticipantInstance = exports.ParticipantContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const anonymize_1 = require("./participant/anonymize"); const publishedTrack_1 = require("./participant/publishedTrack"); const subscribeRules_1 = require("./participant/subscribeRules"); const subscribedTrack_1 = require("./participant/subscribedTrack"); class ParticipantContextImpl { constructor(_version, roomSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { roomSid, sid }; this._uri = `/Rooms/${roomSid}/Participants/${sid}`; } get anonymize() { this._anonymize = this._anonymize || (0, anonymize_1.AnonymizeListInstance)(this._version, this._solution.roomSid, this._solution.sid); return this._anonymize; } get publishedTracks() { this._publishedTracks = this._publishedTracks || (0, publishedTrack_1.PublishedTrackListInstance)(this._version, this._solution.roomSid, this._solution.sid); return this._publishedTracks; } get subscribeRules() { this._subscribeRules = this._subscribeRules || (0, subscribeRules_1.SubscribeRulesListInstance)(this._version, this._solution.roomSid, this._solution.sid); return this._subscribeRules; } get subscribedTracks() { this._subscribedTracks = this._subscribedTracks || (0, subscribedTrack_1.SubscribedTrackListInstance)(this._version, this._solution.roomSid, this._solution.sid); return this._subscribedTracks; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.roomSid, 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["status"] !== undefined) data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.roomSid, 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.ParticipantContextImpl = ParticipantContextImpl; class ParticipantInstance { constructor(_version, payload, roomSid, sid) { this._version = _version; this.sid = payload.sid; this.roomSid = payload.room_sid; this.accountSid = payload.account_sid; this.status = payload.status; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.duration = deserialize.integer(payload.duration); this.url = payload.url; this.links = payload.links; this._solution = { roomSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ParticipantContextImpl(this._version, this._solution.roomSid, this._solution.sid); return this._context; } /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the anonymize. */ anonymize() { return this._proxy.anonymize; } /** * Access the publishedTracks. */ publishedTracks() { return this._proxy.publishedTracks; } /** * Access the subscribeRules. */ subscribeRules() { return this._proxy.subscribeRules; } /** * Access the subscribedTracks. */ subscribedTracks() { return this._proxy.subscribedTracks; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, roomSid: this.roomSid, accountSid: this.accountSid, status: this.status, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, startTime: this.startTime, endTime: this.endTime, duration: this.duration, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantInstance = ParticipantInstance; function ParticipantListInstance(version, roomSid) { if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ParticipantContextImpl(version, roomSid, sid); }; instance._version = version; instance._solution = { roomSid }; instance._uri = `/Rooms/${roomSid}/Participants`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["identity"] !== undefined) data["Identity"] = params["identity"]; if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantPage(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 ParticipantPage(instance._version, payload, 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; } exports.ParticipantListInstance = ParticipantListInstance; class ParticipantPage extends Page_1.default { /** * Initialize the ParticipantPage * * @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 ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ParticipantInstance(this._version, payload, this._solution.roomSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantPage = ParticipantPage; rest/video/v1/room/recordingRules.d.ts000064400000006174151677225100013730 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export declare class VideoV1RoomRoomRecordingRuleRules { "type"?: string; "all"?: boolean; "publisher"?: string; "track"?: string; "kind"?: string; } /** * Options to pass to update a RecordingRulesInstance */ export interface RecordingRulesListInstanceUpdateOptions { /** A JSON-encoded array of recording rules. */ rules?: any; } export interface RecordingRulesSolution { roomSid: string; } export interface RecordingRulesListInstance { _version: V1; _solution: RecordingRulesSolution; _uri: string; /** * Fetch a RecordingRulesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingRulesInstance */ fetch(callback?: (error: Error | null, item?: RecordingRulesInstance) => any): Promise<RecordingRulesInstance>; /** * Update a RecordingRulesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingRulesInstance */ update(callback?: (error: Error | null, item?: RecordingRulesInstance) => any): Promise<RecordingRulesInstance>; /** * Update a RecordingRulesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingRulesInstance */ update(params: RecordingRulesListInstanceUpdateOptions, callback?: (error: Error | null, item?: RecordingRulesInstance) => any): Promise<RecordingRulesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RecordingRulesListInstance(version: V1, roomSid: string): RecordingRulesListInstance; interface RecordingRulesResource { room_sid: string; rules: Array<VideoV1RoomRoomRecordingRuleRules>; date_created: Date; date_updated: Date; } export declare class RecordingRulesInstance { protected _version: V1; constructor(_version: V1, payload: RecordingRulesResource, roomSid: string); /** * The SID of the Room resource for the Recording Rules */ roomSid: string; /** * A collection of Recording Rules that describe how to include or exclude matching tracks for recording */ rules: Array<VideoV1RoomRoomRecordingRuleRules>; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { roomSid: string; rules: VideoV1RoomRoomRecordingRuleRules[]; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/video/v1/room/roomRecording.d.ts000064400000031300151677225100013537 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type RoomRecordingCodec = "VP8" | "H264" | "OPUS" | "PCMU"; export type RoomRecordingFormat = "mka" | "mkv"; export type RoomRecordingStatus = "processing" | "completed" | "deleted" | "failed"; export type RoomRecordingType = "audio" | "video" | "data"; /** * Options to pass to each */ export interface RoomRecordingListInstanceEachOptions { /** Read only the recordings with this status. Can be: `processing`, `completed`, or `deleted`. */ status?: RoomRecordingStatus; /** Read only the recordings that have this `source_sid`. */ sourceSid?: string; /** Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedAfter?: Date; /** Read only Recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: RoomRecordingInstance, 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 RoomRecordingListInstanceOptions { /** Read only the recordings with this status. Can be: `processing`, `completed`, or `deleted`. */ status?: RoomRecordingStatus; /** Read only the recordings that have this `source_sid`. */ sourceSid?: string; /** Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedAfter?: Date; /** Read only Recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface RoomRecordingListInstancePageOptions { /** Read only the recordings with this status. Can be: `processing`, `completed`, or `deleted`. */ status?: RoomRecordingStatus; /** Read only the recordings that have this `source_sid`. */ sourceSid?: string; /** Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedAfter?: Date; /** Read only Recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. */ dateCreatedBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface RoomRecordingContext { /** * Remove a RoomRecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoomRecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomRecordingInstance */ fetch(callback?: (error: Error | null, item?: RoomRecordingInstance) => any): Promise<RoomRecordingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RoomRecordingContextSolution { roomSid: string; sid: string; } export declare class RoomRecordingContextImpl implements RoomRecordingContext { protected _version: V1; protected _solution: RoomRecordingContextSolution; protected _uri: string; constructor(_version: V1, roomSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RoomRecordingInstance) => any): Promise<RoomRecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RoomRecordingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RoomRecordingPayload extends TwilioResponsePayload { recordings: RoomRecordingResource[]; } interface RoomRecordingResource { account_sid: string; status: RoomRecordingStatus; date_created: Date; sid: string; source_sid: string; size: number; url: string; type: RoomRecordingType; duration: number; container_format: RoomRecordingFormat; codec: RoomRecordingCodec; grouping_sids: any; track_name: string; offset: number; media_external_location: string; room_sid: string; links: Record<string, string>; } export declare class RoomRecordingInstance { protected _version: V1; protected _solution: RoomRecordingContextSolution; protected _context?: RoomRecordingContext; constructor(_version: V1, payload: RoomRecordingResource, roomSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomRecording resource. */ accountSid: string; status: RoomRecordingStatus; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The unique string that we created to identify the RoomRecording resource. */ sid: string; /** * The SID of the recording source. For a Room Recording, this value is a `track_sid`. */ sourceSid: string; /** * The size of the recorded track in bytes. */ size: number; /** * The absolute URL of the resource. */ url: string; type: RoomRecordingType; /** * The duration of the recording rounded to the nearest second. Sub-second duration tracks have a `duration` of 1 second */ duration: number; containerFormat: RoomRecordingFormat; codec: RoomRecordingCodec; /** * A list of SIDs related to the Recording. Includes the `room_sid` and `participant_sid`. */ groupingSids: any; /** * The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. */ trackName: string; /** * The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. */ offset: number; /** * The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. */ mediaExternalLocation: string; /** * The SID of the Room resource the recording is associated with. */ roomSid: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a RoomRecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoomRecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomRecordingInstance */ fetch(callback?: (error: Error | null, item?: RoomRecordingInstance) => any): Promise<RoomRecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; status: RoomRecordingStatus; dateCreated: Date; sid: string; sourceSid: string; size: number; url: string; type: RoomRecordingType; duration: number; containerFormat: RoomRecordingFormat; codec: RoomRecordingCodec; groupingSids: any; trackName: string; offset: number; mediaExternalLocation: string; roomSid: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RoomRecordingSolution { roomSid: string; } export interface RoomRecordingListInstance { _version: V1; _solution: RoomRecordingSolution; _uri: string; (sid: string): RoomRecordingContext; get(sid: string): RoomRecordingContext; /** * Streams RoomRecordingInstance 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 { RoomRecordingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RoomRecordingInstance, done: (err?: Error) => void) => void): void; each(params: RoomRecordingListInstanceEachOptions, callback?: (item: RoomRecordingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RoomRecordingInstance 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: RoomRecordingPage) => any): Promise<RoomRecordingPage>; /** * Lists RoomRecordingInstance 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 { RoomRecordingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoomRecordingInstance[]) => any): Promise<RoomRecordingInstance[]>; list(params: RoomRecordingListInstanceOptions, callback?: (error: Error | null, items: RoomRecordingInstance[]) => any): Promise<RoomRecordingInstance[]>; /** * Retrieve a single page of RoomRecordingInstance 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 { RoomRecordingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RoomRecordingPage) => any): Promise<RoomRecordingPage>; page(params: RoomRecordingListInstancePageOptions, callback?: (error: Error | null, items: RoomRecordingPage) => any): Promise<RoomRecordingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RoomRecordingListInstance(version: V1, roomSid: string): RoomRecordingListInstance; export declare class RoomRecordingPage extends Page<V1, RoomRecordingPayload, RoomRecordingResource, RoomRecordingInstance> { /** * Initialize the RoomRecordingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RoomRecordingSolution); /** * Build an instance of RoomRecordingInstance * * @param payload - Payload response from the API */ getInstance(payload: RoomRecordingResource): RoomRecordingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/video/v1/room/participant.d.ts000064400000035227151677225100013260 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { AnonymizeListInstance } from "./participant/anonymize"; import { PublishedTrackListInstance } from "./participant/publishedTrack"; import { SubscribeRulesListInstance } from "./participant/subscribeRules"; import { SubscribedTrackListInstance } from "./participant/subscribedTrack"; export type ParticipantStatus = "connected" | "disconnected"; /** * Options to pass to update a ParticipantInstance */ export interface ParticipantContextUpdateOptions { /** */ status?: ParticipantStatus; } /** * Options to pass to each */ export interface ParticipantListInstanceEachOptions { /** Read only the participants with this status. Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned. */ status?: ParticipantStatus; /** Read only the Participants with this [User](https://www.twilio.com/docs/chat/rest/user-resource) `identity` value. */ identity?: string; /** Read only Participants that started after this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ dateCreatedAfter?: Date; /** Read only Participants that started before this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ dateCreatedBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ParticipantInstance, 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 ParticipantListInstanceOptions { /** Read only the participants with this status. Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned. */ status?: ParticipantStatus; /** Read only the Participants with this [User](https://www.twilio.com/docs/chat/rest/user-resource) `identity` value. */ identity?: string; /** Read only Participants that started after this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ dateCreatedAfter?: Date; /** Read only Participants that started before this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ dateCreatedBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ParticipantListInstancePageOptions { /** Read only the participants with this status. Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned. */ status?: ParticipantStatus; /** Read only the Participants with this [User](https://www.twilio.com/docs/chat/rest/user-resource) `identity` value. */ identity?: string; /** Read only Participants that started after this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ dateCreatedAfter?: Date; /** Read only Participants that started before this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ dateCreatedBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ParticipantContext { anonymize: AnonymizeListInstance; publishedTracks: PublishedTrackListInstance; subscribeRules: SubscribeRulesListInstance; subscribedTracks: SubscribedTrackListInstance; /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(params: ParticipantContextUpdateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ParticipantContextSolution { roomSid: string; sid: string; } export declare class ParticipantContextImpl implements ParticipantContext { protected _version: V1; protected _solution: ParticipantContextSolution; protected _uri: string; protected _anonymize?: AnonymizeListInstance; protected _publishedTracks?: PublishedTrackListInstance; protected _subscribeRules?: SubscribeRulesListInstance; protected _subscribedTracks?: SubscribedTrackListInstance; constructor(_version: V1, roomSid: string, sid: string); get anonymize(): AnonymizeListInstance; get publishedTracks(): PublishedTrackListInstance; get subscribeRules(): SubscribeRulesListInstance; get subscribedTracks(): SubscribedTrackListInstance; fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; update(params?: ParticipantContextUpdateOptions | ((error: Error | null, item?: ParticipantInstance) => any), callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ParticipantContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ParticipantPayload extends TwilioResponsePayload { participants: ParticipantResource[]; } interface ParticipantResource { sid: string; room_sid: string; account_sid: string; status: ParticipantStatus; identity: string; date_created: Date; date_updated: Date; start_time: Date; end_time: Date; duration: number; url: string; links: Record<string, string>; } export declare class ParticipantInstance { protected _version: V1; protected _solution: ParticipantContextSolution; protected _context?: ParticipantContext; constructor(_version: V1, payload: ParticipantResource, roomSid: string, sid?: string); /** * The unique string that we created to identify the RoomParticipant resource. */ sid: string; /** * The SID of the participant\'s room. */ roomSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. */ accountSid: string; status: ParticipantStatus; /** * The application-defined string that uniquely identifies the resource\'s User within a Room. If a client joins with an existing Identity, the existing client is disconnected. See [access tokens](https://www.twilio.com/docs/video/tutorials/user-identity-access-tokens) and [limits](https://www.twilio.com/docs/video/programmable-video-limits) for more info. */ identity: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ startTime: Date; /** * The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. */ endTime: Date; /** * The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. */ duration: number; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(params: ParticipantContextUpdateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Access the anonymize. */ anonymize(): AnonymizeListInstance; /** * Access the publishedTracks. */ publishedTracks(): PublishedTrackListInstance; /** * Access the subscribeRules. */ subscribeRules(): SubscribeRulesListInstance; /** * Access the subscribedTracks. */ subscribedTracks(): SubscribedTrackListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; roomSid: string; accountSid: string; status: ParticipantStatus; identity: string; dateCreated: Date; dateUpdated: Date; startTime: Date; endTime: Date; duration: number; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ParticipantSolution { roomSid: string; } export interface ParticipantListInstance { _version: V1; _solution: ParticipantSolution; _uri: string; (sid: string): ParticipantContext; get(sid: string): ParticipantContext; /** * Streams ParticipantInstance 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 { ParticipantListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; each(params: ParticipantListInstanceEachOptions, callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ParticipantInstance 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: ParticipantPage) => any): Promise<ParticipantPage>; /** * Lists ParticipantInstance 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 { ParticipantListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; list(params: ParticipantListInstanceOptions, callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; /** * Retrieve a single page of ParticipantInstance 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 { ParticipantListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; page(params: ParticipantListInstancePageOptions, callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ParticipantListInstance(version: V1, roomSid: string): ParticipantListInstance; export declare class ParticipantPage extends Page<V1, ParticipantPayload, ParticipantResource, ParticipantInstance> { /** * Initialize the ParticipantPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ParticipantSolution); /** * Build an instance of ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload: ParticipantResource): ParticipantInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/video/v1/room/roomRecording.js000064400000021455151677225100013315 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.RoomRecordingPage = exports.RoomRecordingListInstance = exports.RoomRecordingInstance = exports.RoomRecordingContextImpl = void 0; 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 RoomRecordingContextImpl { constructor(_version, roomSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { roomSid, sid }; this._uri = `/Rooms/${roomSid}/Recordings/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RoomRecordingInstance(operationVersion, payload, instance._solution.roomSid, 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.RoomRecordingContextImpl = RoomRecordingContextImpl; class RoomRecordingInstance { constructor(_version, payload, roomSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.status = payload.status; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.sid = payload.sid; this.sourceSid = payload.source_sid; this.size = payload.size; this.url = payload.url; this.type = payload.type; this.duration = deserialize.integer(payload.duration); this.containerFormat = payload.container_format; this.codec = payload.codec; this.groupingSids = payload.grouping_sids; this.trackName = payload.track_name; this.offset = payload.offset; this.mediaExternalLocation = payload.media_external_location; this.roomSid = payload.room_sid; this.links = payload.links; this._solution = { roomSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RoomRecordingContextImpl(this._version, this._solution.roomSid, this._solution.sid); return this._context; } /** * Remove a RoomRecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RoomRecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomRecordingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, status: this.status, dateCreated: this.dateCreated, sid: this.sid, sourceSid: this.sourceSid, size: this.size, url: this.url, type: this.type, duration: this.duration, containerFormat: this.containerFormat, codec: this.codec, groupingSids: this.groupingSids, trackName: this.trackName, offset: this.offset, mediaExternalLocation: this.mediaExternalLocation, roomSid: this.roomSid, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoomRecordingInstance = RoomRecordingInstance; function RoomRecordingListInstance(version, roomSid) { if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RoomRecordingContextImpl(version, roomSid, sid); }; instance._version = version; instance._solution = { roomSid }; instance._uri = `/Rooms/${roomSid}/Recordings`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["sourceSid"] !== undefined) data["SourceSid"] = params["sourceSid"]; if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RoomRecordingPage(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 RoomRecordingPage(instance._version, payload, 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; } exports.RoomRecordingListInstance = RoomRecordingListInstance; class RoomRecordingPage extends Page_1.default { /** * Initialize the RoomRecordingPage * * @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 RoomRecordingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RoomRecordingInstance(this._version, payload, this._solution.roomSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoomRecordingPage = RoomRecordingPage; rest/video/v1/recordingSettings.js000064400000013317151677225100013223 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.RecordingSettingsListInstance = exports.RecordingSettingsInstance = exports.RecordingSettingsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class RecordingSettingsContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/RecordingSettings/Default`; } create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["awsCredentialsSid"] !== undefined) data["AwsCredentialsSid"] = params["awsCredentialsSid"]; if (params["encryptionKeySid"] !== undefined) data["EncryptionKeySid"] = params["encryptionKeySid"]; if (params["awsS3Url"] !== undefined) data["AwsS3Url"] = params["awsS3Url"]; if (params["awsStorageEnabled"] !== undefined) data["AwsStorageEnabled"] = serialize.bool(params["awsStorageEnabled"]); if (params["encryptionEnabled"] !== undefined) data["EncryptionEnabled"] = serialize.bool(params["encryptionEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingSettingsInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RecordingSettingsInstance(operationVersion, payload)); 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.RecordingSettingsContextImpl = RecordingSettingsContextImpl; class RecordingSettingsInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.awsCredentialsSid = payload.aws_credentials_sid; this.awsS3Url = payload.aws_s3_url; this.awsStorageEnabled = payload.aws_storage_enabled; this.encryptionKeySid = payload.encryption_key_sid; this.encryptionEnabled = payload.encryption_enabled; this.url = payload.url; this._solution = {}; } get _proxy() { this._context = this._context || new RecordingSettingsContextImpl(this._version); return this._context; } create(params, callback) { return this._proxy.create(params, callback); } /** * Fetch a RecordingSettingsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingSettingsInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, friendlyName: this.friendlyName, awsCredentialsSid: this.awsCredentialsSid, awsS3Url: this.awsS3Url, awsStorageEnabled: this.awsStorageEnabled, encryptionKeySid: this.encryptionKeySid, encryptionEnabled: this.encryptionEnabled, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingSettingsInstance = RecordingSettingsInstance; function RecordingSettingsListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new RecordingSettingsContextImpl(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; } exports.RecordingSettingsListInstance = RecordingSettingsListInstance; rest/video/v1/recording.js000064400000021216151677225100011477 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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.RecordingPage = exports.RecordingListInstance = exports.RecordingInstance = exports.RecordingContextImpl = void 0; 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 RecordingContextImpl { 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 = `/Recordings/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, 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.RecordingContextImpl = RecordingContextImpl; class RecordingInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.status = payload.status; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.sid = payload.sid; this.sourceSid = payload.source_sid; this.size = payload.size; this.url = payload.url; this.type = payload.type; this.duration = deserialize.integer(payload.duration); this.containerFormat = payload.container_format; this.codec = payload.codec; this.groupingSids = payload.grouping_sids; this.trackName = payload.track_name; this.offset = payload.offset; this.mediaExternalLocation = payload.media_external_location; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RecordingContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, status: this.status, dateCreated: this.dateCreated, sid: this.sid, sourceSid: this.sourceSid, size: this.size, url: this.url, type: this.type, duration: this.duration, containerFormat: this.containerFormat, codec: this.codec, groupingSids: this.groupingSids, trackName: this.trackName, offset: this.offset, mediaExternalLocation: this.mediaExternalLocation, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingInstance = RecordingInstance; function RecordingListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RecordingContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Recordings`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["sourceSid"] !== undefined) data["SourceSid"] = params["sourceSid"]; if (params["groupingSid"] !== undefined) data["GroupingSid"] = serialize.map(params["groupingSid"], (e) => e); if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); if (params["mediaType"] !== undefined) data["MediaType"] = params["mediaType"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingPage(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 RecordingPage(instance._version, payload, 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; } exports.RecordingListInstance = RecordingListInstance; class RecordingPage extends Page_1.default { /** * Initialize the RecordingPage * * @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 RecordingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RecordingInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingPage = RecordingPage; rest/video/v1/recording.d.ts000064400000033064151677225100011737 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type RecordingCodec = "VP8" | "H264" | "OPUS" | "PCMU"; export type RecordingFormat = "mka" | "mkv"; export type RecordingStatus = "processing" | "completed" | "deleted" | "failed"; export type RecordingType = "audio" | "video" | "data"; /** * Options to pass to each */ export interface RecordingListInstanceEachOptions { /** Read only the recordings that have this status. Can be: `processing`, `completed`, or `deleted`. */ status?: RecordingStatus; /** Read only the recordings that have this `source_sid`. */ sourceSid?: string; /** Read only recordings with this `grouping_sid`, which may include a `participant_sid` and/or a `room_sid`. */ groupingSid?: Array<string>; /** Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. */ dateCreatedAfter?: Date; /** Read only recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or `YYYY-MM-DDThh:mm:ssZ`. */ dateCreatedBefore?: Date; /** Read only recordings that have this media type. Can be either `audio` or `video`. */ mediaType?: RecordingType; /** 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: RecordingInstance, 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 RecordingListInstanceOptions { /** Read only the recordings that have this status. Can be: `processing`, `completed`, or `deleted`. */ status?: RecordingStatus; /** Read only the recordings that have this `source_sid`. */ sourceSid?: string; /** Read only recordings with this `grouping_sid`, which may include a `participant_sid` and/or a `room_sid`. */ groupingSid?: Array<string>; /** Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. */ dateCreatedAfter?: Date; /** Read only recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or `YYYY-MM-DDThh:mm:ssZ`. */ dateCreatedBefore?: Date; /** Read only recordings that have this media type. Can be either `audio` or `video`. */ mediaType?: RecordingType; /** 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 RecordingListInstancePageOptions { /** Read only the recordings that have this status. Can be: `processing`, `completed`, or `deleted`. */ status?: RecordingStatus; /** Read only the recordings that have this `source_sid`. */ sourceSid?: string; /** Read only recordings with this `grouping_sid`, which may include a `participant_sid` and/or a `room_sid`. */ groupingSid?: Array<string>; /** Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. */ dateCreatedAfter?: Date; /** Read only recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or `YYYY-MM-DDThh:mm:ssZ`. */ dateCreatedBefore?: Date; /** Read only recordings that have this media type. Can be either `audio` or `video`. */ mediaType?: RecordingType; /** 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 RecordingContext { /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RecordingContextSolution { sid: string; } export declare class RecordingContextImpl implements RecordingContext { protected _version: V1; protected _solution: RecordingContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RecordingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RecordingPayload extends TwilioResponsePayload { recordings: RecordingResource[]; } interface RecordingResource { account_sid: string; status: RecordingStatus; date_created: Date; sid: string; source_sid: string; size: number; url: string; type: RecordingType; duration: number; container_format: RecordingFormat; codec: RecordingCodec; grouping_sids: any; track_name: string; offset: number; media_external_location: string; status_callback: string; status_callback_method: string; links: Record<string, string>; } export declare class RecordingInstance { protected _version: V1; protected _solution: RecordingContextSolution; protected _context?: RecordingContext; constructor(_version: V1, payload: RecordingResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. */ accountSid: string; status: RecordingStatus; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The unique string that we created to identify the Recording resource. */ sid: string; /** * The SID of the recording source. For a Room Recording, this value is a `track_sid`. */ sourceSid: string; /** * The size of the recorded track, in bytes. */ size: number; /** * The absolute URL of the resource. */ url: string; type: RecordingType; /** * The duration of the recording in seconds rounded to the nearest second. Sub-second tracks have a `Duration` property of 1 second */ duration: number; containerFormat: RecordingFormat; codec: RecordingCodec; /** * A list of SIDs related to the recording. Includes the `room_sid` and `participant_sid`. */ groupingSids: any; /** * The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. */ trackName: string; /** * The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. */ offset: number; /** * The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. */ mediaExternalLocation: string; /** * The URL called using the `status_callback_method` to send status information on every recording event. */ statusCallback: string; /** * The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. */ statusCallbackMethod: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; status: RecordingStatus; dateCreated: Date; sid: string; sourceSid: string; size: number; url: string; type: RecordingType; duration: number; containerFormat: RecordingFormat; codec: RecordingCodec; groupingSids: any; trackName: string; offset: number; mediaExternalLocation: string; statusCallback: string; statusCallbackMethod: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RecordingSolution { } export interface RecordingListInstance { _version: V1; _solution: RecordingSolution; _uri: string; (sid: string): RecordingContext; get(sid: string): RecordingContext; /** * Streams RecordingInstance 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 { RecordingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RecordingInstance, done: (err?: Error) => void) => void): void; each(params: RecordingListInstanceEachOptions, callback?: (item: RecordingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RecordingInstance 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: RecordingPage) => any): Promise<RecordingPage>; /** * Lists RecordingInstance 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 { RecordingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RecordingInstance[]) => any): Promise<RecordingInstance[]>; list(params: RecordingListInstanceOptions, callback?: (error: Error | null, items: RecordingInstance[]) => any): Promise<RecordingInstance[]>; /** * Retrieve a single page of RecordingInstance 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 { RecordingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RecordingPage) => any): Promise<RecordingPage>; page(params: RecordingListInstancePageOptions, callback?: (error: Error | null, items: RecordingPage) => any): Promise<RecordingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RecordingListInstance(version: V1): RecordingListInstance; export declare class RecordingPage extends Page<V1, RecordingPayload, RecordingResource, RecordingInstance> { /** * Initialize the RecordingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RecordingSolution); /** * Build an instance of RecordingInstance * * @param payload - Payload response from the API */ getInstance(payload: RecordingResource): RecordingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/video/V1.js000064400000005210151677225100007457 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Video * 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 composition_1 = require("./v1/composition"); const compositionHook_1 = require("./v1/compositionHook"); const compositionSettings_1 = require("./v1/compositionSettings"); const recording_1 = require("./v1/recording"); const recordingSettings_1 = require("./v1/recordingSettings"); const room_1 = require("./v1/room"); class V1 extends Version_1.default { /** * Initialize the V1 version of Video * * @param domain - The Twilio (Twilio.Video) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for compositions resource */ get compositions() { this._compositions = this._compositions || (0, composition_1.CompositionListInstance)(this); return this._compositions; } /** Getter for compositionHooks resource */ get compositionHooks() { this._compositionHooks = this._compositionHooks || (0, compositionHook_1.CompositionHookListInstance)(this); return this._compositionHooks; } /** Getter for compositionSettings resource */ get compositionSettings() { this._compositionSettings = this._compositionSettings || (0, compositionSettings_1.CompositionSettingsListInstance)(this); return this._compositionSettings; } /** Getter for recordings resource */ get recordings() { this._recordings = this._recordings || (0, recording_1.RecordingListInstance)(this); return this._recordings; } /** Getter for recordingSettings resource */ get recordingSettings() { this._recordingSettings = this._recordingSettings || (0, recordingSettings_1.RecordingSettingsListInstance)(this); return this._recordingSettings; } /** Getter for rooms resource */ get rooms() { this._rooms = this._rooms || (0, room_1.RoomListInstance)(this); return this._rooms; } } exports.default = V1; rest/Proxy.d.ts000064400000000377151677225100007451 0ustar00import { ServiceListInstance } from "./proxy/v1/service"; import ProxyBase from "./ProxyBase"; declare class Proxy extends ProxyBase { /** * @deprecated - Use v1.services instead */ get services(): ServiceListInstance; } export = Proxy; rest/NumbersBase.d.ts000064400000000545151677225100010533 0ustar00import Domain from "../base/Domain"; import V1 from "./numbers/V1"; import V2 from "./numbers/V2"; declare class NumbersBase extends Domain { _v1?: V1; _v2?: V2; /** * Initialize numbers domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; get v2(): V2; } export = NumbersBase; rest/TrunkingBase.js000064400000002052151677225100010460 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./trunking/V1")); class TrunkingBase extends Domain_1.default { /** * Initialize trunking domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://trunking.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = TrunkingBase; rest/FrontlineApiBase.d.ts000064400000000472151677225100011511 0ustar00import Domain from "../base/Domain"; import V1 from "./frontlineApi/V1"; declare class FrontlineApiBase extends Domain { _v1?: V1; /** * Initialize frontlineApi domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = FrontlineApiBase; rest/Accounts.d.ts000064400000001323151677225100010077 0ustar00import { AuthTokenPromotionListInstance } from "./accounts/v1/authTokenPromotion"; import { CredentialListInstance } from "./accounts/v1/credential"; import { SecondaryAuthTokenListInstance } from "./accounts/v1/secondaryAuthToken"; import AccountsBase from "./AccountsBase"; declare class Accounts extends AccountsBase { /** * @deprecated - Use v1.authTokenPromotion; instead */ get authTokenPromotion(): AuthTokenPromotionListInstance; /** * @deprecated - Use v1.credentials; instead */ get credentials(): CredentialListInstance; /** * @deprecated - Use v1.secondaryAuthToken; instead */ get secondaryAuthToken(): SecondaryAuthTokenListInstance; } export = Accounts; rest/Wireless.js000064400000002072151677225100007663 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const WirelessBase_1 = __importDefault(require("./WirelessBase")); class Wireless extends WirelessBase_1.default { /** * @deprecated - Use v1.usageRecords instead */ get usageRecords() { console.warn("usageRecords is deprecated. Use v1.usageRecords instead."); return this.v1.usageRecords; } /** * @deprecated - Use v1.commands instead */ get commands() { console.warn("commands is deprecated. Use v1.commands instead."); return this.v1.commands; } /** * @deprecated - Use v1.ratePlans instead */ get ratePlans() { console.warn("ratePlans is deprecated. Use v1.ratePlans instead."); return this.v1.ratePlans; } /** * @deprecated - Use v1.sims instead */ get sims() { console.warn("sims is deprecated. Use v1.sims instead."); return this.v1.sims; } } module.exports = Wireless; rest/numbers/V2.d.ts000064400000003336151677225100010270 0ustar00import NumbersBase from "../NumbersBase"; import Version from "../../base/Version"; import { AuthorizationDocumentListInstance } from "./v2/authorizationDocument"; import { BulkHostedNumberOrderListInstance } from "./v2/bulkHostedNumberOrder"; import { HostedNumberOrderListInstance } from "./v2/hostedNumberOrder"; import { RegulatoryComplianceListInstance } from "./v2/regulatoryCompliance"; export default class V2 extends Version { /** * Initialize the V2 version of Numbers * * @param domain - The Twilio (Twilio.Numbers) domain */ constructor(domain: NumbersBase); /** authorizationDocuments - { Twilio.Numbers.V2.AuthorizationDocumentListInstance } resource */ protected _authorizationDocuments?: AuthorizationDocumentListInstance; /** bulkHostedNumberOrders - { Twilio.Numbers.V2.BulkHostedNumberOrderListInstance } resource */ protected _bulkHostedNumberOrders?: BulkHostedNumberOrderListInstance; /** hostedNumberOrders - { Twilio.Numbers.V2.HostedNumberOrderListInstance } resource */ protected _hostedNumberOrders?: HostedNumberOrderListInstance; /** regulatoryCompliance - { Twilio.Numbers.V2.RegulatoryComplianceListInstance } resource */ protected _regulatoryCompliance?: RegulatoryComplianceListInstance; /** Getter for authorizationDocuments resource */ get authorizationDocuments(): AuthorizationDocumentListInstance; /** Getter for bulkHostedNumberOrders resource */ get bulkHostedNumberOrders(): BulkHostedNumberOrderListInstance; /** Getter for hostedNumberOrders resource */ get hostedNumberOrders(): HostedNumberOrderListInstance; /** Getter for regulatoryCompliance resource */ get regulatoryCompliance(): RegulatoryComplianceListInstance; } rest/numbers/V1.d.ts000064400000007335151677225100010272 0ustar00import NumbersBase from "../NumbersBase"; import Version from "../../base/Version"; import { BulkEligibilityListInstance } from "./v1/bulkEligibility"; import { EligibilityListInstance } from "./v1/eligibility"; import { PortingPortInListInstance } from "./v1/portingPortIn"; import { PortingPortInPhoneNumberListInstance } from "./v1/portingPortInPhoneNumber"; import { PortingPortabilityListInstance } from "./v1/portingPortability"; import { PortingWebhookConfigurationListInstance } from "./v1/portingWebhookConfiguration"; import { PortingWebhookConfigurationDeleteListInstance } from "./v1/portingWebhookConfigurationDelete"; import { PortingWebhookConfigurationFetchListInstance } from "./v1/portingWebhookConfigurationFetch"; import { SigningRequestConfigurationListInstance } from "./v1/signingRequestConfiguration"; export default class V1 extends Version { /** * Initialize the V1 version of Numbers * * @param domain - The Twilio (Twilio.Numbers) domain */ constructor(domain: NumbersBase); /** bulkEligibilities - { Twilio.Numbers.V1.BulkEligibilityListInstance } resource */ protected _bulkEligibilities?: BulkEligibilityListInstance; /** eligibilities - { Twilio.Numbers.V1.EligibilityListInstance } resource */ protected _eligibilities?: EligibilityListInstance; /** portingPortIns - { Twilio.Numbers.V1.PortingPortInListInstance } resource */ protected _portingPortIns?: PortingPortInListInstance; /** portingPortInPhoneNumber - { Twilio.Numbers.V1.PortingPortInPhoneNumberListInstance } resource */ protected _portingPortInPhoneNumber?: PortingPortInPhoneNumberListInstance; /** portingPortabilities - { Twilio.Numbers.V1.PortingPortabilityListInstance } resource */ protected _portingPortabilities?: PortingPortabilityListInstance; /** portingWebhookConfigurations - { Twilio.Numbers.V1.PortingWebhookConfigurationListInstance } resource */ protected _portingWebhookConfigurations?: PortingWebhookConfigurationListInstance; /** portingWebhookConfigurationsDelete - { Twilio.Numbers.V1.PortingWebhookConfigurationDeleteListInstance } resource */ protected _portingWebhookConfigurationsDelete?: PortingWebhookConfigurationDeleteListInstance; /** portingWebhookConfigurationFetch - { Twilio.Numbers.V1.PortingWebhookConfigurationFetchListInstance } resource */ protected _portingWebhookConfigurationFetch?: PortingWebhookConfigurationFetchListInstance; /** signingRequestConfigurations - { Twilio.Numbers.V1.SigningRequestConfigurationListInstance } resource */ protected _signingRequestConfigurations?: SigningRequestConfigurationListInstance; /** Getter for bulkEligibilities resource */ get bulkEligibilities(): BulkEligibilityListInstance; /** Getter for eligibilities resource */ get eligibilities(): EligibilityListInstance; /** Getter for portingPortIns resource */ get portingPortIns(): PortingPortInListInstance; /** Getter for portingPortInPhoneNumber resource */ get portingPortInPhoneNumber(): PortingPortInPhoneNumberListInstance; /** Getter for portingPortabilities resource */ get portingPortabilities(): PortingPortabilityListInstance; /** Getter for portingWebhookConfigurations resource */ get portingWebhookConfigurations(): PortingWebhookConfigurationListInstance; /** Getter for portingWebhookConfigurationsDelete resource */ get portingWebhookConfigurationsDelete(): PortingWebhookConfigurationDeleteListInstance; /** Getter for portingWebhookConfigurationFetch resource */ get portingWebhookConfigurationFetch(): PortingWebhookConfigurationFetchListInstance; /** Getter for signingRequestConfigurations resource */ get signingRequestConfigurations(): SigningRequestConfigurationListInstance; } rest/numbers/V2.js000064400000004575151677225100010042 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const authorizationDocument_1 = require("./v2/authorizationDocument"); const bulkHostedNumberOrder_1 = require("./v2/bulkHostedNumberOrder"); const hostedNumberOrder_1 = require("./v2/hostedNumberOrder"); const regulatoryCompliance_1 = require("./v2/regulatoryCompliance"); class V2 extends Version_1.default { /** * Initialize the V2 version of Numbers * * @param domain - The Twilio (Twilio.Numbers) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for authorizationDocuments resource */ get authorizationDocuments() { this._authorizationDocuments = this._authorizationDocuments || (0, authorizationDocument_1.AuthorizationDocumentListInstance)(this); return this._authorizationDocuments; } /** Getter for bulkHostedNumberOrders resource */ get bulkHostedNumberOrders() { this._bulkHostedNumberOrders = this._bulkHostedNumberOrders || (0, bulkHostedNumberOrder_1.BulkHostedNumberOrderListInstance)(this); return this._bulkHostedNumberOrders; } /** Getter for hostedNumberOrders resource */ get hostedNumberOrders() { this._hostedNumberOrders = this._hostedNumberOrders || (0, hostedNumberOrder_1.HostedNumberOrderListInstance)(this); return this._hostedNumberOrders; } /** Getter for regulatoryCompliance resource */ get regulatoryCompliance() { this._regulatoryCompliance = this._regulatoryCompliance || (0, regulatoryCompliance_1.RegulatoryComplianceListInstance)(this); return this._regulatoryCompliance; } } exports.default = V2; rest/numbers/v2/regulatoryCompliance.js000064400000007122151677225100014261 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.RegulatoryComplianceListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const bundle_1 = require("./regulatoryCompliance/bundle"); const endUser_1 = require("./regulatoryCompliance/endUser"); const endUserType_1 = require("./regulatoryCompliance/endUserType"); const regulation_1 = require("./regulatoryCompliance/regulation"); const supportingDocument_1 = require("./regulatoryCompliance/supportingDocument"); const supportingDocumentType_1 = require("./regulatoryCompliance/supportingDocumentType"); function RegulatoryComplianceListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/RegulatoryCompliance`; Object.defineProperty(instance, "bundles", { get: function bundles() { if (!instance._bundles) { instance._bundles = (0, bundle_1.BundleListInstance)(instance._version); } return instance._bundles; }, }); Object.defineProperty(instance, "endUsers", { get: function endUsers() { if (!instance._endUsers) { instance._endUsers = (0, endUser_1.EndUserListInstance)(instance._version); } return instance._endUsers; }, }); Object.defineProperty(instance, "endUserTypes", { get: function endUserTypes() { if (!instance._endUserTypes) { instance._endUserTypes = (0, endUserType_1.EndUserTypeListInstance)(instance._version); } return instance._endUserTypes; }, }); Object.defineProperty(instance, "regulations", { get: function regulations() { if (!instance._regulations) { instance._regulations = (0, regulation_1.RegulationListInstance)(instance._version); } return instance._regulations; }, }); Object.defineProperty(instance, "supportingDocuments", { get: function supportingDocuments() { if (!instance._supportingDocuments) { instance._supportingDocuments = (0, supportingDocument_1.SupportingDocumentListInstance)(instance._version); } return instance._supportingDocuments; }, }); Object.defineProperty(instance, "supportingDocumentTypes", { get: function supportingDocumentTypes() { if (!instance._supportingDocumentTypes) { instance._supportingDocumentTypes = (0, supportingDocumentType_1.SupportingDocumentTypeListInstance)(instance._version); } return instance._supportingDocumentTypes; }, }); 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; } exports.RegulatoryComplianceListInstance = RegulatoryComplianceListInstance; rest/numbers/v2/authorizationDocument.d.ts000064400000032130151677225100014721 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; import { DependentHostedNumberOrderListInstance } from "./authorizationDocument/dependentHostedNumberOrder"; export type AuthorizationDocumentStatus = "opened" | "signing" | "signed" | "canceled" | "failed"; /** * Options to pass to create a AuthorizationDocumentInstance */ export interface AuthorizationDocumentListInstanceCreateOptions { /** A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. */ addressSid: string; /** Email that this AuthorizationDocument will be sent to for signing. */ email: string; /** The contact phone number of the person authorized to sign the Authorization Document. */ contactPhoneNumber: string; /** A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio\\\'s platform. */ hostedNumberOrderSids: Array<string>; /** The title of the person authorized to sign the Authorization Document for this phone number. */ contactTitle?: string; /** Email recipients who will be informed when an Authorization Document has been sent and signed. */ ccEmails?: Array<string>; } /** * Options to pass to each */ export interface AuthorizationDocumentListInstanceEachOptions { /** Email that this AuthorizationDocument will be sent to for signing. */ email?: string; /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: AuthorizationDocumentStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface AuthorizationDocumentListInstanceOptions { /** Email that this AuthorizationDocument will be sent to for signing. */ email?: string; /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: AuthorizationDocumentStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AuthorizationDocumentListInstancePageOptions { /** Email that this AuthorizationDocument will be sent to for signing. */ email?: string; /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: AuthorizationDocumentStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AuthorizationDocumentContext { dependentHostedNumberOrders: DependentHostedNumberOrderListInstance; /** * Remove a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ fetch(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AuthorizationDocumentContextSolution { sid: string; } export declare class AuthorizationDocumentContextImpl implements AuthorizationDocumentContext { protected _version: V2; protected _solution: AuthorizationDocumentContextSolution; protected _uri: string; protected _dependentHostedNumberOrders?: DependentHostedNumberOrderListInstance; constructor(_version: V2, sid: string); get dependentHostedNumberOrders(): DependentHostedNumberOrderListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AuthorizationDocumentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AuthorizationDocumentPayload extends TwilioResponsePayload { items: AuthorizationDocumentResource[]; } interface AuthorizationDocumentResource { sid: string; address_sid: string; status: AuthorizationDocumentStatus; email: string; cc_emails: Array<string>; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class AuthorizationDocumentInstance { protected _version: V2; protected _solution: AuthorizationDocumentContextSolution; protected _context?: AuthorizationDocumentContext; constructor(_version: V2, payload: AuthorizationDocumentResource, sid?: string); /** * A 34 character string that uniquely identifies this AuthorizationDocument. */ sid: string; /** * A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. */ addressSid: string; status: AuthorizationDocumentStatus; /** * Email that this AuthorizationDocument will be sent to for signing. */ email: string; /** * Email recipients who will be informed when an Authorization Document has been sent and signed. */ ccEmails: Array<string>; /** * The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; url: string; links: Record<string, string>; private get _proxy(); /** * Remove a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ fetch(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Access the dependentHostedNumberOrders. */ dependentHostedNumberOrders(): DependentHostedNumberOrderListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; addressSid: string; status: AuthorizationDocumentStatus; email: string; ccEmails: string[]; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AuthorizationDocumentSolution { } export interface AuthorizationDocumentListInstance { _version: V2; _solution: AuthorizationDocumentSolution; _uri: string; (sid: string): AuthorizationDocumentContext; get(sid: string): AuthorizationDocumentContext; /** * Create a AuthorizationDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ create(params: AuthorizationDocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Streams AuthorizationDocumentInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AuthorizationDocumentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void): void; each(params: AuthorizationDocumentListInstanceEachOptions, callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AuthorizationDocumentInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: AuthorizationDocumentPage) => any): Promise<AuthorizationDocumentPage>; /** * Lists AuthorizationDocumentInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AuthorizationDocumentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AuthorizationDocumentInstance[]) => any): Promise<AuthorizationDocumentInstance[]>; list(params: AuthorizationDocumentListInstanceOptions, callback?: (error: Error | null, items: AuthorizationDocumentInstance[]) => any): Promise<AuthorizationDocumentInstance[]>; /** * Retrieve a single page of AuthorizationDocumentInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AuthorizationDocumentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AuthorizationDocumentPage) => any): Promise<AuthorizationDocumentPage>; page(params: AuthorizationDocumentListInstancePageOptions, callback?: (error: Error | null, items: AuthorizationDocumentPage) => any): Promise<AuthorizationDocumentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthorizationDocumentListInstance(version: V2): AuthorizationDocumentListInstance; export declare class AuthorizationDocumentPage extends Page<V2, AuthorizationDocumentPayload, AuthorizationDocumentResource, AuthorizationDocumentInstance> { /** * Initialize the AuthorizationDocumentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: AuthorizationDocumentSolution); /** * Build an instance of AuthorizationDocumentInstance * * @param payload - Payload response from the API */ getInstance(payload: AuthorizationDocumentResource): AuthorizationDocumentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/bulkHostedNumberOrder.js000064400000013220151677225100014336 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.BulkHostedNumberOrderListInstance = exports.BulkHostedNumberOrderInstance = exports.BulkHostedNumberOrderContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class BulkHostedNumberOrderContextImpl { constructor(_version, bulkHostingSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(bulkHostingSid)) { throw new Error("Parameter 'bulkHostingSid' is not valid."); } this._solution = { bulkHostingSid }; this._uri = `/HostedNumber/Orders/Bulk/${bulkHostingSid}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["orderStatus"] !== undefined) data["OrderStatus"] = params["orderStatus"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BulkHostedNumberOrderInstance(operationVersion, payload, instance._solution.bulkHostingSid)); 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.BulkHostedNumberOrderContextImpl = BulkHostedNumberOrderContextImpl; class BulkHostedNumberOrderInstance { constructor(_version, payload, bulkHostingSid) { this._version = _version; this.bulkHostingSid = payload.bulk_hosting_sid; this.requestStatus = payload.request_status; this.friendlyName = payload.friendly_name; this.notificationEmail = payload.notification_email; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateCompleted = deserialize.iso8601DateTime(payload.date_completed); this.url = payload.url; this.totalCount = deserialize.integer(payload.total_count); this.results = payload.results; this._solution = { bulkHostingSid: bulkHostingSid || this.bulkHostingSid }; } get _proxy() { this._context = this._context || new BulkHostedNumberOrderContextImpl(this._version, this._solution.bulkHostingSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { bulkHostingSid: this.bulkHostingSid, requestStatus: this.requestStatus, friendlyName: this.friendlyName, notificationEmail: this.notificationEmail, dateCreated: this.dateCreated, dateCompleted: this.dateCompleted, url: this.url, totalCount: this.totalCount, results: this.results, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BulkHostedNumberOrderInstance = BulkHostedNumberOrderInstance; function BulkHostedNumberOrderListInstance(version) { const instance = ((bulkHostingSid) => instance.get(bulkHostingSid)); instance.get = function get(bulkHostingSid) { return new BulkHostedNumberOrderContextImpl(version, bulkHostingSid); }; instance._version = version; instance._solution = {}; instance._uri = `/HostedNumber/Orders/Bulk`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BulkHostedNumberOrderInstance(operationVersion, payload)); 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; } exports.BulkHostedNumberOrderListInstance = BulkHostedNumberOrderListInstance; rest/numbers/v2/bulkHostedNumberOrder.d.ts000064400000015623151677225100014603 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; export type BulkHostedNumberOrderRequestStatus = "QUEUED" | "IN_PROGRESS" | "PROCESSED"; /** * Options to pass to fetch a BulkHostedNumberOrderInstance */ export interface BulkHostedNumberOrderContextFetchOptions { /** Order status can be used for filtering on Hosted Number Order status values. To see a complete list of order statuses, please check \'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values\'. */ orderStatus?: string; } /** * Options to pass to create a BulkHostedNumberOrderInstance */ export interface BulkHostedNumberOrderListInstanceCreateOptions { /** */ body?: object; } export interface BulkHostedNumberOrderContext { /** * Fetch a BulkHostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkHostedNumberOrderInstance */ fetch(callback?: (error: Error | null, item?: BulkHostedNumberOrderInstance) => any): Promise<BulkHostedNumberOrderInstance>; /** * Fetch a BulkHostedNumberOrderInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkHostedNumberOrderInstance */ fetch(params: BulkHostedNumberOrderContextFetchOptions, callback?: (error: Error | null, item?: BulkHostedNumberOrderInstance) => any): Promise<BulkHostedNumberOrderInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BulkHostedNumberOrderContextSolution { bulkHostingSid: string; } export declare class BulkHostedNumberOrderContextImpl implements BulkHostedNumberOrderContext { protected _version: V2; protected _solution: BulkHostedNumberOrderContextSolution; protected _uri: string; constructor(_version: V2, bulkHostingSid: string); fetch(params?: BulkHostedNumberOrderContextFetchOptions | ((error: Error | null, item?: BulkHostedNumberOrderInstance) => any), callback?: (error: Error | null, item?: BulkHostedNumberOrderInstance) => any): Promise<BulkHostedNumberOrderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BulkHostedNumberOrderContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BulkHostedNumberOrderResource { bulk_hosting_sid: string; request_status: BulkHostedNumberOrderRequestStatus; friendly_name: string; notification_email: string; date_created: Date; date_completed: Date; url: string; total_count: number; results: Array<any>; } export declare class BulkHostedNumberOrderInstance { protected _version: V2; protected _solution: BulkHostedNumberOrderContextSolution; protected _context?: BulkHostedNumberOrderContext; constructor(_version: V2, payload: BulkHostedNumberOrderResource, bulkHostingSid?: string); /** * A 34 character string that uniquely identifies this BulkHostedNumberOrder. */ bulkHostingSid: string; requestStatus: BulkHostedNumberOrderRequestStatus; /** * A 128 character string that is a human-readable text that describes this resource. */ friendlyName: string; /** * Email address used for send notifications about this Bulk hosted number request. */ notificationEmail: string; /** * The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date that this resource was completed, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateCompleted: Date; /** * The URL of this BulkHostedNumberOrder resource. */ url: string; /** * The total count of phone numbers in this Bulk hosting request. */ totalCount: number; /** * Contains a list of all the individual hosting orders and their information, for this Bulk request. Each result object is grouped by its order status. To see a complete list of order status, please check \'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values\'. */ results: Array<any>; private get _proxy(); /** * Fetch a BulkHostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkHostedNumberOrderInstance */ fetch(callback?: (error: Error | null, item?: BulkHostedNumberOrderInstance) => any): Promise<BulkHostedNumberOrderInstance>; /** * Fetch a BulkHostedNumberOrderInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkHostedNumberOrderInstance */ fetch(params: BulkHostedNumberOrderContextFetchOptions, callback?: (error: Error | null, item?: BulkHostedNumberOrderInstance) => any): Promise<BulkHostedNumberOrderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { bulkHostingSid: string; requestStatus: BulkHostedNumberOrderRequestStatus; friendlyName: string; notificationEmail: string; dateCreated: Date; dateCompleted: Date; url: string; totalCount: number; results: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BulkHostedNumberOrderSolution { } export interface BulkHostedNumberOrderListInstance { _version: V2; _solution: BulkHostedNumberOrderSolution; _uri: string; (bulkHostingSid: string): BulkHostedNumberOrderContext; get(bulkHostingSid: string): BulkHostedNumberOrderContext; /** * Create a BulkHostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkHostedNumberOrderInstance */ create(callback?: (error: Error | null, item?: BulkHostedNumberOrderInstance) => any): Promise<BulkHostedNumberOrderInstance>; /** * Create a BulkHostedNumberOrderInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkHostedNumberOrderInstance */ create(params: object, callback?: (error: Error | null, item?: BulkHostedNumberOrderInstance) => any): Promise<BulkHostedNumberOrderInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BulkHostedNumberOrderListInstance(version: V2): BulkHostedNumberOrderListInstance; export {}; rest/numbers/v2/regulatoryCompliance.d.ts000064400000003170151677225100014514 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; import { BundleListInstance } from "./regulatoryCompliance/bundle"; import { EndUserListInstance } from "./regulatoryCompliance/endUser"; import { EndUserTypeListInstance } from "./regulatoryCompliance/endUserType"; import { RegulationListInstance } from "./regulatoryCompliance/regulation"; import { SupportingDocumentListInstance } from "./regulatoryCompliance/supportingDocument"; import { SupportingDocumentTypeListInstance } from "./regulatoryCompliance/supportingDocumentType"; export type RegulatoryComplianceEndUserType = "individual" | "business"; export interface RegulatoryComplianceSolution { } export interface RegulatoryComplianceListInstance { _version: V2; _solution: RegulatoryComplianceSolution; _uri: string; _bundles?: BundleListInstance; bundles: BundleListInstance; _endUsers?: EndUserListInstance; endUsers: EndUserListInstance; _endUserTypes?: EndUserTypeListInstance; endUserTypes: EndUserTypeListInstance; _regulations?: RegulationListInstance; regulations: RegulationListInstance; _supportingDocuments?: SupportingDocumentListInstance; supportingDocuments: SupportingDocumentListInstance; _supportingDocumentTypes?: SupportingDocumentTypeListInstance; supportingDocumentTypes: SupportingDocumentTypeListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RegulatoryComplianceListInstance(version: V2): RegulatoryComplianceListInstance; rest/numbers/v2/hostedNumberOrder.js000064400000030000151677225100013513 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HostedNumberOrderPage = exports.HostedNumberOrderListInstance = exports.HostedNumberOrderInstance = exports.HostedNumberOrderContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class HostedNumberOrderContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/HostedNumber/Orders/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.HostedNumberOrderContextImpl = HostedNumberOrderContextImpl; class HostedNumberOrderInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.incomingPhoneNumberSid = payload.incoming_phone_number_sid; this.addressSid = payload.address_sid; this.signingDocumentSid = payload.signing_document_sid; this.phoneNumber = payload.phone_number; this.capabilities = payload.capabilities; this.friendlyName = payload.friendly_name; this.status = payload.status; this.failureReason = payload.failure_reason; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.email = payload.email; this.ccEmails = payload.cc_emails; this.url = payload.url; this.contactTitle = payload.contact_title; this.contactPhoneNumber = payload.contact_phone_number; this.bulkHostingRequestSid = payload.bulk_hosting_request_sid; this.nextStep = payload.next_step; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new HostedNumberOrderContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, incomingPhoneNumberSid: this.incomingPhoneNumberSid, addressSid: this.addressSid, signingDocumentSid: this.signingDocumentSid, phoneNumber: this.phoneNumber, capabilities: this.capabilities, friendlyName: this.friendlyName, status: this.status, failureReason: this.failureReason, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, email: this.email, ccEmails: this.ccEmails, url: this.url, contactTitle: this.contactTitle, contactPhoneNumber: this.contactPhoneNumber, bulkHostingRequestSid: this.bulkHostingRequestSid, nextStep: this.nextStep, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.HostedNumberOrderInstance = HostedNumberOrderInstance; function HostedNumberOrderListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new HostedNumberOrderContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/HostedNumber/Orders`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["phoneNumber"] === null || params["phoneNumber"] === undefined) { throw new Error("Required parameter \"params['phoneNumber']\" missing."); } if (params["contactPhoneNumber"] === null || params["contactPhoneNumber"] === undefined) { throw new Error("Required parameter \"params['contactPhoneNumber']\" missing."); } if (params["addressSid"] === null || params["addressSid"] === undefined) { throw new Error("Required parameter \"params['addressSid']\" missing."); } if (params["email"] === null || params["email"] === undefined) { throw new Error("Required parameter \"params['email']\" missing."); } let data = {}; data["PhoneNumber"] = params["phoneNumber"]; data["ContactPhoneNumber"] = params["contactPhoneNumber"]; data["AddressSid"] = params["addressSid"]; data["Email"] = params["email"]; if (params["accountSid"] !== undefined) data["AccountSid"] = params["accountSid"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["ccEmails"] !== undefined) data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e); if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsCapability"] !== undefined) data["SmsCapability"] = serialize.bool(params["smsCapability"]); if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["statusCallbackUrl"] !== undefined) data["StatusCallbackUrl"] = params["statusCallbackUrl"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["smsApplicationSid"] !== undefined) data["SmsApplicationSid"] = params["smsApplicationSid"]; if (params["contactTitle"] !== undefined) data["ContactTitle"] = params["contactTitle"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["smsCapability"] !== undefined) data["SmsCapability"] = serialize.bool(params["smsCapability"]); if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["incomingPhoneNumberSid"] !== undefined) data["IncomingPhoneNumberSid"] = params["incomingPhoneNumberSid"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new HostedNumberOrderPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new HostedNumberOrderPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.HostedNumberOrderListInstance = HostedNumberOrderListInstance; class HostedNumberOrderPage extends Page_1.default { /** * Initialize the HostedNumberOrderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of HostedNumberOrderInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new HostedNumberOrderInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.HostedNumberOrderPage = HostedNumberOrderPage; rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.d.ts000064400000030075151677225100022211 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; import { PhoneNumberCapabilities } from "../../../../interfaces"; export type DependentHostedNumberOrderStatus = "received" | "verified" | "pending-loa" | "carrier-processing" | "completed" | "failed" | "action-required"; /** * Options to pass to each */ export interface DependentHostedNumberOrderListInstanceEachOptions { /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: DependentHostedNumberOrderStatus; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 128 characters. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface DependentHostedNumberOrderListInstanceOptions { /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: DependentHostedNumberOrderStatus; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 128 characters. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface DependentHostedNumberOrderListInstancePageOptions { /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: DependentHostedNumberOrderStatus; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 128 characters. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface DependentHostedNumberOrderSolution { signingDocumentSid: string; } export interface DependentHostedNumberOrderListInstance { _version: V2; _solution: DependentHostedNumberOrderSolution; _uri: string; /** * Streams DependentHostedNumberOrderInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { DependentHostedNumberOrderListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void): void; each(params: DependentHostedNumberOrderListInstanceEachOptions, callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DependentHostedNumberOrderInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: DependentHostedNumberOrderPage) => any): Promise<DependentHostedNumberOrderPage>; /** * Lists DependentHostedNumberOrderInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { DependentHostedNumberOrderListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DependentHostedNumberOrderInstance[]) => any): Promise<DependentHostedNumberOrderInstance[]>; list(params: DependentHostedNumberOrderListInstanceOptions, callback?: (error: Error | null, items: DependentHostedNumberOrderInstance[]) => any): Promise<DependentHostedNumberOrderInstance[]>; /** * Retrieve a single page of DependentHostedNumberOrderInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { DependentHostedNumberOrderListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DependentHostedNumberOrderPage) => any): Promise<DependentHostedNumberOrderPage>; page(params: DependentHostedNumberOrderListInstancePageOptions, callback?: (error: Error | null, items: DependentHostedNumberOrderPage) => any): Promise<DependentHostedNumberOrderPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DependentHostedNumberOrderListInstance(version: V2, signingDocumentSid: string): DependentHostedNumberOrderListInstance; interface DependentHostedNumberOrderPayload extends TwilioResponsePayload { items: DependentHostedNumberOrderResource[]; } interface DependentHostedNumberOrderResource { sid: string; bulk_hosting_request_sid: string; next_step: string; account_sid: string; incoming_phone_number_sid: string; address_sid: string; signing_document_sid: string; phone_number: string; capabilities: PhoneNumberCapabilities; friendly_name: string; status: DependentHostedNumberOrderStatus; failure_reason: string; date_created: Date; date_updated: Date; email: string; cc_emails: Array<string>; contact_title: string; contact_phone_number: string; } export declare class DependentHostedNumberOrderInstance { protected _version: V2; constructor(_version: V2, payload: DependentHostedNumberOrderResource, signingDocumentSid: string); /** * A 34 character string that uniquely identifies this Authorization Document */ sid: string; /** * A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder. */ bulkHostingRequestSid: string; /** * The next step you need to take to complete the hosted number order and request it successfully. */ nextStep: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid: string; /** * A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. */ addressSid: string; /** * A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder. */ signingDocumentSid: string; /** * An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber: string; capabilities: PhoneNumberCapabilities; /** * A human readable description of this resource, up to 128 characters. */ friendlyName: string; status: DependentHostedNumberOrderStatus; /** * A message that explains why a hosted_number_order went to status \"action-required\" */ failureReason: string; /** * The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * Email of the owner of this phone number that is being hosted. */ email: string; /** * Email recipients who will be informed when an Authorization Document has been sent and signed */ ccEmails: Array<string>; /** * The title of the person authorized to sign the Authorization Document for this phone number. */ contactTitle: string; /** * The contact phone number of the person authorized to sign the Authorization Document. */ contactPhoneNumber: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; bulkHostingRequestSid: string; nextStep: string; accountSid: string; incomingPhoneNumberSid: string; addressSid: string; signingDocumentSid: string; phoneNumber: string; capabilities: PhoneNumberCapabilities; friendlyName: string; status: DependentHostedNumberOrderStatus; failureReason: string; dateCreated: Date; dateUpdated: Date; email: string; ccEmails: string[]; contactTitle: string; contactPhoneNumber: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class DependentHostedNumberOrderPage extends Page<V2, DependentHostedNumberOrderPayload, DependentHostedNumberOrderResource, DependentHostedNumberOrderInstance> { /** * Initialize the DependentHostedNumberOrderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: DependentHostedNumberOrderSolution); /** * Build an instance of DependentHostedNumberOrderInstance * * @param payload - Payload response from the API */ getInstance(payload: DependentHostedNumberOrderResource): DependentHostedNumberOrderInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/authorizationDocument/dependentHostedNumberOrder.js000064400000015572151677225100021762 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DependentHostedNumberOrderPage = exports.DependentHostedNumberOrderInstance = exports.DependentHostedNumberOrderListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function DependentHostedNumberOrderListInstance(version, signingDocumentSid) { if (!(0, utility_1.isValidPathParam)(signingDocumentSid)) { throw new Error("Parameter 'signingDocumentSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { signingDocumentSid }; instance._uri = `/HostedNumber/AuthorizationDocuments/${signingDocumentSid}/DependentHostedNumberOrders`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["incomingPhoneNumberSid"] !== undefined) data["IncomingPhoneNumberSid"] = params["incomingPhoneNumberSid"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DependentHostedNumberOrderPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new DependentHostedNumberOrderPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.DependentHostedNumberOrderListInstance = DependentHostedNumberOrderListInstance; class DependentHostedNumberOrderInstance { constructor(_version, payload, signingDocumentSid) { this._version = _version; this.sid = payload.sid; this.bulkHostingRequestSid = payload.bulk_hosting_request_sid; this.nextStep = payload.next_step; this.accountSid = payload.account_sid; this.incomingPhoneNumberSid = payload.incoming_phone_number_sid; this.addressSid = payload.address_sid; this.signingDocumentSid = payload.signing_document_sid; this.phoneNumber = payload.phone_number; this.capabilities = payload.capabilities; this.friendlyName = payload.friendly_name; this.status = payload.status; this.failureReason = payload.failure_reason; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.email = payload.email; this.ccEmails = payload.cc_emails; this.contactTitle = payload.contact_title; this.contactPhoneNumber = payload.contact_phone_number; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, bulkHostingRequestSid: this.bulkHostingRequestSid, nextStep: this.nextStep, accountSid: this.accountSid, incomingPhoneNumberSid: this.incomingPhoneNumberSid, addressSid: this.addressSid, signingDocumentSid: this.signingDocumentSid, phoneNumber: this.phoneNumber, capabilities: this.capabilities, friendlyName: this.friendlyName, status: this.status, failureReason: this.failureReason, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, email: this.email, ccEmails: this.ccEmails, contactTitle: this.contactTitle, contactPhoneNumber: this.contactPhoneNumber, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DependentHostedNumberOrderInstance = DependentHostedNumberOrderInstance; class DependentHostedNumberOrderPage extends Page_1.default { /** * Initialize the DependentHostedNumberOrderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of DependentHostedNumberOrderInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DependentHostedNumberOrderInstance(this._version, payload, this._solution.signingDocumentSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DependentHostedNumberOrderPage = DependentHostedNumberOrderPage; rest/numbers/v2/authorizationDocument.js000064400000024327151677225100014476 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AuthorizationDocumentPage = exports.AuthorizationDocumentListInstance = exports.AuthorizationDocumentInstance = exports.AuthorizationDocumentContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const dependentHostedNumberOrder_1 = require("./authorizationDocument/dependentHostedNumberOrder"); class AuthorizationDocumentContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/HostedNumber/AuthorizationDocuments/${sid}`; } get dependentHostedNumberOrders() { this._dependentHostedNumberOrders = this._dependentHostedNumberOrders || (0, dependentHostedNumberOrder_1.DependentHostedNumberOrderListInstance)(this._version, this._solution.sid); return this._dependentHostedNumberOrders; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AuthorizationDocumentInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthorizationDocumentContextImpl = AuthorizationDocumentContextImpl; class AuthorizationDocumentInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.addressSid = payload.address_sid; this.status = payload.status; this.email = payload.email; this.ccEmails = payload.cc_emails; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AuthorizationDocumentContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the dependentHostedNumberOrders. */ dependentHostedNumberOrders() { return this._proxy.dependentHostedNumberOrders; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, addressSid: this.addressSid, status: this.status, email: this.email, ccEmails: this.ccEmails, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthorizationDocumentInstance = AuthorizationDocumentInstance; function AuthorizationDocumentListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AuthorizationDocumentContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/HostedNumber/AuthorizationDocuments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["addressSid"] === null || params["addressSid"] === undefined) { throw new Error("Required parameter \"params['addressSid']\" missing."); } if (params["email"] === null || params["email"] === undefined) { throw new Error("Required parameter \"params['email']\" missing."); } if (params["contactPhoneNumber"] === null || params["contactPhoneNumber"] === undefined) { throw new Error("Required parameter \"params['contactPhoneNumber']\" missing."); } if (params["hostedNumberOrderSids"] === null || params["hostedNumberOrderSids"] === undefined) { throw new Error("Required parameter \"params['hostedNumberOrderSids']\" missing."); } let data = {}; data["AddressSid"] = params["addressSid"]; data["Email"] = params["email"]; data["ContactPhoneNumber"] = params["contactPhoneNumber"]; data["HostedNumberOrderSids"] = serialize.map(params["hostedNumberOrderSids"], (e) => e); if (params["contactTitle"] !== undefined) data["ContactTitle"] = params["contactTitle"]; if (params["ccEmails"] !== undefined) data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AuthorizationDocumentInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["email"] !== undefined) data["Email"] = params["email"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AuthorizationDocumentPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new AuthorizationDocumentPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.AuthorizationDocumentListInstance = AuthorizationDocumentListInstance; class AuthorizationDocumentPage extends Page_1.default { /** * Initialize the AuthorizationDocumentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of AuthorizationDocumentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AuthorizationDocumentInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthorizationDocumentPage = AuthorizationDocumentPage; rest/numbers/v2/hostedNumberOrder.d.ts000064400000042111151677225100013755 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; import { PhoneNumberCapabilities } from "../../../interfaces"; export type HostedNumberOrderStatus = "received" | "verified" | "pending-loa" | "carrier-processing" | "completed" | "failed" | "action-required"; /** * Options to pass to create a HostedNumberOrderInstance */ export interface HostedNumberOrderListInstanceCreateOptions { /** The number to host in [+E.164](https://en.wikipedia.org/wiki/E.164) format */ phoneNumber: string; /** The contact phone number of the person authorized to sign the Authorization Document. */ contactPhoneNumber: string; /** Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. */ addressSid: string; /** Optional. Email of the owner of this phone number that is being hosted. */ email: string; /** This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to. */ accountSid?: string; /** A 128 character string that is a human readable text that describes this resource. */ friendlyName?: string; /** Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to. */ ccEmails?: Array<string>; /** The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource. */ smsUrl?: string; /** The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. */ smsMethod?: string; /** A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource. */ smsFallbackUrl?: string; /** Used to specify that the SMS capability will be hosted on Twilio\\\'s platform. */ smsCapability?: boolean; /** The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. */ smsFallbackMethod?: string; /** Optional. The Status Callback URL attached to the IncomingPhoneNumber resource. */ statusCallbackUrl?: string; /** Optional. The Status Callback Method attached to the IncomingPhoneNumber resource. */ statusCallbackMethod?: string; /** Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application. */ smsApplicationSid?: string; /** The title of the person authorized to sign the Authorization Document for this phone number. */ contactTitle?: string; } /** * Options to pass to each */ export interface HostedNumberOrderListInstanceEachOptions { /** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */ status?: HostedNumberOrderStatus; /** Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. */ smsCapability?: boolean; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 128 characters. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface HostedNumberOrderListInstanceOptions { /** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */ status?: HostedNumberOrderStatus; /** Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. */ smsCapability?: boolean; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 128 characters. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface HostedNumberOrderListInstancePageOptions { /** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */ status?: HostedNumberOrderStatus; /** Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. */ smsCapability?: boolean; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 128 characters. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface HostedNumberOrderContext { /** * Remove a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface HostedNumberOrderContextSolution { sid: string; } export declare class HostedNumberOrderContextImpl implements HostedNumberOrderContext { protected _version: V2; protected _solution: HostedNumberOrderContextSolution; protected _uri: string; constructor(_version: V2, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): HostedNumberOrderContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface HostedNumberOrderPayload extends TwilioResponsePayload { items: HostedNumberOrderResource[]; } interface HostedNumberOrderResource { sid: string; account_sid: string; incoming_phone_number_sid: string; address_sid: string; signing_document_sid: string; phone_number: string; capabilities: PhoneNumberCapabilities; friendly_name: string; status: HostedNumberOrderStatus; failure_reason: string; date_created: Date; date_updated: Date; email: string; cc_emails: Array<string>; url: string; contact_title: string; contact_phone_number: string; bulk_hosting_request_sid: string; next_step: string; } export declare class HostedNumberOrderInstance { protected _version: V2; protected _solution: HostedNumberOrderContextSolution; protected _context?: HostedNumberOrderContext; constructor(_version: V2, payload: HostedNumberOrderResource, sid?: string); /** * A 34 character string that uniquely identifies this HostedNumberOrder. */ sid: string; /** * A 34 character string that uniquely identifies the account. */ accountSid: string; /** * A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the phone number being hosted. */ incomingPhoneNumberSid: string; /** * A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. */ addressSid: string; /** * A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource) the user needs to sign. */ signingDocumentSid: string; /** * Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212 */ phoneNumber: string; capabilities: PhoneNumberCapabilities; /** * A 128 character string that is a human-readable text that describes this resource. */ friendlyName: string; status: HostedNumberOrderStatus; /** * A message that explains why a hosted_number_order went to status \"action-required\" */ failureReason: string; /** * The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * Email of the owner of this phone number that is being hosted. */ email: string; /** * A list of emails that LOA document for this HostedNumberOrder will be carbon copied to. */ ccEmails: Array<string>; /** * The URL of this HostedNumberOrder. */ url: string; /** * The title of the person authorized to sign the Authorization Document for this phone number. */ contactTitle: string; /** * The contact phone number of the person authorized to sign the Authorization Document. */ contactPhoneNumber: string; /** * A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder. */ bulkHostingRequestSid: string; /** * The next step you need to take to complete the hosted number order and request it successfully. */ nextStep: string; private get _proxy(); /** * Remove a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; incomingPhoneNumberSid: string; addressSid: string; signingDocumentSid: string; phoneNumber: string; capabilities: PhoneNumberCapabilities; friendlyName: string; status: HostedNumberOrderStatus; failureReason: string; dateCreated: Date; dateUpdated: Date; email: string; ccEmails: string[]; url: string; contactTitle: string; contactPhoneNumber: string; bulkHostingRequestSid: string; nextStep: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface HostedNumberOrderSolution { } export interface HostedNumberOrderListInstance { _version: V2; _solution: HostedNumberOrderSolution; _uri: string; (sid: string): HostedNumberOrderContext; get(sid: string): HostedNumberOrderContext; /** * Create a HostedNumberOrderInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ create(params: HostedNumberOrderListInstanceCreateOptions, callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Streams HostedNumberOrderInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { HostedNumberOrderListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void; each(params: HostedNumberOrderListInstanceEachOptions, callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of HostedNumberOrderInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>; /** * Lists HostedNumberOrderInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { HostedNumberOrderListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: HostedNumberOrderInstance[]) => any): Promise<HostedNumberOrderInstance[]>; list(params: HostedNumberOrderListInstanceOptions, callback?: (error: Error | null, items: HostedNumberOrderInstance[]) => any): Promise<HostedNumberOrderInstance[]>; /** * Retrieve a single page of HostedNumberOrderInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { HostedNumberOrderListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>; page(params: HostedNumberOrderListInstancePageOptions, callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function HostedNumberOrderListInstance(version: V2): HostedNumberOrderListInstance; export declare class HostedNumberOrderPage extends Page<V2, HostedNumberOrderPayload, HostedNumberOrderResource, HostedNumberOrderInstance> { /** * Initialize the HostedNumberOrderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: HostedNumberOrderSolution); /** * Build an instance of HostedNumberOrderInstance * * @param payload - Payload response from the API */ getInstance(payload: HostedNumberOrderResource): HostedNumberOrderInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/regulation.d.ts000064400000022654151677225100016675 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type RegulationEndUserType = "individual" | "business"; /** * Options to pass to each */ export interface RegulationListInstanceEachOptions { /** The type of End User the regulation requires - can be `individual` or `business`. */ endUserType?: RegulationEndUserType; /** The ISO country code of the phone number\'s country. */ isoCountry?: string; /** The type of phone number that the regulatory requiremnt is restricting. */ numberType?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: RegulationInstance, 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 RegulationListInstanceOptions { /** The type of End User the regulation requires - can be `individual` or `business`. */ endUserType?: RegulationEndUserType; /** The ISO country code of the phone number\'s country. */ isoCountry?: string; /** The type of phone number that the regulatory requiremnt is restricting. */ numberType?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface RegulationListInstancePageOptions { /** The type of End User the regulation requires - can be `individual` or `business`. */ endUserType?: RegulationEndUserType; /** The ISO country code of the phone number\'s country. */ isoCountry?: string; /** The type of phone number that the regulatory requiremnt is restricting. */ numberType?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface RegulationContext { /** * Fetch a RegulationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RegulationInstance */ fetch(callback?: (error: Error | null, item?: RegulationInstance) => any): Promise<RegulationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RegulationContextSolution { sid: string; } export declare class RegulationContextImpl implements RegulationContext { protected _version: V2; protected _solution: RegulationContextSolution; protected _uri: string; constructor(_version: V2, sid: string); fetch(callback?: (error: Error | null, item?: RegulationInstance) => any): Promise<RegulationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RegulationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RegulationPayload extends TwilioResponsePayload { results: RegulationResource[]; } interface RegulationResource { sid: string; friendly_name: string; iso_country: string; number_type: string; end_user_type: RegulationEndUserType; requirements: any; url: string; } export declare class RegulationInstance { protected _version: V2; protected _solution: RegulationContextSolution; protected _context?: RegulationContext; constructor(_version: V2, payload: RegulationResource, sid?: string); /** * The unique string that identifies the Regulation resource. */ sid: string; /** * A human-readable description that is assigned to describe the Regulation resource. Examples can include Germany: Mobile - Business. */ friendlyName: string; /** * The ISO country code of the phone number\'s country. */ isoCountry: string; /** * The type of phone number restricted by the regulatory requirement. For example, Germany mobile phone numbers provisioned by businesses require a business name with commercial register proof from the Handelsregisterauszug and a proof of address from Handelsregisterauszug or a trade license by Gewerbeanmeldung. */ numberType: string; endUserType: RegulationEndUserType; /** * The SID of an object that holds the regulatory information of the phone number country, phone number type, and end user type. */ requirements: any; /** * The absolute URL of the Regulation resource. */ url: string; private get _proxy(); /** * Fetch a RegulationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RegulationInstance */ fetch(callback?: (error: Error | null, item?: RegulationInstance) => any): Promise<RegulationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; isoCountry: string; numberType: string; endUserType: RegulationEndUserType; requirements: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RegulationSolution { } export interface RegulationListInstance { _version: V2; _solution: RegulationSolution; _uri: string; (sid: string): RegulationContext; get(sid: string): RegulationContext; /** * Streams RegulationInstance 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 { RegulationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RegulationInstance, done: (err?: Error) => void) => void): void; each(params: RegulationListInstanceEachOptions, callback?: (item: RegulationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RegulationInstance 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: RegulationPage) => any): Promise<RegulationPage>; /** * Lists RegulationInstance 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 { RegulationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RegulationInstance[]) => any): Promise<RegulationInstance[]>; list(params: RegulationListInstanceOptions, callback?: (error: Error | null, items: RegulationInstance[]) => any): Promise<RegulationInstance[]>; /** * Retrieve a single page of RegulationInstance 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 { RegulationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RegulationPage) => any): Promise<RegulationPage>; page(params: RegulationListInstancePageOptions, callback?: (error: Error | null, items: RegulationPage) => any): Promise<RegulationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RegulationListInstance(version: V2): RegulationListInstance; export declare class RegulationPage extends Page<V2, RegulationPayload, RegulationResource, RegulationInstance> { /** * Initialize the RegulationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: RegulationSolution); /** * Build an instance of RegulationInstance * * @param payload - Payload response from the API */ getInstance(payload: RegulationResource): RegulationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/supportingDocumentType.d.ts000064400000021261151677225100021270 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; /** * Options to pass to each */ export interface SupportingDocumentTypeListInstanceEachOptions { /** 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: SupportingDocumentTypeInstance, 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 SupportingDocumentTypeListInstanceOptions { /** 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 SupportingDocumentTypeListInstancePageOptions { /** 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 SupportingDocumentTypeContext { /** * Fetch a SupportingDocumentTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentTypeInstance */ fetch(callback?: (error: Error | null, item?: SupportingDocumentTypeInstance) => any): Promise<SupportingDocumentTypeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SupportingDocumentTypeContextSolution { sid: string; } export declare class SupportingDocumentTypeContextImpl implements SupportingDocumentTypeContext { protected _version: V2; protected _solution: SupportingDocumentTypeContextSolution; protected _uri: string; constructor(_version: V2, sid: string); fetch(callback?: (error: Error | null, item?: SupportingDocumentTypeInstance) => any): Promise<SupportingDocumentTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SupportingDocumentTypeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SupportingDocumentTypePayload extends TwilioResponsePayload { supporting_document_types: SupportingDocumentTypeResource[]; } interface SupportingDocumentTypeResource { sid: string; friendly_name: string; machine_name: string; fields: Array<any>; url: string; } export declare class SupportingDocumentTypeInstance { protected _version: V2; protected _solution: SupportingDocumentTypeContextSolution; protected _context?: SupportingDocumentTypeContext; constructor(_version: V2, payload: SupportingDocumentTypeResource, sid?: string); /** * The unique string that identifies the Supporting Document Type resource. */ sid: string; /** * A human-readable description of the Supporting Document Type resource. */ friendlyName: string; /** * The machine-readable description of the Supporting Document Type resource. */ machineName: string; /** * The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals. */ fields: Array<any>; /** * The absolute URL of the Supporting Document Type resource. */ url: string; private get _proxy(); /** * Fetch a SupportingDocumentTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentTypeInstance */ fetch(callback?: (error: Error | null, item?: SupportingDocumentTypeInstance) => any): Promise<SupportingDocumentTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; machineName: string; fields: any[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SupportingDocumentTypeSolution { } export interface SupportingDocumentTypeListInstance { _version: V2; _solution: SupportingDocumentTypeSolution; _uri: string; (sid: string): SupportingDocumentTypeContext; get(sid: string): SupportingDocumentTypeContext; /** * Streams SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SupportingDocumentTypeInstance, done: (err?: Error) => void) => void): void; each(params: SupportingDocumentTypeListInstanceEachOptions, callback?: (item: SupportingDocumentTypeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SupportingDocumentTypeInstance 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: SupportingDocumentTypePage) => any): Promise<SupportingDocumentTypePage>; /** * Lists SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SupportingDocumentTypeInstance[]) => any): Promise<SupportingDocumentTypeInstance[]>; list(params: SupportingDocumentTypeListInstanceOptions, callback?: (error: Error | null, items: SupportingDocumentTypeInstance[]) => any): Promise<SupportingDocumentTypeInstance[]>; /** * Retrieve a single page of SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SupportingDocumentTypePage) => any): Promise<SupportingDocumentTypePage>; page(params: SupportingDocumentTypeListInstancePageOptions, callback?: (error: Error | null, items: SupportingDocumentTypePage) => any): Promise<SupportingDocumentTypePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SupportingDocumentTypeListInstance(version: V2): SupportingDocumentTypeListInstance; export declare class SupportingDocumentTypePage extends Page<V2, SupportingDocumentTypePayload, SupportingDocumentTypeResource, SupportingDocumentTypeInstance> { /** * Initialize the SupportingDocumentTypePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: SupportingDocumentTypeSolution); /** * Build an instance of SupportingDocumentTypeInstance * * @param payload - Payload response from the API */ getInstance(payload: SupportingDocumentTypeResource): SupportingDocumentTypeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/endUserType.js000064400000014457151677225100016541 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.EndUserTypePage = exports.EndUserTypeListInstance = exports.EndUserTypeInstance = exports.EndUserTypeContextImpl = void 0; 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 EndUserTypeContextImpl { 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 = `/RegulatoryCompliance/EndUserTypes/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EndUserTypeInstance(operationVersion, payload, 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.EndUserTypeContextImpl = EndUserTypeContextImpl; class EndUserTypeInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.machineName = payload.machine_name; this.fields = payload.fields; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new EndUserTypeContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a EndUserTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserTypeInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, machineName: this.machineName, fields: this.fields, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EndUserTypeInstance = EndUserTypeInstance; function EndUserTypeListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EndUserTypeContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/RegulatoryCompliance/EndUserTypes`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EndUserTypePage(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 EndUserTypePage(instance._version, payload, 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; } exports.EndUserTypeListInstance = EndUserTypeListInstance; class EndUserTypePage extends Page_1.default { /** * Initialize the EndUserTypePage * * @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 EndUserTypeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EndUserTypeInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EndUserTypePage = EndUserTypePage; rest/numbers/v2/regulatoryCompliance/endUser.d.ts000064400000026446151677225100016134 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type EndUserType = "individual" | "business"; /** * Options to pass to update a EndUserInstance */ export interface EndUserContextUpdateOptions { /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The set of parameters that are the attributes of the End User resource which are derived End User Types. */ attributes?: any; } /** * Options to pass to create a EndUserInstance */ export interface EndUserListInstanceCreateOptions { /** The string that you assigned to describe the resource. */ friendlyName: string; /** */ type: EndUserType; /** The set of parameters that are the attributes of the End User resource which are derived End User Types. */ attributes?: any; } /** * Options to pass to each */ export interface EndUserListInstanceEachOptions { /** 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: EndUserInstance, 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 EndUserListInstanceOptions { /** 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 EndUserListInstancePageOptions { /** 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 EndUserContext { /** * Remove a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ fetch(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Update a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ update(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Update a EndUserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ update(params: EndUserContextUpdateOptions, callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EndUserContextSolution { sid: string; } export declare class EndUserContextImpl implements EndUserContext { protected _version: V2; protected _solution: EndUserContextSolution; protected _uri: string; constructor(_version: V2, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; update(params?: EndUserContextUpdateOptions | ((error: Error | null, item?: EndUserInstance) => any), callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EndUserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EndUserPayload extends TwilioResponsePayload { results: EndUserResource[]; } interface EndUserResource { sid: string; account_sid: string; friendly_name: string; type: EndUserType; attributes: any; date_created: Date; date_updated: Date; url: string; } export declare class EndUserInstance { protected _version: V2; protected _solution: EndUserContextSolution; protected _context?: EndUserContext; constructor(_version: V2, payload: EndUserResource, sid?: string); /** * The unique string created by Twilio to identify the End User resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; type: EndUserType; /** * The set of parameters that are the attributes of the End Users resource which are listed in the End User Types. */ attributes: any; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the End User resource. */ url: string; private get _proxy(); /** * Remove a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ fetch(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Update a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ update(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Update a EndUserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ update(params: EndUserContextUpdateOptions, callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; type: EndUserType; attributes: any; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EndUserSolution { } export interface EndUserListInstance { _version: V2; _solution: EndUserSolution; _uri: string; (sid: string): EndUserContext; get(sid: string): EndUserContext; /** * Create a EndUserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ create(params: EndUserListInstanceCreateOptions, callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Streams EndUserInstance 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 { EndUserListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EndUserInstance, done: (err?: Error) => void) => void): void; each(params: EndUserListInstanceEachOptions, callback?: (item: EndUserInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EndUserInstance 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: EndUserPage) => any): Promise<EndUserPage>; /** * Lists EndUserInstance 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 { EndUserListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EndUserInstance[]) => any): Promise<EndUserInstance[]>; list(params: EndUserListInstanceOptions, callback?: (error: Error | null, items: EndUserInstance[]) => any): Promise<EndUserInstance[]>; /** * Retrieve a single page of EndUserInstance 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 { EndUserListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EndUserPage) => any): Promise<EndUserPage>; page(params: EndUserListInstancePageOptions, callback?: (error: Error | null, items: EndUserPage) => any): Promise<EndUserPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EndUserListInstance(version: V2): EndUserListInstance; export declare class EndUserPage extends Page<V2, EndUserPayload, EndUserResource, EndUserInstance> { /** * Initialize the EndUserPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: EndUserSolution); /** * Build an instance of EndUserInstance * * @param payload - Payload response from the API */ getInstance(payload: EndUserResource): EndUserInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/endUser.js000064400000022770151677225100015674 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.EndUserPage = exports.EndUserListInstance = exports.EndUserInstance = exports.EndUserContextImpl = void 0; 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 EndUserContextImpl { 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 = `/RegulatoryCompliance/EndUsers/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EndUserInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["attributes"] !== undefined) data["Attributes"] = serialize.object(params["attributes"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new EndUserInstance(operationVersion, payload, 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.EndUserContextImpl = EndUserContextImpl; class EndUserInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.attributes = payload.attributes; 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 EndUserContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, type: this.type, attributes: this.attributes, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EndUserInstance = EndUserInstance; function EndUserListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EndUserContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/RegulatoryCompliance/EndUsers`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; if (params["attributes"] !== undefined) data["Attributes"] = serialize.object(params["attributes"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new EndUserInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EndUserPage(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 EndUserPage(instance._version, payload, 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; } exports.EndUserListInstance = EndUserListInstance; class EndUserPage extends Page_1.default { /** * Initialize the EndUserPage * * @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 EndUserInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EndUserInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EndUserPage = EndUserPage; rest/numbers/v2/regulatoryCompliance/supportingDocument.js000064400000024110151677225100020166 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.SupportingDocumentPage = exports.SupportingDocumentListInstance = exports.SupportingDocumentInstance = exports.SupportingDocumentContextImpl = void 0; 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 SupportingDocumentContextImpl { 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 = `/RegulatoryCompliance/SupportingDocuments/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SupportingDocumentInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["attributes"] !== undefined) data["Attributes"] = serialize.object(params["attributes"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SupportingDocumentInstance(operationVersion, payload, 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.SupportingDocumentContextImpl = SupportingDocumentContextImpl; class SupportingDocumentInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.mimeType = payload.mime_type; this.status = payload.status; this.failureReason = payload.failure_reason; this.type = payload.type; this.attributes = payload.attributes; 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 SupportingDocumentContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, mimeType: this.mimeType, status: this.status, failureReason: this.failureReason, type: this.type, attributes: this.attributes, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SupportingDocumentInstance = SupportingDocumentInstance; function SupportingDocumentListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SupportingDocumentContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/RegulatoryCompliance/SupportingDocuments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; if (params["attributes"] !== undefined) data["Attributes"] = serialize.object(params["attributes"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SupportingDocumentInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SupportingDocumentPage(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 SupportingDocumentPage(instance._version, payload, 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; } exports.SupportingDocumentListInstance = SupportingDocumentListInstance; class SupportingDocumentPage extends Page_1.default { /** * Initialize the SupportingDocumentPage * * @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 SupportingDocumentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SupportingDocumentInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SupportingDocumentPage = SupportingDocumentPage; rest/numbers/v2/regulatoryCompliance/bundle/bundleCopy.d.ts000064400000020463151677225100020075 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type BundleCopyStatus = "draft" | "pending-review" | "in-review" | "twilio-rejected" | "twilio-approved" | "provisionally-approved"; /** * Options to pass to create a BundleCopyInstance */ export interface BundleCopyListInstanceCreateOptions { /** The string that you assigned to describe the copied bundle. */ friendlyName?: string; } /** * Options to pass to each */ export interface BundleCopyListInstanceEachOptions { /** 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: BundleCopyInstance, 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 BundleCopyListInstanceOptions { /** 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 BundleCopyListInstancePageOptions { /** 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 BundleCopySolution { bundleSid: string; } export interface BundleCopyListInstance { _version: V2; _solution: BundleCopySolution; _uri: string; /** * Create a BundleCopyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleCopyInstance */ create(callback?: (error: Error | null, item?: BundleCopyInstance) => any): Promise<BundleCopyInstance>; /** * Create a BundleCopyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleCopyInstance */ create(params: BundleCopyListInstanceCreateOptions, callback?: (error: Error | null, item?: BundleCopyInstance) => any): Promise<BundleCopyInstance>; /** * Streams BundleCopyInstance 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 { BundleCopyListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BundleCopyInstance, done: (err?: Error) => void) => void): void; each(params: BundleCopyListInstanceEachOptions, callback?: (item: BundleCopyInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BundleCopyInstance 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: BundleCopyPage) => any): Promise<BundleCopyPage>; /** * Lists BundleCopyInstance 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 { BundleCopyListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BundleCopyInstance[]) => any): Promise<BundleCopyInstance[]>; list(params: BundleCopyListInstanceOptions, callback?: (error: Error | null, items: BundleCopyInstance[]) => any): Promise<BundleCopyInstance[]>; /** * Retrieve a single page of BundleCopyInstance 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 { BundleCopyListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BundleCopyPage) => any): Promise<BundleCopyPage>; page(params: BundleCopyListInstancePageOptions, callback?: (error: Error | null, items: BundleCopyPage) => any): Promise<BundleCopyPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BundleCopyListInstance(version: V2, bundleSid: string): BundleCopyListInstance; interface BundleCopyPayload extends TwilioResponsePayload { results: BundleCopyResource[]; } interface BundleCopyResource { sid: string; account_sid: string; regulation_sid: string; friendly_name: string; status: BundleCopyStatus; valid_until: Date; email: string; status_callback: string; date_created: Date; date_updated: Date; } export declare class BundleCopyInstance { protected _version: V2; constructor(_version: V2, payload: BundleCopyResource, bundleSid: string); /** * The unique string that we created to identify the Bundle resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. */ accountSid: string; /** * The unique string of a regulation that is associated to the Bundle resource. */ regulationSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; status: BundleCopyStatus; /** * The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. */ validUntil: Date; /** * The email address that will receive updates when the Bundle resource changes status. */ email: string; /** * The URL we call to inform your application of status changes. */ statusCallback: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; regulationSid: string; friendlyName: string; status: BundleCopyStatus; validUntil: Date; email: string; statusCallback: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class BundleCopyPage extends Page<V2, BundleCopyPayload, BundleCopyResource, BundleCopyInstance> { /** * Initialize the BundleCopyPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: BundleCopySolution); /** * Build an instance of BundleCopyInstance * * @param payload - Payload response from the API */ getInstance(payload: BundleCopyResource): BundleCopyInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/bundle/replaceItems.js000064400000007555151677225100020161 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.ReplaceItemsInstance = exports.ReplaceItemsListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function ReplaceItemsListInstance(version, bundleSid) { if (!(0, utility_1.isValidPathParam)(bundleSid)) { throw new Error("Parameter 'bundleSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { bundleSid }; instance._uri = `/RegulatoryCompliance/Bundles/${bundleSid}/ReplaceItems`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["fromBundleSid"] === null || params["fromBundleSid"] === undefined) { throw new Error("Required parameter \"params['fromBundleSid']\" missing."); } let data = {}; data["FromBundleSid"] = params["fromBundleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ReplaceItemsInstance(operationVersion, payload, instance._solution.bundleSid)); 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; } exports.ReplaceItemsListInstance = ReplaceItemsListInstance; class ReplaceItemsInstance { constructor(_version, payload, bundleSid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.regulationSid = payload.regulation_sid; this.friendlyName = payload.friendly_name; this.status = payload.status; this.validUntil = deserialize.iso8601DateTime(payload.valid_until); this.email = payload.email; this.statusCallback = payload.status_callback; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, regulationSid: this.regulationSid, friendlyName: this.friendlyName, status: this.status, validUntil: this.validUntil, email: this.email, statusCallback: this.statusCallback, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ReplaceItemsInstance = ReplaceItemsInstance; rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.js000064400000021050151677225100020515 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.ItemAssignmentPage = exports.ItemAssignmentListInstance = exports.ItemAssignmentInstance = exports.ItemAssignmentContextImpl = void 0; 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 ItemAssignmentContextImpl { constructor(_version, bundleSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(bundleSid)) { throw new Error("Parameter 'bundleSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { bundleSid, sid }; this._uri = `/RegulatoryCompliance/Bundles/${bundleSid}/ItemAssignments/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ItemAssignmentInstance(operationVersion, payload, instance._solution.bundleSid, 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.ItemAssignmentContextImpl = ItemAssignmentContextImpl; class ItemAssignmentInstance { constructor(_version, payload, bundleSid, sid) { this._version = _version; this.sid = payload.sid; this.bundleSid = payload.bundle_sid; this.accountSid = payload.account_sid; this.objectSid = payload.object_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { bundleSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ItemAssignmentContextImpl(this._version, this._solution.bundleSid, this._solution.sid); return this._context; } /** * Remove a ItemAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ItemAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ItemAssignmentInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, bundleSid: this.bundleSid, accountSid: this.accountSid, objectSid: this.objectSid, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ItemAssignmentInstance = ItemAssignmentInstance; function ItemAssignmentListInstance(version, bundleSid) { if (!(0, utility_1.isValidPathParam)(bundleSid)) { throw new Error("Parameter 'bundleSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ItemAssignmentContextImpl(version, bundleSid, sid); }; instance._version = version; instance._solution = { bundleSid }; instance._uri = `/RegulatoryCompliance/Bundles/${bundleSid}/ItemAssignments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["objectSid"] === null || params["objectSid"] === undefined) { throw new Error("Required parameter \"params['objectSid']\" missing."); } let data = {}; data["ObjectSid"] = params["objectSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ItemAssignmentInstance(operationVersion, payload, instance._solution.bundleSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ItemAssignmentPage(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 ItemAssignmentPage(instance._version, payload, 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; } exports.ItemAssignmentListInstance = ItemAssignmentListInstance; class ItemAssignmentPage extends Page_1.default { /** * Initialize the ItemAssignmentPage * * @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 ItemAssignmentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ItemAssignmentInstance(this._version, payload, this._solution.bundleSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ItemAssignmentPage = ItemAssignmentPage; rest/numbers/v2/regulatoryCompliance/bundle/itemAssignment.d.ts000064400000023157151677225100020763 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; /** * Options to pass to create a ItemAssignmentInstance */ export interface ItemAssignmentListInstanceCreateOptions { /** The SID of an object bag that holds information of the different items. */ objectSid: string; } /** * Options to pass to each */ export interface ItemAssignmentListInstanceEachOptions { /** 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: ItemAssignmentInstance, 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 ItemAssignmentListInstanceOptions { /** 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 ItemAssignmentListInstancePageOptions { /** 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 ItemAssignmentContext { /** * Remove a ItemAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ItemAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ItemAssignmentInstance */ fetch(callback?: (error: Error | null, item?: ItemAssignmentInstance) => any): Promise<ItemAssignmentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ItemAssignmentContextSolution { bundleSid: string; sid: string; } export declare class ItemAssignmentContextImpl implements ItemAssignmentContext { protected _version: V2; protected _solution: ItemAssignmentContextSolution; protected _uri: string; constructor(_version: V2, bundleSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ItemAssignmentInstance) => any): Promise<ItemAssignmentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ItemAssignmentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ItemAssignmentPayload extends TwilioResponsePayload { results: ItemAssignmentResource[]; } interface ItemAssignmentResource { sid: string; bundle_sid: string; account_sid: string; object_sid: string; date_created: Date; url: string; } export declare class ItemAssignmentInstance { protected _version: V2; protected _solution: ItemAssignmentContextSolution; protected _context?: ItemAssignmentContext; constructor(_version: V2, payload: ItemAssignmentResource, bundleSid: string, sid?: string); /** * The unique string that we created to identify the Item Assignment resource. */ sid: string; /** * The unique string that we created to identify the Bundle resource. */ bundleSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. */ accountSid: string; /** * The SID of an object bag that holds information of the different items. */ objectSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Identity resource. */ url: string; private get _proxy(); /** * Remove a ItemAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ItemAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ItemAssignmentInstance */ fetch(callback?: (error: Error | null, item?: ItemAssignmentInstance) => any): Promise<ItemAssignmentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; bundleSid: string; accountSid: string; objectSid: string; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ItemAssignmentSolution { bundleSid: string; } export interface ItemAssignmentListInstance { _version: V2; _solution: ItemAssignmentSolution; _uri: string; (sid: string): ItemAssignmentContext; get(sid: string): ItemAssignmentContext; /** * Create a ItemAssignmentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ItemAssignmentInstance */ create(params: ItemAssignmentListInstanceCreateOptions, callback?: (error: Error | null, item?: ItemAssignmentInstance) => any): Promise<ItemAssignmentInstance>; /** * Streams ItemAssignmentInstance 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 { ItemAssignmentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ItemAssignmentInstance, done: (err?: Error) => void) => void): void; each(params: ItemAssignmentListInstanceEachOptions, callback?: (item: ItemAssignmentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ItemAssignmentInstance 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: ItemAssignmentPage) => any): Promise<ItemAssignmentPage>; /** * Lists ItemAssignmentInstance 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 { ItemAssignmentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ItemAssignmentInstance[]) => any): Promise<ItemAssignmentInstance[]>; list(params: ItemAssignmentListInstanceOptions, callback?: (error: Error | null, items: ItemAssignmentInstance[]) => any): Promise<ItemAssignmentInstance[]>; /** * Retrieve a single page of ItemAssignmentInstance 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 { ItemAssignmentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ItemAssignmentPage) => any): Promise<ItemAssignmentPage>; page(params: ItemAssignmentListInstancePageOptions, callback?: (error: Error | null, items: ItemAssignmentPage) => any): Promise<ItemAssignmentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ItemAssignmentListInstance(version: V2, bundleSid: string): ItemAssignmentListInstance; export declare class ItemAssignmentPage extends Page<V2, ItemAssignmentPayload, ItemAssignmentResource, ItemAssignmentInstance> { /** * Initialize the ItemAssignmentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ItemAssignmentSolution); /** * Build an instance of ItemAssignmentInstance * * @param payload - Payload response from the API */ getInstance(payload: ItemAssignmentResource): ItemAssignmentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/bundle/evaluation.js000064400000016752151677225100017712 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.EvaluationPage = exports.EvaluationListInstance = exports.EvaluationInstance = exports.EvaluationContextImpl = void 0; 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 EvaluationContextImpl { constructor(_version, bundleSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(bundleSid)) { throw new Error("Parameter 'bundleSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { bundleSid, sid }; this._uri = `/RegulatoryCompliance/Bundles/${bundleSid}/Evaluations/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EvaluationInstance(operationVersion, payload, instance._solution.bundleSid, 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.EvaluationContextImpl = EvaluationContextImpl; class EvaluationInstance { constructor(_version, payload, bundleSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.regulationSid = payload.regulation_sid; this.bundleSid = payload.bundle_sid; this.status = payload.status; this.results = payload.results; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { bundleSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new EvaluationContextImpl(this._version, this._solution.bundleSid, this._solution.sid); return this._context; } /** * Fetch a EvaluationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EvaluationInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, regulationSid: this.regulationSid, bundleSid: this.bundleSid, status: this.status, results: this.results, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EvaluationInstance = EvaluationInstance; function EvaluationListInstance(version, bundleSid) { if (!(0, utility_1.isValidPathParam)(bundleSid)) { throw new Error("Parameter 'bundleSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EvaluationContextImpl(version, bundleSid, sid); }; instance._version = version; instance._solution = { bundleSid }; instance._uri = `/RegulatoryCompliance/Bundles/${bundleSid}/Evaluations`; instance.create = function create(callback) { let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", }); operationPromise = operationPromise.then((payload) => new EvaluationInstance(operationVersion, payload, instance._solution.bundleSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EvaluationPage(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 EvaluationPage(instance._version, payload, 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; } exports.EvaluationListInstance = EvaluationListInstance; class EvaluationPage extends Page_1.default { /** * Initialize the EvaluationPage * * @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 EvaluationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EvaluationInstance(this._version, payload, this._solution.bundleSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EvaluationPage = EvaluationPage; rest/numbers/v2/regulatoryCompliance/bundle/evaluation.d.ts000064400000021035151677225100020134 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type EvaluationStatus = "compliant" | "noncompliant"; /** * Options to pass to each */ export interface EvaluationListInstanceEachOptions { /** 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: EvaluationInstance, 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 EvaluationListInstanceOptions { /** 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 EvaluationListInstancePageOptions { /** 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 EvaluationContext { /** * Fetch a EvaluationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EvaluationInstance */ fetch(callback?: (error: Error | null, item?: EvaluationInstance) => any): Promise<EvaluationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EvaluationContextSolution { bundleSid: string; sid: string; } export declare class EvaluationContextImpl implements EvaluationContext { protected _version: V2; protected _solution: EvaluationContextSolution; protected _uri: string; constructor(_version: V2, bundleSid: string, sid: string); fetch(callback?: (error: Error | null, item?: EvaluationInstance) => any): Promise<EvaluationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EvaluationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EvaluationPayload extends TwilioResponsePayload { results: EvaluationResource[]; } interface EvaluationResource { sid: string; account_sid: string; regulation_sid: string; bundle_sid: string; status: EvaluationStatus; results: Array<any>; date_created: Date; url: string; } export declare class EvaluationInstance { protected _version: V2; protected _solution: EvaluationContextSolution; protected _context?: EvaluationContext; constructor(_version: V2, payload: EvaluationResource, bundleSid: string, sid?: string); /** * The unique string that identifies the Evaluation resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. */ accountSid: string; /** * The unique string of a regulation that is associated to the Bundle resource. */ regulationSid: string; /** * The unique string that we created to identify the Bundle resource. */ bundleSid: string; status: EvaluationStatus; /** * The results of the Evaluation which includes the valid and invalid attributes. */ results: Array<any>; dateCreated: Date; url: string; private get _proxy(); /** * Fetch a EvaluationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EvaluationInstance */ fetch(callback?: (error: Error | null, item?: EvaluationInstance) => any): Promise<EvaluationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; regulationSid: string; bundleSid: string; status: EvaluationStatus; results: any[]; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EvaluationSolution { bundleSid: string; } export interface EvaluationListInstance { _version: V2; _solution: EvaluationSolution; _uri: string; (sid: string): EvaluationContext; get(sid: string): EvaluationContext; /** * Create a EvaluationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EvaluationInstance */ create(callback?: (error: Error | null, item?: EvaluationInstance) => any): Promise<EvaluationInstance>; /** * Streams EvaluationInstance 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 { EvaluationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EvaluationInstance, done: (err?: Error) => void) => void): void; each(params: EvaluationListInstanceEachOptions, callback?: (item: EvaluationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EvaluationInstance 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: EvaluationPage) => any): Promise<EvaluationPage>; /** * Lists EvaluationInstance 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 { EvaluationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EvaluationInstance[]) => any): Promise<EvaluationInstance[]>; list(params: EvaluationListInstanceOptions, callback?: (error: Error | null, items: EvaluationInstance[]) => any): Promise<EvaluationInstance[]>; /** * Retrieve a single page of EvaluationInstance 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 { EvaluationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EvaluationPage) => any): Promise<EvaluationPage>; page(params: EvaluationListInstancePageOptions, callback?: (error: Error | null, items: EvaluationPage) => any): Promise<EvaluationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EvaluationListInstance(version: V2, bundleSid: string): EvaluationListInstance; export declare class EvaluationPage extends Page<V2, EvaluationPayload, EvaluationResource, EvaluationInstance> { /** * Initialize the EvaluationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: EvaluationSolution); /** * Build an instance of EvaluationInstance * * @param payload - Payload response from the API */ getInstance(payload: EvaluationResource): EvaluationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/bundle/replaceItems.d.ts000064400000006642151677225100020411 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../../V2"; export type ReplaceItemsStatus = "draft" | "pending-review" | "in-review" | "twilio-rejected" | "twilio-approved" | "provisionally-approved"; /** * Options to pass to create a ReplaceItemsInstance */ export interface ReplaceItemsListInstanceCreateOptions { /** The source bundle sid to copy the item assignments from. */ fromBundleSid: string; } export interface ReplaceItemsSolution { bundleSid: string; } export interface ReplaceItemsListInstance { _version: V2; _solution: ReplaceItemsSolution; _uri: string; /** * Create a ReplaceItemsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ReplaceItemsInstance */ create(params: ReplaceItemsListInstanceCreateOptions, callback?: (error: Error | null, item?: ReplaceItemsInstance) => any): Promise<ReplaceItemsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ReplaceItemsListInstance(version: V2, bundleSid: string): ReplaceItemsListInstance; interface ReplaceItemsResource { sid: string; account_sid: string; regulation_sid: string; friendly_name: string; status: ReplaceItemsStatus; valid_until: Date; email: string; status_callback: string; date_created: Date; date_updated: Date; } export declare class ReplaceItemsInstance { protected _version: V2; constructor(_version: V2, payload: ReplaceItemsResource, bundleSid: string); /** * The unique string that we created to identify the Bundle resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. */ accountSid: string; /** * The unique string of a regulation that is associated to the Bundle resource. */ regulationSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; status: ReplaceItemsStatus; /** * The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. */ validUntil: Date; /** * The email address that will receive updates when the Bundle resource changes status. */ email: string; /** * The URL we call to inform your application of status changes. */ statusCallback: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; regulationSid: string; friendlyName: string; status: ReplaceItemsStatus; validUntil: Date; email: string; statusCallback: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/bundle/bundleCopy.js000064400000014310151677225100017633 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.BundleCopyPage = exports.BundleCopyInstance = exports.BundleCopyListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function BundleCopyListInstance(version, bundleSid) { if (!(0, utility_1.isValidPathParam)(bundleSid)) { throw new Error("Parameter 'bundleSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { bundleSid }; instance._uri = `/RegulatoryCompliance/Bundles/${bundleSid}/Copies`; instance.create = function create(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"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BundleCopyInstance(operationVersion, payload, instance._solution.bundleSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BundleCopyPage(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 BundleCopyPage(instance._version, payload, 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; } exports.BundleCopyListInstance = BundleCopyListInstance; class BundleCopyInstance { constructor(_version, payload, bundleSid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.regulationSid = payload.regulation_sid; this.friendlyName = payload.friendly_name; this.status = payload.status; this.validUntil = deserialize.iso8601DateTime(payload.valid_until); this.email = payload.email; this.statusCallback = payload.status_callback; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, regulationSid: this.regulationSid, friendlyName: this.friendlyName, status: this.status, validUntil: this.validUntil, email: this.email, statusCallback: this.statusCallback, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BundleCopyInstance = BundleCopyInstance; class BundleCopyPage extends Page_1.default { /** * Initialize the BundleCopyPage * * @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 BundleCopyInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BundleCopyInstance(this._version, payload, this._solution.bundleSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BundleCopyPage = BundleCopyPage; rest/numbers/v2/regulatoryCompliance/bundle.js000064400000032366151677225100015542 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.BundlePage = exports.BundleListInstance = exports.BundleInstance = exports.BundleContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const bundleCopy_1 = require("./bundle/bundleCopy"); const evaluation_1 = require("./bundle/evaluation"); const itemAssignment_1 = require("./bundle/itemAssignment"); const replaceItems_1 = require("./bundle/replaceItems"); class BundleContextImpl { 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 = `/RegulatoryCompliance/Bundles/${sid}`; } get bundleCopies() { this._bundleCopies = this._bundleCopies || (0, bundleCopy_1.BundleCopyListInstance)(this._version, this._solution.sid); return this._bundleCopies; } get evaluations() { this._evaluations = this._evaluations || (0, evaluation_1.EvaluationListInstance)(this._version, this._solution.sid); return this._evaluations; } get itemAssignments() { this._itemAssignments = this._itemAssignments || (0, itemAssignment_1.ItemAssignmentListInstance)(this._version, this._solution.sid); return this._itemAssignments; } get replaceItems() { this._replaceItems = this._replaceItems || (0, replaceItems_1.ReplaceItemsListInstance)(this._version, this._solution.sid); return this._replaceItems; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BundleInstance(operationVersion, payload, 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["status"] !== undefined) data["Status"] = params["status"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["email"] !== undefined) data["Email"] = params["email"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BundleInstance(operationVersion, payload, 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.BundleContextImpl = BundleContextImpl; class BundleInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.regulationSid = payload.regulation_sid; this.friendlyName = payload.friendly_name; this.status = payload.status; this.validUntil = deserialize.iso8601DateTime(payload.valid_until); this.email = payload.email; this.statusCallback = payload.status_callback; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new BundleContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a BundleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a BundleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the bundleCopies. */ bundleCopies() { return this._proxy.bundleCopies; } /** * Access the evaluations. */ evaluations() { return this._proxy.evaluations; } /** * Access the itemAssignments. */ itemAssignments() { return this._proxy.itemAssignments; } /** * Access the replaceItems. */ replaceItems() { return this._proxy.replaceItems; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, regulationSid: this.regulationSid, friendlyName: this.friendlyName, status: this.status, validUntil: this.validUntil, email: this.email, statusCallback: this.statusCallback, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BundleInstance = BundleInstance; function BundleListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new BundleContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/RegulatoryCompliance/Bundles`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["email"] === null || params["email"] === undefined) { throw new Error("Required parameter \"params['email']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Email"] = params["email"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["regulationSid"] !== undefined) data["RegulationSid"] = params["regulationSid"]; if (params["isoCountry"] !== undefined) data["IsoCountry"] = params["isoCountry"]; if (params["endUserType"] !== undefined) data["EndUserType"] = params["endUserType"]; if (params["numberType"] !== undefined) data["NumberType"] = params["numberType"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BundleInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["regulationSid"] !== undefined) data["RegulationSid"] = params["regulationSid"]; if (params["isoCountry"] !== undefined) data["IsoCountry"] = params["isoCountry"]; if (params["numberType"] !== undefined) data["NumberType"] = params["numberType"]; if (params["hasValidUntilDate"] !== undefined) data["HasValidUntilDate"] = serialize.bool(params["hasValidUntilDate"]); if (params["sortBy"] !== undefined) data["SortBy"] = params["sortBy"]; if (params["sortDirection"] !== undefined) data["SortDirection"] = params["sortDirection"]; if (params["validUntilDate"] !== undefined) data["ValidUntilDate"] = serialize.iso8601DateTime(params["validUntilDate"]); if (params["validUntilDateBefore"] !== undefined) data["ValidUntilDate<"] = serialize.iso8601DateTime(params["validUntilDateBefore"]); if (params["validUntilDateAfter"] !== undefined) data["ValidUntilDate>"] = serialize.iso8601DateTime(params["validUntilDateAfter"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BundlePage(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 BundlePage(instance._version, payload, 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; } exports.BundleListInstance = BundleListInstance; class BundlePage extends Page_1.default { /** * Initialize the BundlePage * * @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 BundleInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BundleInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BundlePage = BundlePage; rest/numbers/v2/regulatoryCompliance/bundle.d.ts000064400000050324151677225100015770 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; import { BundleCopyListInstance } from "./bundle/bundleCopy"; import { EvaluationListInstance } from "./bundle/evaluation"; import { ItemAssignmentListInstance } from "./bundle/itemAssignment"; import { ReplaceItemsListInstance } from "./bundle/replaceItems"; export type BundleEndUserType = "individual" | "business"; export type BundleSortBy = "valid-until" | "date-updated"; export type BundleSortDirection = "ASC" | "DESC"; export type BundleStatus = "draft" | "pending-review" | "in-review" | "twilio-rejected" | "twilio-approved" | "provisionally-approved"; /** * Options to pass to update a BundleInstance */ export interface BundleContextUpdateOptions { /** */ status?: BundleStatus; /** The URL we call to inform your application of status changes. */ statusCallback?: string; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The email address that will receive updates when the Bundle resource changes status. */ email?: string; } /** * Options to pass to create a BundleInstance */ export interface BundleListInstanceCreateOptions { /** The string that you assigned to describe the resource. */ friendlyName: string; /** The email address that will receive updates when the Bundle resource changes status. */ email: string; /** The URL we call to inform your application of status changes. */ statusCallback?: string; /** The unique string of a regulation that is associated to the Bundle resource. */ regulationSid?: string; /** The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle\\\'s phone number country ownership request. */ isoCountry?: string; /** */ endUserType?: BundleEndUserType; /** The type of phone number of the Bundle\\\'s ownership request. Can be `local`, `mobile`, `national`, or `toll free`. */ numberType?: string; } /** * Options to pass to each */ export interface BundleListInstanceEachOptions { /** The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details. */ status?: BundleStatus; /** The string that you assigned to describe the resource. The column can contain 255 variable characters. */ friendlyName?: string; /** The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. */ regulationSid?: string; /** The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle\'s phone number country ownership request. */ isoCountry?: string; /** The type of phone number of the Bundle\'s ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. */ numberType?: string; /** Indicates that the Bundle is a valid Bundle until a specified expiration date. */ hasValidUntilDate?: boolean; /** Can be `valid-until` or `date-updated`. Defaults to `date-created`. */ sortBy?: BundleSortBy; /** Default is `DESC`. Can be `ASC` or `DESC`. */ sortDirection?: BundleSortDirection; /** Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. */ validUntilDate?: Date; /** Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. */ validUntilDateBefore?: Date; /** Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. */ validUntilDateAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: BundleInstance, 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 BundleListInstanceOptions { /** The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details. */ status?: BundleStatus; /** The string that you assigned to describe the resource. The column can contain 255 variable characters. */ friendlyName?: string; /** The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. */ regulationSid?: string; /** The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle\'s phone number country ownership request. */ isoCountry?: string; /** The type of phone number of the Bundle\'s ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. */ numberType?: string; /** Indicates that the Bundle is a valid Bundle until a specified expiration date. */ hasValidUntilDate?: boolean; /** Can be `valid-until` or `date-updated`. Defaults to `date-created`. */ sortBy?: BundleSortBy; /** Default is `DESC`. Can be `ASC` or `DESC`. */ sortDirection?: BundleSortDirection; /** Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. */ validUntilDate?: Date; /** Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. */ validUntilDateBefore?: Date; /** Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. */ validUntilDateAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface BundleListInstancePageOptions { /** The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details. */ status?: BundleStatus; /** The string that you assigned to describe the resource. The column can contain 255 variable characters. */ friendlyName?: string; /** The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. */ regulationSid?: string; /** The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle\'s phone number country ownership request. */ isoCountry?: string; /** The type of phone number of the Bundle\'s ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. */ numberType?: string; /** Indicates that the Bundle is a valid Bundle until a specified expiration date. */ hasValidUntilDate?: boolean; /** Can be `valid-until` or `date-updated`. Defaults to `date-created`. */ sortBy?: BundleSortBy; /** Default is `DESC`. Can be `ASC` or `DESC`. */ sortDirection?: BundleSortDirection; /** Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. */ validUntilDate?: Date; /** Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. */ validUntilDateBefore?: Date; /** Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. */ validUntilDateAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface BundleContext { bundleCopies: BundleCopyListInstance; evaluations: EvaluationListInstance; itemAssignments: ItemAssignmentListInstance; replaceItems: ReplaceItemsListInstance; /** * Remove a BundleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BundleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleInstance */ fetch(callback?: (error: Error | null, item?: BundleInstance) => any): Promise<BundleInstance>; /** * Update a BundleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleInstance */ update(callback?: (error: Error | null, item?: BundleInstance) => any): Promise<BundleInstance>; /** * Update a BundleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleInstance */ update(params: BundleContextUpdateOptions, callback?: (error: Error | null, item?: BundleInstance) => any): Promise<BundleInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BundleContextSolution { sid: string; } export declare class BundleContextImpl implements BundleContext { protected _version: V2; protected _solution: BundleContextSolution; protected _uri: string; protected _bundleCopies?: BundleCopyListInstance; protected _evaluations?: EvaluationListInstance; protected _itemAssignments?: ItemAssignmentListInstance; protected _replaceItems?: ReplaceItemsListInstance; constructor(_version: V2, sid: string); get bundleCopies(): BundleCopyListInstance; get evaluations(): EvaluationListInstance; get itemAssignments(): ItemAssignmentListInstance; get replaceItems(): ReplaceItemsListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: BundleInstance) => any): Promise<BundleInstance>; update(params?: BundleContextUpdateOptions | ((error: Error | null, item?: BundleInstance) => any), callback?: (error: Error | null, item?: BundleInstance) => any): Promise<BundleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BundleContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BundlePayload extends TwilioResponsePayload { results: BundleResource[]; } interface BundleResource { sid: string; account_sid: string; regulation_sid: string; friendly_name: string; status: BundleStatus; valid_until: Date; email: string; status_callback: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class BundleInstance { protected _version: V2; protected _solution: BundleContextSolution; protected _context?: BundleContext; constructor(_version: V2, payload: BundleResource, sid?: string); /** * The unique string that we created to identify the Bundle resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. */ accountSid: string; /** * The unique string of a regulation that is associated to the Bundle resource. */ regulationSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; status: BundleStatus; /** * The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. */ validUntil: Date; /** * The email address that will receive updates when the Bundle resource changes status. */ email: string; /** * The URL we call to inform your application of status changes. */ statusCallback: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Bundle resource. */ url: string; /** * The URLs of the Assigned Items of the Bundle resource. */ links: Record<string, string>; private get _proxy(); /** * Remove a BundleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BundleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleInstance */ fetch(callback?: (error: Error | null, item?: BundleInstance) => any): Promise<BundleInstance>; /** * Update a BundleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleInstance */ update(callback?: (error: Error | null, item?: BundleInstance) => any): Promise<BundleInstance>; /** * Update a BundleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleInstance */ update(params: BundleContextUpdateOptions, callback?: (error: Error | null, item?: BundleInstance) => any): Promise<BundleInstance>; /** * Access the bundleCopies. */ bundleCopies(): BundleCopyListInstance; /** * Access the evaluations. */ evaluations(): EvaluationListInstance; /** * Access the itemAssignments. */ itemAssignments(): ItemAssignmentListInstance; /** * Access the replaceItems. */ replaceItems(): ReplaceItemsListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; regulationSid: string; friendlyName: string; status: BundleStatus; validUntil: Date; email: string; statusCallback: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BundleSolution { } export interface BundleListInstance { _version: V2; _solution: BundleSolution; _uri: string; (sid: string): BundleContext; get(sid: string): BundleContext; /** * Create a BundleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BundleInstance */ create(params: BundleListInstanceCreateOptions, callback?: (error: Error | null, item?: BundleInstance) => any): Promise<BundleInstance>; /** * Streams BundleInstance 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 { BundleListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BundleInstance, done: (err?: Error) => void) => void): void; each(params: BundleListInstanceEachOptions, callback?: (item: BundleInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BundleInstance 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: BundlePage) => any): Promise<BundlePage>; /** * Lists BundleInstance 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 { BundleListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BundleInstance[]) => any): Promise<BundleInstance[]>; list(params: BundleListInstanceOptions, callback?: (error: Error | null, items: BundleInstance[]) => any): Promise<BundleInstance[]>; /** * Retrieve a single page of BundleInstance 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 { BundleListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BundlePage) => any): Promise<BundlePage>; page(params: BundleListInstancePageOptions, callback?: (error: Error | null, items: BundlePage) => any): Promise<BundlePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BundleListInstance(version: V2): BundleListInstance; export declare class BundlePage extends Page<V2, BundlePayload, BundleResource, BundleInstance> { /** * Initialize the BundlePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: BundleSolution); /** * Build an instance of BundleInstance * * @param payload - Payload response from the API */ getInstance(payload: BundleResource): BundleInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/supportingDocumentType.js000064400000015143151677225100021036 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.SupportingDocumentTypePage = exports.SupportingDocumentTypeListInstance = exports.SupportingDocumentTypeInstance = exports.SupportingDocumentTypeContextImpl = void 0; 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 SupportingDocumentTypeContextImpl { 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 = `/RegulatoryCompliance/SupportingDocumentTypes/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SupportingDocumentTypeInstance(operationVersion, payload, 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.SupportingDocumentTypeContextImpl = SupportingDocumentTypeContextImpl; class SupportingDocumentTypeInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.machineName = payload.machine_name; this.fields = payload.fields; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SupportingDocumentTypeContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a SupportingDocumentTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentTypeInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, machineName: this.machineName, fields: this.fields, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SupportingDocumentTypeInstance = SupportingDocumentTypeInstance; function SupportingDocumentTypeListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SupportingDocumentTypeContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/RegulatoryCompliance/SupportingDocumentTypes`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SupportingDocumentTypePage(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 SupportingDocumentTypePage(instance._version, payload, 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; } exports.SupportingDocumentTypeListInstance = SupportingDocumentTypeListInstance; class SupportingDocumentTypePage extends Page_1.default { /** * Initialize the SupportingDocumentTypePage * * @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 SupportingDocumentTypeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SupportingDocumentTypeInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SupportingDocumentTypePage = SupportingDocumentTypePage; rest/numbers/v2/regulatoryCompliance/supportingDocument.d.ts000064400000032007151677225100020426 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type SupportingDocumentStatus = "draft" | "pending-review" | "rejected" | "approved" | "expired" | "provisionally-approved"; /** * Options to pass to update a SupportingDocumentInstance */ export interface SupportingDocumentContextUpdateOptions { /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types. */ attributes?: any; } /** * Options to pass to create a SupportingDocumentInstance */ export interface SupportingDocumentListInstanceCreateOptions { /** The string that you assigned to describe the resource. */ friendlyName: string; /** The type of the Supporting Document. */ type: string; /** The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types. */ attributes?: any; } /** * Options to pass to each */ export interface SupportingDocumentListInstanceEachOptions { /** 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: SupportingDocumentInstance, 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 SupportingDocumentListInstanceOptions { /** 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 SupportingDocumentListInstancePageOptions { /** 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 SupportingDocumentContext { /** * Remove a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ fetch(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Update a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ update(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Update a SupportingDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ update(params: SupportingDocumentContextUpdateOptions, callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SupportingDocumentContextSolution { sid: string; } export declare class SupportingDocumentContextImpl implements SupportingDocumentContext { protected _version: V2; protected _solution: SupportingDocumentContextSolution; protected _uri: string; constructor(_version: V2, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; update(params?: SupportingDocumentContextUpdateOptions | ((error: Error | null, item?: SupportingDocumentInstance) => any), callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SupportingDocumentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SupportingDocumentPayload extends TwilioResponsePayload { results: SupportingDocumentResource[]; } interface SupportingDocumentResource { sid: string; account_sid: string; friendly_name: string; mime_type: string; status: SupportingDocumentStatus; failure_reason: string; type: string; attributes: any; date_created: Date; date_updated: Date; url: string; } export declare class SupportingDocumentInstance { protected _version: V2; protected _solution: SupportingDocumentContextSolution; protected _context?: SupportingDocumentContext; constructor(_version: V2, payload: SupportingDocumentResource, sid?: string); /** * The unique string created by Twilio to identify the Supporting Document resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The image type uploaded in the Supporting Document container. */ mimeType: string; status: SupportingDocumentStatus; /** * The failure reason of the Supporting Document Resource. */ failureReason: string; /** * The type of the Supporting Document. */ type: string; /** * The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. */ attributes: any; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Supporting Document resource. */ url: string; private get _proxy(); /** * Remove a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ fetch(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Update a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ update(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Update a SupportingDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ update(params: SupportingDocumentContextUpdateOptions, callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; mimeType: string; status: SupportingDocumentStatus; failureReason: string; type: string; attributes: any; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SupportingDocumentSolution { } export interface SupportingDocumentListInstance { _version: V2; _solution: SupportingDocumentSolution; _uri: string; (sid: string): SupportingDocumentContext; get(sid: string): SupportingDocumentContext; /** * Create a SupportingDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ create(params: SupportingDocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Streams SupportingDocumentInstance 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 { SupportingDocumentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SupportingDocumentInstance, done: (err?: Error) => void) => void): void; each(params: SupportingDocumentListInstanceEachOptions, callback?: (item: SupportingDocumentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SupportingDocumentInstance 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: SupportingDocumentPage) => any): Promise<SupportingDocumentPage>; /** * Lists SupportingDocumentInstance 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 { SupportingDocumentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SupportingDocumentInstance[]) => any): Promise<SupportingDocumentInstance[]>; list(params: SupportingDocumentListInstanceOptions, callback?: (error: Error | null, items: SupportingDocumentInstance[]) => any): Promise<SupportingDocumentInstance[]>; /** * Retrieve a single page of SupportingDocumentInstance 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 { SupportingDocumentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SupportingDocumentPage) => any): Promise<SupportingDocumentPage>; page(params: SupportingDocumentListInstancePageOptions, callback?: (error: Error | null, items: SupportingDocumentPage) => any): Promise<SupportingDocumentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SupportingDocumentListInstance(version: V2): SupportingDocumentListInstance; export declare class SupportingDocumentPage extends Page<V2, SupportingDocumentPayload, SupportingDocumentResource, SupportingDocumentInstance> { /** * Initialize the SupportingDocumentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: SupportingDocumentSolution); /** * Build an instance of SupportingDocumentInstance * * @param payload - Payload response from the API */ getInstance(payload: SupportingDocumentResource): SupportingDocumentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/endUserType.d.ts000064400000020112151677225100016756 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; /** * Options to pass to each */ export interface EndUserTypeListInstanceEachOptions { /** 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: EndUserTypeInstance, 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 EndUserTypeListInstanceOptions { /** 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 EndUserTypeListInstancePageOptions { /** 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 EndUserTypeContext { /** * Fetch a EndUserTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserTypeInstance */ fetch(callback?: (error: Error | null, item?: EndUserTypeInstance) => any): Promise<EndUserTypeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EndUserTypeContextSolution { sid: string; } export declare class EndUserTypeContextImpl implements EndUserTypeContext { protected _version: V2; protected _solution: EndUserTypeContextSolution; protected _uri: string; constructor(_version: V2, sid: string); fetch(callback?: (error: Error | null, item?: EndUserTypeInstance) => any): Promise<EndUserTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EndUserTypeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EndUserTypePayload extends TwilioResponsePayload { end_user_types: EndUserTypeResource[]; } interface EndUserTypeResource { sid: string; friendly_name: string; machine_name: string; fields: Array<any>; url: string; } export declare class EndUserTypeInstance { protected _version: V2; protected _solution: EndUserTypeContextSolution; protected _context?: EndUserTypeContext; constructor(_version: V2, payload: EndUserTypeResource, sid?: string); /** * The unique string that identifies the End-User Type resource. */ sid: string; /** * A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc */ friendlyName: string; /** * A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc. */ machineName: string; /** * The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals. */ fields: Array<any>; /** * The absolute URL of the End-User Type resource. */ url: string; private get _proxy(); /** * Fetch a EndUserTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserTypeInstance */ fetch(callback?: (error: Error | null, item?: EndUserTypeInstance) => any): Promise<EndUserTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; machineName: string; fields: any[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EndUserTypeSolution { } export interface EndUserTypeListInstance { _version: V2; _solution: EndUserTypeSolution; _uri: string; (sid: string): EndUserTypeContext; get(sid: string): EndUserTypeContext; /** * Streams EndUserTypeInstance 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 { EndUserTypeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EndUserTypeInstance, done: (err?: Error) => void) => void): void; each(params: EndUserTypeListInstanceEachOptions, callback?: (item: EndUserTypeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EndUserTypeInstance 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: EndUserTypePage) => any): Promise<EndUserTypePage>; /** * Lists EndUserTypeInstance 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 { EndUserTypeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EndUserTypeInstance[]) => any): Promise<EndUserTypeInstance[]>; list(params: EndUserTypeListInstanceOptions, callback?: (error: Error | null, items: EndUserTypeInstance[]) => any): Promise<EndUserTypeInstance[]>; /** * Retrieve a single page of EndUserTypeInstance 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 { EndUserTypeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EndUserTypePage) => any): Promise<EndUserTypePage>; page(params: EndUserTypeListInstancePageOptions, callback?: (error: Error | null, items: EndUserTypePage) => any): Promise<EndUserTypePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EndUserTypeListInstance(version: V2): EndUserTypeListInstance; export declare class EndUserTypePage extends Page<V2, EndUserTypePayload, EndUserTypeResource, EndUserTypeInstance> { /** * Initialize the EndUserTypePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: EndUserTypeSolution); /** * Build an instance of EndUserTypeInstance * * @param payload - Payload response from the API */ getInstance(payload: EndUserTypeResource): EndUserTypeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/numbers/v2/regulatoryCompliance/regulation.js000064400000015424151677225100016436 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.RegulationPage = exports.RegulationListInstance = exports.RegulationInstance = exports.RegulationContextImpl = void 0; 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 RegulationContextImpl { 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 = `/RegulatoryCompliance/Regulations/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RegulationInstance(operationVersion, payload, 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.RegulationContextImpl = RegulationContextImpl; class RegulationInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.isoCountry = payload.iso_country; this.numberType = payload.number_type; this.endUserType = payload.end_user_type; this.requirements = payload.requirements; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RegulationContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a RegulationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RegulationInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, isoCountry: this.isoCountry, numberType: this.numberType, endUserType: this.endUserType, requirements: this.requirements, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RegulationInstance = RegulationInstance; function RegulationListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RegulationContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/RegulatoryCompliance/Regulations`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["endUserType"] !== undefined) data["EndUserType"] = params["endUserType"]; if (params["isoCountry"] !== undefined) data["IsoCountry"] = params["isoCountry"]; if (params["numberType"] !== undefined) data["NumberType"] = params["numberType"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RegulationPage(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 RegulationPage(instance._version, payload, 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; } exports.RegulationListInstance = RegulationListInstance; class RegulationPage extends Page_1.default { /** * Initialize the RegulationPage * * @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 RegulationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RegulationInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RegulationPage = RegulationPage; rest/numbers/v1/bulkEligibility.js000064400000012020151677225100013205 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.BulkEligibilityListInstance = exports.BulkEligibilityInstance = exports.BulkEligibilityContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class BulkEligibilityContextImpl { constructor(_version, requestId) { this._version = _version; if (!(0, utility_1.isValidPathParam)(requestId)) { throw new Error("Parameter 'requestId' is not valid."); } this._solution = { requestId }; this._uri = `/HostedNumber/Eligibility/Bulk/${requestId}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BulkEligibilityInstance(operationVersion, payload, instance._solution.requestId)); 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.BulkEligibilityContextImpl = BulkEligibilityContextImpl; class BulkEligibilityInstance { constructor(_version, payload, requestId) { this._version = _version; this.requestId = payload.request_id; this.url = payload.url; this.results = payload.results; this.friendlyName = payload.friendly_name; this.status = payload.status; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateCompleted = deserialize.iso8601DateTime(payload.date_completed); this._solution = { requestId: requestId || this.requestId }; } get _proxy() { this._context = this._context || new BulkEligibilityContextImpl(this._version, this._solution.requestId); return this._context; } /** * Fetch a BulkEligibilityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkEligibilityInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { requestId: this.requestId, url: this.url, results: this.results, friendlyName: this.friendlyName, status: this.status, dateCreated: this.dateCreated, dateCompleted: this.dateCompleted, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BulkEligibilityInstance = BulkEligibilityInstance; function BulkEligibilityListInstance(version) { const instance = ((requestId) => instance.get(requestId)); instance.get = function get(requestId) { return new BulkEligibilityContextImpl(version, requestId); }; instance._version = version; instance._solution = {}; instance._uri = `/HostedNumber/Eligibility/Bulk`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BulkEligibilityInstance(operationVersion, payload)); 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; } exports.BulkEligibilityListInstance = BulkEligibilityListInstance; rest/numbers/v1/signingRequestConfiguration.d.ts000064400000006715151677225100016072 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a SigningRequestConfigurationInstance */ export interface SigningRequestConfigurationListInstanceCreateOptions { /** */ body?: object; } export interface SigningRequestConfigurationSolution { } export interface SigningRequestConfigurationListInstance { _version: V1; _solution: SigningRequestConfigurationSolution; _uri: string; /** * Create a SigningRequestConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningRequestConfigurationInstance */ create(callback?: (error: Error | null, item?: SigningRequestConfigurationInstance) => any): Promise<SigningRequestConfigurationInstance>; /** * Create a SigningRequestConfigurationInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningRequestConfigurationInstance */ create(params: object, callback?: (error: Error | null, item?: SigningRequestConfigurationInstance) => any): Promise<SigningRequestConfigurationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SigningRequestConfigurationListInstance(version: V1): SigningRequestConfigurationListInstance; interface SigningRequestConfigurationResource { logo_sid: string; friendly_name: string; product: string; country: string; email_subject: string; email_message: string; url_redirection: string; url: string; } export declare class SigningRequestConfigurationInstance { protected _version: V1; constructor(_version: V1, payload: SigningRequestConfigurationResource); /** * The SID of the document that includes the logo that will appear in the LOA. To upload documents follow the following guide: https://www.twilio.com/docs/phone-numbers/regulatory/getting-started/create-new-bundle-public-rest-apis#supporting-document-create */ logoSid: string; /** * This is the string that you assigned as a friendly name for describing the creation of the configuration. */ friendlyName: string; /** * The product or service for which is requesting the signature. */ product: string; /** * The country ISO code to apply the configuration. */ country: string; /** * Subject of the email that the end client will receive ex: “Twilio Hosting Request”, maximum length of 255 characters. */ emailSubject: string; /** * Content of the email that the end client will receive ex: “This is a Hosting request from Twilio, please check the document and sign it”, maximum length of 5,000 characters. */ emailMessage: string; /** * Url the end client will be redirected after signing a document. */ urlRedirection: string; url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { logoSid: string; friendlyName: string; product: string; country: string; emailSubject: string; emailMessage: string; urlRedirection: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/numbers/v1/portingPortInPhoneNumber.d.ts000064400000013405151677225100015306 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export interface PortingPortInPhoneNumberContext { /** * Remove a PortingPortInPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PortingPortInPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortInPhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PortingPortInPhoneNumberInstance) => any): Promise<PortingPortInPhoneNumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PortingPortInPhoneNumberContextSolution { portInRequestSid: string; phoneNumberSid: string; } export declare class PortingPortInPhoneNumberContextImpl implements PortingPortInPhoneNumberContext { protected _version: V1; protected _solution: PortingPortInPhoneNumberContextSolution; protected _uri: string; constructor(_version: V1, portInRequestSid: string, phoneNumberSid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: PortingPortInPhoneNumberInstance) => any): Promise<PortingPortInPhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PortingPortInPhoneNumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PortingPortInPhoneNumberResource { port_in_request_sid: string; phone_number_sid: string; url: string; account_sid: string; phone_number_type: string; date_created: Date; country: string; missing_required_fields: boolean; status_last_time_updated_timestamp: Date; phone_number: string; portable: boolean; not_portability_reason: string; not_portability_reason_code: string; port_in_phone_number_status: string; } export declare class PortingPortInPhoneNumberInstance { protected _version: V1; protected _solution: PortingPortInPhoneNumberContextSolution; protected _context?: PortingPortInPhoneNumberContext; constructor(_version: V1, payload: PortingPortInPhoneNumberResource, portInRequestSid?: string, phoneNumberSid?: string); /** * The SID of the Port In request. This is a unique identifier of the port in request. */ portInRequestSid: string; /** * The SID of the Port In request phone number. This is a unique identifier of the phone number. */ phoneNumberSid: string; url: string; /** * The SID of the account that the phone number belongs to. */ accountSid: string; /** * The type of the phone number. */ phoneNumberType: string; /** * The date when the phone number was created. */ dateCreated: Date; /** * The country of the phone number. */ country: string; /** * The phone number is missing required fields. */ missingRequiredFields: boolean; /** * The timestamp when the status was last updated. */ statusLastTimeUpdatedTimestamp: Date; /** * The phone number. */ phoneNumber: string; /** * The phone number is portable. */ portable: boolean; /** * The reason why the phone number is not portable. */ notPortabilityReason: string; /** * The code of the reason why the phone number is not portable. */ notPortabilityReasonCode: string; /** * The status of the phone number in the port in request. */ portInPhoneNumberStatus: string; private get _proxy(); /** * Remove a PortingPortInPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PortingPortInPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortInPhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PortingPortInPhoneNumberInstance) => any): Promise<PortingPortInPhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { portInRequestSid: string; phoneNumberSid: string; url: string; accountSid: string; phoneNumberType: string; dateCreated: Date; country: string; missingRequiredFields: boolean; statusLastTimeUpdatedTimestamp: Date; phoneNumber: string; portable: boolean; notPortabilityReason: string; notPortabilityReasonCode: string; portInPhoneNumberStatus: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PortingPortInPhoneNumberSolution { } export interface PortingPortInPhoneNumberListInstance { _version: V1; _solution: PortingPortInPhoneNumberSolution; _uri: string; (portInRequestSid: string, phoneNumberSid: string): PortingPortInPhoneNumberContext; get(portInRequestSid: string, phoneNumberSid: string): PortingPortInPhoneNumberContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PortingPortInPhoneNumberListInstance(version: V1): PortingPortInPhoneNumberListInstance; export {}; rest/numbers/v1/eligibility.d.ts000064400000004612151677225100012633 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a EligibilityInstance */ export interface EligibilityListInstanceCreateOptions { /** */ body?: object; } export interface EligibilitySolution { } export interface EligibilityListInstance { _version: V1; _solution: EligibilitySolution; _uri: string; /** * Create a EligibilityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EligibilityInstance */ create(callback?: (error: Error | null, item?: EligibilityInstance) => any): Promise<EligibilityInstance>; /** * Create a EligibilityInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EligibilityInstance */ create(params: object, callback?: (error: Error | null, item?: EligibilityInstance) => any): Promise<EligibilityInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EligibilityListInstance(version: V1): EligibilityListInstance; interface EligibilityResource { results: Array<any>; } export declare class EligibilityInstance { protected _version: V1; constructor(_version: V1, payload: EligibilityResource); /** * The result set that contains the eligibility check response for the requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, date_last_checked: Datetime (ISO 8601) when the PN was last checked for eligibility, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number\'s ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status. */ results: Array<any>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { results: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/numbers/v1/signingRequestConfiguration.js000064400000006365151677225100015637 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.SigningRequestConfigurationInstance = exports.SigningRequestConfigurationListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function SigningRequestConfigurationListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/SigningRequest/Configuration`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SigningRequestConfigurationInstance(operationVersion, payload)); 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; } exports.SigningRequestConfigurationListInstance = SigningRequestConfigurationListInstance; class SigningRequestConfigurationInstance { constructor(_version, payload) { this._version = _version; this.logoSid = payload.logo_sid; this.friendlyName = payload.friendly_name; this.product = payload.product; this.country = payload.country; this.emailSubject = payload.email_subject; this.emailMessage = payload.email_message; this.urlRedirection = payload.url_redirection; this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { logoSid: this.logoSid, friendlyName: this.friendlyName, product: this.product, country: this.country, emailSubject: this.emailSubject, emailMessage: this.emailMessage, urlRedirection: this.urlRedirection, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SigningRequestConfigurationInstance = SigningRequestConfigurationInstance; rest/numbers/v1/eligibility.js000064400000005007151677225100012376 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.EligibilityInstance = exports.EligibilityListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function EligibilityListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/HostedNumber/Eligibility`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new EligibilityInstance(operationVersion, payload)); 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; } exports.EligibilityListInstance = EligibilityListInstance; class EligibilityInstance { constructor(_version, payload) { this._version = _version; this.results = payload.results; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { results: this.results, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EligibilityInstance = EligibilityInstance; rest/numbers/v1/portingPortIn.d.ts000064400000014173151677225100013146 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a PortingPortInInstance */ export interface PortingPortInListInstanceCreateOptions { /** */ body?: object; } export interface PortingPortInContext { /** * Remove a PortingPortInInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PortingPortInInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortInInstance */ fetch(callback?: (error: Error | null, item?: PortingPortInInstance) => any): Promise<PortingPortInInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PortingPortInContextSolution { portInRequestSid: string; } export declare class PortingPortInContextImpl implements PortingPortInContext { protected _version: V1; protected _solution: PortingPortInContextSolution; protected _uri: string; constructor(_version: V1, portInRequestSid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: PortingPortInInstance) => any): Promise<PortingPortInInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PortingPortInContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PortingPortInResource { port_in_request_sid: string; url: string; account_sid: string; notification_emails: Array<string>; target_port_in_date: Date; target_port_in_time_range_start: string; target_port_in_time_range_end: string; port_in_request_status: string; losing_carrier_information: any; phone_numbers: Array<any>; documents: Array<string>; } export declare class PortingPortInInstance { protected _version: V1; protected _solution: PortingPortInContextSolution; protected _context?: PortingPortInContext; constructor(_version: V1, payload: PortingPortInResource, portInRequestSid?: string); /** * The SID of the Port In request. This is a unique identifier of the port in request. */ portInRequestSid: string; /** * The URL of this Port In request */ url: string; /** * The Account SID that the numbers will be added to after they are ported into Twilio. */ accountSid: string; /** * List of emails for getting notifications about the LOA signing process. Allowed Max 10 emails. */ notificationEmails: Array<string>; /** * Minimum number of days in the future (at least 2 days) needs to be established with the Ops team for validation. */ targetPortInDate: Date; /** * Minimum hour in the future needs to be established with the Ops team for validation. */ targetPortInTimeRangeStart: string; /** * Maximum hour in the future needs to be established with the Ops team for validation. */ targetPortInTimeRangeEnd: string; /** * The status of the port in request. The possible values are: In progress, Completed, Expired, In review, Waiting for Signature, Action Required, and Canceled. */ portInRequestStatus: string; /** * The information for the losing carrier. */ losingCarrierInformation: any; /** * The list of phone numbers to Port in. Phone numbers are in E.164 format (e.g. +16175551212). */ phoneNumbers: Array<any>; /** * The list of documents SID referencing a utility bills */ documents: Array<string>; private get _proxy(); /** * Remove a PortingPortInInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PortingPortInInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortInInstance */ fetch(callback?: (error: Error | null, item?: PortingPortInInstance) => any): Promise<PortingPortInInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { portInRequestSid: string; url: string; accountSid: string; notificationEmails: string[]; targetPortInDate: Date; targetPortInTimeRangeStart: string; targetPortInTimeRangeEnd: string; portInRequestStatus: string; losingCarrierInformation: any; phoneNumbers: any[]; documents: string[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PortingPortInSolution { } export interface PortingPortInListInstance { _version: V1; _solution: PortingPortInSolution; _uri: string; (portInRequestSid: string): PortingPortInContext; get(portInRequestSid: string): PortingPortInContext; /** * Create a PortingPortInInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortInInstance */ create(callback?: (error: Error | null, item?: PortingPortInInstance) => any): Promise<PortingPortInInstance>; /** * Create a PortingPortInInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortInInstance */ create(params: object, callback?: (error: Error | null, item?: PortingPortInInstance) => any): Promise<PortingPortInInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PortingPortInListInstance(version: V1): PortingPortInListInstance; export {}; rest/numbers/v1/portingWebhookConfigurationFetch.d.ts000064400000004706151677225100017034 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export interface PortingWebhookConfigurationFetchSolution { } export interface PortingWebhookConfigurationFetchListInstance { _version: V1; _solution: PortingWebhookConfigurationFetchSolution; _uri: string; /** * Fetch a PortingWebhookConfigurationFetchInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingWebhookConfigurationFetchInstance */ fetch(callback?: (error: Error | null, item?: PortingWebhookConfigurationFetchInstance) => any): Promise<PortingWebhookConfigurationFetchInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PortingWebhookConfigurationFetchListInstance(version: V1): PortingWebhookConfigurationFetchListInstance; interface PortingWebhookConfigurationFetchResource { url: string; port_in_target_url: string; port_out_target_url: string; notifications_of: Array<string>; port_in_target_date_created: Date; port_out_target_date_created: Date; } export declare class PortingWebhookConfigurationFetchInstance { protected _version: V1; constructor(_version: V1, payload: PortingWebhookConfigurationFetchResource); /** * The URL of the webhook configuration request */ url: string; /** * Webhook URL to send a request when a port in request or port in phone number event happens */ portInTargetUrl: string; /** * Webhook URL to send a request when a port out phone number event happens */ portOutTargetUrl: string; /** * List of notification events to send a request to the webhook URL */ notificationsOf: Array<string>; /** * Creation date for the port in webhook configuration */ portInTargetDateCreated: Date; /** * Creation date for the port out webhook configuration */ portOutTargetDateCreated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { url: string; portInTargetUrl: string; portOutTargetUrl: string; notificationsOf: string[]; portInTargetDateCreated: Date; portOutTargetDateCreated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/numbers/v1/portingWebhookConfigurationDelete.js000064400000005222151677225100016743 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.PortingWebhookConfigurationDeleteListInstance = exports.PortingWebhookConfigurationDeleteContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PortingWebhookConfigurationDeleteContextImpl { constructor(_version, webhookType) { this._version = _version; if (!(0, utility_1.isValidPathParam)(webhookType)) { throw new Error("Parameter 'webhookType' is not valid."); } this._solution = { webhookType }; this._uri = `/Porting/Configuration/Webhook/${webhookType}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); 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.PortingWebhookConfigurationDeleteContextImpl = PortingWebhookConfigurationDeleteContextImpl; function PortingWebhookConfigurationDeleteListInstance(version) { const instance = ((webhookType) => instance.get(webhookType)); instance.get = function get(webhookType) { return new PortingWebhookConfigurationDeleteContextImpl(version, webhookType); }; 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; } exports.PortingWebhookConfigurationDeleteListInstance = PortingWebhookConfigurationDeleteListInstance; rest/numbers/v1/portingWebhookConfiguration.js000064400000005730151677225100015624 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.PortingWebhookConfigurationInstance = exports.PortingWebhookConfigurationListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function PortingWebhookConfigurationListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Porting/Configuration/Webhook`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PortingWebhookConfigurationInstance(operationVersion, payload)); 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; } exports.PortingWebhookConfigurationListInstance = PortingWebhookConfigurationListInstance; class PortingWebhookConfigurationInstance { constructor(_version, payload) { this._version = _version; this.url = payload.url; this.portInTargetUrl = payload.port_in_target_url; this.portOutTargetUrl = payload.port_out_target_url; this.notificationsOf = payload.notifications_of; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { url: this.url, portInTargetUrl: this.portInTargetUrl, portOutTargetUrl: this.portOutTargetUrl, notificationsOf: this.notificationsOf, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PortingWebhookConfigurationInstance = PortingWebhookConfigurationInstance; rest/numbers/v1/portingPortability.js000064400000011735151677225100014002 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.PortingPortabilityListInstance = exports.PortingPortabilityInstance = exports.PortingPortabilityContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PortingPortabilityContextImpl { constructor(_version, phoneNumber) { this._version = _version; if (!(0, utility_1.isValidPathParam)(phoneNumber)) { throw new Error("Parameter 'phoneNumber' is not valid."); } this._solution = { phoneNumber }; this._uri = `/Porting/Portability/PhoneNumber/${phoneNumber}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["targetAccountSid"] !== undefined) data["TargetAccountSid"] = params["targetAccountSid"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PortingPortabilityInstance(operationVersion, payload, instance._solution.phoneNumber)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PortingPortabilityContextImpl = PortingPortabilityContextImpl; class PortingPortabilityInstance { constructor(_version, payload, phoneNumber) { this._version = _version; this.phoneNumber = payload.phone_number; this.accountSid = payload.account_sid; this.portable = payload.portable; this.pinAndAccountNumberRequired = payload.pin_and_account_number_required; this.notPortableReason = payload.not_portable_reason; this.notPortableReasonCode = deserialize.integer(payload.not_portable_reason_code); this.numberType = payload.number_type; this.country = payload.country; this.messagingCarrier = payload.messaging_carrier; this.voiceCarrier = payload.voice_carrier; this.url = payload.url; this._solution = { phoneNumber: phoneNumber || this.phoneNumber }; } get _proxy() { this._context = this._context || new PortingPortabilityContextImpl(this._version, this._solution.phoneNumber); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { phoneNumber: this.phoneNumber, accountSid: this.accountSid, portable: this.portable, pinAndAccountNumberRequired: this.pinAndAccountNumberRequired, notPortableReason: this.notPortableReason, notPortableReasonCode: this.notPortableReasonCode, numberType: this.numberType, country: this.country, messagingCarrier: this.messagingCarrier, voiceCarrier: this.voiceCarrier, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PortingPortabilityInstance = PortingPortabilityInstance; function PortingPortabilityListInstance(version) { const instance = ((phoneNumber) => instance.get(phoneNumber)); instance.get = function get(phoneNumber) { return new PortingPortabilityContextImpl(version, phoneNumber); }; instance._version = version; instance._solution = {}; instance._uri = ``; instance.toJSON = function toJSON() { return instance._solution; }; instance[util_1.inspect.custom] = function inspectImpl(_depth, options) { return (0, util_1.inspect)(instance.toJSON(), options); }; return instance; } exports.PortingPortabilityListInstance = PortingPortabilityListInstance; rest/numbers/v1/portingPortIn.js000064400000014447151677225100012716 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.PortingPortInListInstance = exports.PortingPortInInstance = exports.PortingPortInContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PortingPortInContextImpl { constructor(_version, portInRequestSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(portInRequestSid)) { throw new Error("Parameter 'portInRequestSid' is not valid."); } this._solution = { portInRequestSid }; this._uri = `/Porting/PortIn/${portInRequestSid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PortingPortInInstance(operationVersion, payload, instance._solution.portInRequestSid)); 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.PortingPortInContextImpl = PortingPortInContextImpl; class PortingPortInInstance { constructor(_version, payload, portInRequestSid) { this._version = _version; this.portInRequestSid = payload.port_in_request_sid; this.url = payload.url; this.accountSid = payload.account_sid; this.notificationEmails = payload.notification_emails; this.targetPortInDate = deserialize.iso8601Date(payload.target_port_in_date); this.targetPortInTimeRangeStart = payload.target_port_in_time_range_start; this.targetPortInTimeRangeEnd = payload.target_port_in_time_range_end; this.portInRequestStatus = payload.port_in_request_status; this.losingCarrierInformation = payload.losing_carrier_information; this.phoneNumbers = payload.phone_numbers; this.documents = payload.documents; this._solution = { portInRequestSid: portInRequestSid || this.portInRequestSid, }; } get _proxy() { this._context = this._context || new PortingPortInContextImpl(this._version, this._solution.portInRequestSid); return this._context; } /** * Remove a PortingPortInInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a PortingPortInInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortInInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { portInRequestSid: this.portInRequestSid, url: this.url, accountSid: this.accountSid, notificationEmails: this.notificationEmails, targetPortInDate: this.targetPortInDate, targetPortInTimeRangeStart: this.targetPortInTimeRangeStart, targetPortInTimeRangeEnd: this.targetPortInTimeRangeEnd, portInRequestStatus: this.portInRequestStatus, losingCarrierInformation: this.losingCarrierInformation, phoneNumbers: this.phoneNumbers, documents: this.documents, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PortingPortInInstance = PortingPortInInstance; function PortingPortInListInstance(version) { const instance = ((portInRequestSid) => instance.get(portInRequestSid)); instance.get = function get(portInRequestSid) { return new PortingPortInContextImpl(version, portInRequestSid); }; instance._version = version; instance._solution = {}; instance._uri = `/Porting/PortIn`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PortingPortInInstance(operationVersion, payload)); 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; } exports.PortingPortInListInstance = PortingPortInListInstance; rest/numbers/v1/portingWebhookConfigurationDelete.d.ts000064400000004205151677225100017177 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export type PortingWebhookConfigurationDeleteWebhookType = "PORT_IN" | "PORT_OUT"; export interface PortingWebhookConfigurationDeleteContext { /** * Remove a PortingWebhookConfigurationDeleteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PortingWebhookConfigurationDeleteContextSolution { webhookType: PortingWebhookConfigurationDeleteWebhookType; } export declare class PortingWebhookConfigurationDeleteContextImpl implements PortingWebhookConfigurationDeleteContext { protected _version: V1; protected _solution: PortingWebhookConfigurationDeleteContextSolution; protected _uri: string; constructor(_version: V1, webhookType: PortingWebhookConfigurationDeleteWebhookType); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PortingWebhookConfigurationDeleteContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PortingWebhookConfigurationDeleteSolution { } export interface PortingWebhookConfigurationDeleteListInstance { _version: V1; _solution: PortingWebhookConfigurationDeleteSolution; _uri: string; (webhookType: PortingWebhookConfigurationDeleteWebhookType): PortingWebhookConfigurationDeleteContext; get(webhookType: PortingWebhookConfigurationDeleteWebhookType): PortingWebhookConfigurationDeleteContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PortingWebhookConfigurationDeleteListInstance(version: V1): PortingWebhookConfigurationDeleteListInstance; rest/numbers/v1/bulkEligibility.d.ts000064400000011623151677225100013451 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a BulkEligibilityInstance */ export interface BulkEligibilityListInstanceCreateOptions { /** */ body?: object; } export interface BulkEligibilityContext { /** * Fetch a BulkEligibilityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkEligibilityInstance */ fetch(callback?: (error: Error | null, item?: BulkEligibilityInstance) => any): Promise<BulkEligibilityInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BulkEligibilityContextSolution { requestId: string; } export declare class BulkEligibilityContextImpl implements BulkEligibilityContext { protected _version: V1; protected _solution: BulkEligibilityContextSolution; protected _uri: string; constructor(_version: V1, requestId: string); fetch(callback?: (error: Error | null, item?: BulkEligibilityInstance) => any): Promise<BulkEligibilityInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BulkEligibilityContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BulkEligibilityResource { request_id: string; url: string; results: Array<any>; friendly_name: string; status: string; date_created: Date; date_completed: Date; } export declare class BulkEligibilityInstance { protected _version: V1; protected _solution: BulkEligibilityContextSolution; protected _context?: BulkEligibilityContext; constructor(_version: V1, payload: BulkEligibilityResource, requestId?: string); /** * The SID of the bulk eligibility check that you want to know about. */ requestId: string; /** * This is the url of the request that you\'re trying to reach out to locate the resource. */ url: string; /** * The result set that contains the eligibility check response for each requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number\'s ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status. */ results: Array<any>; /** * This is the string that you assigned as a friendly name for describing the eligibility check request. */ friendlyName: string; /** * This is the status of the bulk eligibility check request. (Example: COMPLETE, IN_PROGRESS) */ status: string; dateCreated: Date; dateCompleted: Date; private get _proxy(); /** * Fetch a BulkEligibilityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkEligibilityInstance */ fetch(callback?: (error: Error | null, item?: BulkEligibilityInstance) => any): Promise<BulkEligibilityInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { requestId: string; url: string; results: any[]; friendlyName: string; status: string; dateCreated: Date; dateCompleted: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BulkEligibilitySolution { } export interface BulkEligibilityListInstance { _version: V1; _solution: BulkEligibilitySolution; _uri: string; (requestId: string): BulkEligibilityContext; get(requestId: string): BulkEligibilityContext; /** * Create a BulkEligibilityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkEligibilityInstance */ create(callback?: (error: Error | null, item?: BulkEligibilityInstance) => any): Promise<BulkEligibilityInstance>; /** * Create a BulkEligibilityInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BulkEligibilityInstance */ create(params: object, callback?: (error: Error | null, item?: BulkEligibilityInstance) => any): Promise<BulkEligibilityInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BulkEligibilityListInstance(version: V1): BulkEligibilityListInstance; export {}; rest/numbers/v1/portingPortInPhoneNumber.js000064400000014643151677225100015057 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.PortingPortInPhoneNumberListInstance = exports.PortingPortInPhoneNumberInstance = exports.PortingPortInPhoneNumberContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PortingPortInPhoneNumberContextImpl { constructor(_version, portInRequestSid, phoneNumberSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(portInRequestSid)) { throw new Error("Parameter 'portInRequestSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(phoneNumberSid)) { throw new Error("Parameter 'phoneNumberSid' is not valid."); } this._solution = { portInRequestSid, phoneNumberSid }; this._uri = `/Porting/PortIn/${portInRequestSid}/PhoneNumber/${phoneNumberSid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PortingPortInPhoneNumberInstance(operationVersion, payload, instance._solution.portInRequestSid, instance._solution.phoneNumberSid)); 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.PortingPortInPhoneNumberContextImpl = PortingPortInPhoneNumberContextImpl; class PortingPortInPhoneNumberInstance { constructor(_version, payload, portInRequestSid, phoneNumberSid) { this._version = _version; this.portInRequestSid = payload.port_in_request_sid; this.phoneNumberSid = payload.phone_number_sid; this.url = payload.url; this.accountSid = payload.account_sid; this.phoneNumberType = payload.phone_number_type; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.country = payload.country; this.missingRequiredFields = payload.missing_required_fields; this.statusLastTimeUpdatedTimestamp = deserialize.iso8601DateTime(payload.status_last_time_updated_timestamp); this.phoneNumber = payload.phone_number; this.portable = payload.portable; this.notPortabilityReason = payload.not_portability_reason; this.notPortabilityReasonCode = payload.not_portability_reason_code; this.portInPhoneNumberStatus = payload.port_in_phone_number_status; this._solution = { portInRequestSid: portInRequestSid || this.portInRequestSid, phoneNumberSid: phoneNumberSid || this.phoneNumberSid, }; } get _proxy() { this._context = this._context || new PortingPortInPhoneNumberContextImpl(this._version, this._solution.portInRequestSid, this._solution.phoneNumberSid); return this._context; } /** * Remove a PortingPortInPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a PortingPortInPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortInPhoneNumberInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { portInRequestSid: this.portInRequestSid, phoneNumberSid: this.phoneNumberSid, url: this.url, accountSid: this.accountSid, phoneNumberType: this.phoneNumberType, dateCreated: this.dateCreated, country: this.country, missingRequiredFields: this.missingRequiredFields, statusLastTimeUpdatedTimestamp: this.statusLastTimeUpdatedTimestamp, phoneNumber: this.phoneNumber, portable: this.portable, notPortabilityReason: this.notPortabilityReason, notPortabilityReasonCode: this.notPortabilityReasonCode, portInPhoneNumberStatus: this.portInPhoneNumberStatus, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PortingPortInPhoneNumberInstance = PortingPortInPhoneNumberInstance; function PortingPortInPhoneNumberListInstance(version) { const instance = ((portInRequestSid, phoneNumberSid) => instance.get(portInRequestSid, phoneNumberSid)); instance.get = function get(portInRequestSid, phoneNumberSid) { return new PortingPortInPhoneNumberContextImpl(version, portInRequestSid, phoneNumberSid); }; 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; } exports.PortingPortInPhoneNumberListInstance = PortingPortInPhoneNumberListInstance; rest/numbers/v1/portingWebhookConfigurationFetch.js000064400000006006151677225100016573 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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.PortingWebhookConfigurationFetchInstance = exports.PortingWebhookConfigurationFetchListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function PortingWebhookConfigurationFetchListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Porting/Configuration/Webhook`; instance.fetch = function fetch(callback) { let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PortingWebhookConfigurationFetchInstance(operationVersion, payload)); 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; } exports.PortingWebhookConfigurationFetchListInstance = PortingWebhookConfigurationFetchListInstance; class PortingWebhookConfigurationFetchInstance { constructor(_version, payload) { this._version = _version; this.url = payload.url; this.portInTargetUrl = payload.port_in_target_url; this.portOutTargetUrl = payload.port_out_target_url; this.notificationsOf = payload.notifications_of; this.portInTargetDateCreated = deserialize.iso8601DateTime(payload.port_in_target_date_created); this.portOutTargetDateCreated = deserialize.iso8601DateTime(payload.port_out_target_date_created); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { url: this.url, portInTargetUrl: this.portInTargetUrl, portOutTargetUrl: this.portOutTargetUrl, notificationsOf: this.notificationsOf, portInTargetDateCreated: this.portInTargetDateCreated, portOutTargetDateCreated: this.portOutTargetDateCreated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PortingWebhookConfigurationFetchInstance = PortingWebhookConfigurationFetchInstance; rest/numbers/v1/portingWebhookConfiguration.d.ts000064400000005144151677225100016057 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a PortingWebhookConfigurationInstance */ export interface PortingWebhookConfigurationListInstanceCreateOptions { /** */ body?: object; } export interface PortingWebhookConfigurationSolution { } export interface PortingWebhookConfigurationListInstance { _version: V1; _solution: PortingWebhookConfigurationSolution; _uri: string; /** * Create a PortingWebhookConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingWebhookConfigurationInstance */ create(callback?: (error: Error | null, item?: PortingWebhookConfigurationInstance) => any): Promise<PortingWebhookConfigurationInstance>; /** * Create a PortingWebhookConfigurationInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingWebhookConfigurationInstance */ create(params: object, callback?: (error: Error | null, item?: PortingWebhookConfigurationInstance) => any): Promise<PortingWebhookConfigurationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PortingWebhookConfigurationListInstance(version: V1): PortingWebhookConfigurationListInstance; interface PortingWebhookConfigurationResource { url: string; port_in_target_url: string; port_out_target_url: string; notifications_of: Array<string>; } export declare class PortingWebhookConfigurationInstance { protected _version: V1; constructor(_version: V1, payload: PortingWebhookConfigurationResource); /** * The URL of the webhook configuration request */ url: string; /** * Webhook URL to send a request when a port in request or port in phone number event happens */ portInTargetUrl: string; /** * Webhook URL to send a request when a port out phone number event happens */ portOutTargetUrl: string; /** * List of notification events to send a request to the webhook URL */ notificationsOf: Array<string>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { url: string; portInTargetUrl: string; portOutTargetUrl: string; notificationsOf: string[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/numbers/v1/portingPortability.d.ts000064400000013522151677225100014232 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export type PortingPortabilityNumberType = "LOCAL" | "UNKNOWN" | "MOBILE" | "TOLL-FREE"; /** * Options to pass to fetch a PortingPortabilityInstance */ export interface PortingPortabilityContextFetchOptions { /** The SID of the account where the phone number(s) will be ported. */ targetAccountSid?: string; } export interface PortingPortabilityContext { /** * Fetch a PortingPortabilityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortabilityInstance */ fetch(callback?: (error: Error | null, item?: PortingPortabilityInstance) => any): Promise<PortingPortabilityInstance>; /** * Fetch a PortingPortabilityInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortabilityInstance */ fetch(params: PortingPortabilityContextFetchOptions, callback?: (error: Error | null, item?: PortingPortabilityInstance) => any): Promise<PortingPortabilityInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PortingPortabilityContextSolution { phoneNumber: string; } export declare class PortingPortabilityContextImpl implements PortingPortabilityContext { protected _version: V1; protected _solution: PortingPortabilityContextSolution; protected _uri: string; constructor(_version: V1, phoneNumber: string); fetch(params?: PortingPortabilityContextFetchOptions | ((error: Error | null, item?: PortingPortabilityInstance) => any), callback?: (error: Error | null, item?: PortingPortabilityInstance) => any): Promise<PortingPortabilityInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PortingPortabilityContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PortingPortabilityResource { phone_number: string; account_sid: string; portable: boolean; pin_and_account_number_required: boolean; not_portable_reason: string; not_portable_reason_code: number; number_type: PortingPortabilityNumberType; country: string; messaging_carrier: string; voice_carrier: string; url: string; } export declare class PortingPortabilityInstance { protected _version: V1; protected _solution: PortingPortabilityContextSolution; protected _context?: PortingPortabilityContext; constructor(_version: V1, payload: PortingPortabilityResource, phoneNumber?: string); /** * The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212). */ phoneNumber: string; /** * The target account sid to which the number will be ported */ accountSid: string; /** * Boolean flag specifying if phone number is portable or not. */ portable: boolean; /** * Boolean flag specifying if PIN and account number is required for the phone number. */ pinAndAccountNumberRequired: boolean; /** * Reason why the phone number cannot be ported into Twilio, `null` otherwise. */ notPortableReason: string; /** * The Portability Reason Code for the phone number if it cannot be ported into Twilio, `null` otherwise. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`. */ notPortableReasonCode: number; numberType: PortingPortabilityNumberType; /** * Country the phone number belongs to. */ country: string; /** * Current messaging carrier of the phone number */ messagingCarrier: string; /** * Current voice carrier of the phone number */ voiceCarrier: string; /** * This is the url of the request that you\'re trying to reach out to locate the resource. */ url: string; private get _proxy(); /** * Fetch a PortingPortabilityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortabilityInstance */ fetch(callback?: (error: Error | null, item?: PortingPortabilityInstance) => any): Promise<PortingPortabilityInstance>; /** * Fetch a PortingPortabilityInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PortingPortabilityInstance */ fetch(params: PortingPortabilityContextFetchOptions, callback?: (error: Error | null, item?: PortingPortabilityInstance) => any): Promise<PortingPortabilityInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { phoneNumber: string; accountSid: string; portable: boolean; pinAndAccountNumberRequired: boolean; notPortableReason: string; notPortableReasonCode: number; numberType: PortingPortabilityNumberType; country: string; messagingCarrier: string; voiceCarrier: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PortingPortabilitySolution { } export interface PortingPortabilityListInstance { _version: V1; _solution: PortingPortabilitySolution; _uri: string; (phoneNumber: string): PortingPortabilityContext; get(phoneNumber: string): PortingPortabilityContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PortingPortabilityListInstance(version: V1): PortingPortabilityListInstance; export {}; rest/numbers/V1.js000064400000010567151677225100010037 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Numbers * 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 bulkEligibility_1 = require("./v1/bulkEligibility"); const eligibility_1 = require("./v1/eligibility"); const portingPortIn_1 = require("./v1/portingPortIn"); const portingPortInPhoneNumber_1 = require("./v1/portingPortInPhoneNumber"); const portingPortability_1 = require("./v1/portingPortability"); const portingWebhookConfiguration_1 = require("./v1/portingWebhookConfiguration"); const portingWebhookConfigurationDelete_1 = require("./v1/portingWebhookConfigurationDelete"); const portingWebhookConfigurationFetch_1 = require("./v1/portingWebhookConfigurationFetch"); const signingRequestConfiguration_1 = require("./v1/signingRequestConfiguration"); class V1 extends Version_1.default { /** * Initialize the V1 version of Numbers * * @param domain - The Twilio (Twilio.Numbers) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for bulkEligibilities resource */ get bulkEligibilities() { this._bulkEligibilities = this._bulkEligibilities || (0, bulkEligibility_1.BulkEligibilityListInstance)(this); return this._bulkEligibilities; } /** Getter for eligibilities resource */ get eligibilities() { this._eligibilities = this._eligibilities || (0, eligibility_1.EligibilityListInstance)(this); return this._eligibilities; } /** Getter for portingPortIns resource */ get portingPortIns() { this._portingPortIns = this._portingPortIns || (0, portingPortIn_1.PortingPortInListInstance)(this); return this._portingPortIns; } /** Getter for portingPortInPhoneNumber resource */ get portingPortInPhoneNumber() { this._portingPortInPhoneNumber = this._portingPortInPhoneNumber || (0, portingPortInPhoneNumber_1.PortingPortInPhoneNumberListInstance)(this); return this._portingPortInPhoneNumber; } /** Getter for portingPortabilities resource */ get portingPortabilities() { this._portingPortabilities = this._portingPortabilities || (0, portingPortability_1.PortingPortabilityListInstance)(this); return this._portingPortabilities; } /** Getter for portingWebhookConfigurations resource */ get portingWebhookConfigurations() { this._portingWebhookConfigurations = this._portingWebhookConfigurations || (0, portingWebhookConfiguration_1.PortingWebhookConfigurationListInstance)(this); return this._portingWebhookConfigurations; } /** Getter for portingWebhookConfigurationsDelete resource */ get portingWebhookConfigurationsDelete() { this._portingWebhookConfigurationsDelete = this._portingWebhookConfigurationsDelete || (0, portingWebhookConfigurationDelete_1.PortingWebhookConfigurationDeleteListInstance)(this); return this._portingWebhookConfigurationsDelete; } /** Getter for portingWebhookConfigurationFetch resource */ get portingWebhookConfigurationFetch() { this._portingWebhookConfigurationFetch = this._portingWebhookConfigurationFetch || (0, portingWebhookConfigurationFetch_1.PortingWebhookConfigurationFetchListInstance)(this); return this._portingWebhookConfigurationFetch; } /** Getter for signingRequestConfigurations resource */ get signingRequestConfigurations() { this._signingRequestConfigurations = this._signingRequestConfigurations || (0, signingRequestConfiguration_1.SigningRequestConfigurationListInstance)(this); return this._signingRequestConfigurations; } } exports.default = V1; rest/content/V2.d.ts000064400000001605151677225100010264 0ustar00import ContentBase from "../ContentBase"; import Version from "../../base/Version"; import { ContentListInstance } from "./v2/content"; import { ContentAndApprovalsListInstance } from "./v2/contentAndApprovals"; export default class V2 extends Version { /** * Initialize the V2 version of Content * * @param domain - The Twilio (Twilio.Content) domain */ constructor(domain: ContentBase); /** contents - { Twilio.Content.V2.ContentListInstance } resource */ protected _contents?: ContentListInstance; /** contentAndApprovals - { Twilio.Content.V2.ContentAndApprovalsListInstance } resource */ protected _contentAndApprovals?: ContentAndApprovalsListInstance; /** Getter for contents resource */ get contents(): ContentListInstance; /** Getter for contentAndApprovals resource */ get contentAndApprovals(): ContentAndApprovalsListInstance; } rest/content/V1.d.ts000064400000002270151677225100010262 0ustar00import ContentBase from "../ContentBase"; import Version from "../../base/Version"; import { ContentListInstance } from "./v1/content"; import { ContentAndApprovalsListInstance } from "./v1/contentAndApprovals"; import { LegacyContentListInstance } from "./v1/legacyContent"; export default class V1 extends Version { /** * Initialize the V1 version of Content * * @param domain - The Twilio (Twilio.Content) domain */ constructor(domain: ContentBase); /** contents - { Twilio.Content.V1.ContentListInstance } resource */ protected _contents?: ContentListInstance; /** contentAndApprovals - { Twilio.Content.V1.ContentAndApprovalsListInstance } resource */ protected _contentAndApprovals?: ContentAndApprovalsListInstance; /** legacyContents - { Twilio.Content.V1.LegacyContentListInstance } resource */ protected _legacyContents?: LegacyContentListInstance; /** Getter for contents resource */ get contents(): ContentListInstance; /** Getter for contentAndApprovals resource */ get contentAndApprovals(): ContentAndApprovalsListInstance; /** Getter for legacyContents resource */ get legacyContents(): LegacyContentListInstance; } rest/content/V2.js000064400000003066151677225100010033 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Content * 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 content_1 = require("./v2/content"); const contentAndApprovals_1 = require("./v2/contentAndApprovals"); class V2 extends Version_1.default { /** * Initialize the V2 version of Content * * @param domain - The Twilio (Twilio.Content) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for contents resource */ get contents() { this._contents = this._contents || (0, content_1.ContentListInstance)(this); return this._contents; } /** Getter for contentAndApprovals resource */ get contentAndApprovals() { this._contentAndApprovals = this._contentAndApprovals || (0, contentAndApprovals_1.ContentAndApprovalsListInstance)(this); return this._contentAndApprovals; } } exports.default = V2; rest/content/v2/content.js000064400000013711151677225100011543 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Content * 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.ContentPage = exports.ContentInstance = exports.ContentListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function ContentListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Content`; 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["sortByDate"] !== undefined) data["SortByDate"] = params["sortByDate"]; if (params["sortByContentName"] !== undefined) data["SortByContentName"] = params["sortByContentName"]; if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); if (params["contentName"] !== undefined) data["ContentName"] = params["contentName"]; if (params["content"] !== undefined) data["Content"] = params["content"]; if (params["language"] !== undefined) data["Language"] = serialize.map(params["language"], (e) => e); if (params["contentType"] !== undefined) data["ContentType"] = serialize.map(params["contentType"], (e) => e); if (params["channelEligibility"] !== undefined) data["ChannelEligibility"] = serialize.map(params["channelEligibility"], (e) => e); if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ContentPage(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 ContentPage(instance._version, payload, 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; } exports.ContentListInstance = ContentListInstance; class ContentInstance { constructor(_version, payload) { this._version = _version; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.language = payload.language; this.variables = payload.variables; this.types = payload.types; this.url = payload.url; this.links = payload.links; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, language: this.language, variables: this.variables, types: this.types, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ContentInstance = ContentInstance; class ContentPage extends Page_1.default { /** * Initialize the ContentPage * * @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 ContentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ContentInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ContentPage = ContentPage; rest/content/v2/content.d.ts000064400000022772151677225100012006 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; /** * Options to pass to each */ export interface ContentListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Whether to sort by ascending or descending date updated */ sortByDate?: string; /** Whether to sort by ascending or descending content name */ sortByContentName?: string; /** Filter by >=[date-time] */ dateCreatedAfter?: Date; /** Filter by <=[date-time] */ dateCreatedBefore?: Date; /** Filter by Regex Pattern in content name */ contentName?: string; /** Filter by Regex Pattern in template content */ content?: string; /** Filter by array of valid language(s) */ language?: Array<string>; /** Filter by array of contentType(s) */ contentType?: Array<string>; /** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */ channelEligibility?: Array<string>; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ContentInstance, 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 ContentListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Whether to sort by ascending or descending date updated */ sortByDate?: string; /** Whether to sort by ascending or descending content name */ sortByContentName?: string; /** Filter by >=[date-time] */ dateCreatedAfter?: Date; /** Filter by <=[date-time] */ dateCreatedBefore?: Date; /** Filter by Regex Pattern in content name */ contentName?: string; /** Filter by Regex Pattern in template content */ content?: string; /** Filter by array of valid language(s) */ language?: Array<string>; /** Filter by array of contentType(s) */ contentType?: Array<string>; /** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */ channelEligibility?: Array<string>; /** 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 ContentListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Whether to sort by ascending or descending date updated */ sortByDate?: string; /** Whether to sort by ascending or descending content name */ sortByContentName?: string; /** Filter by >=[date-time] */ dateCreatedAfter?: Date; /** Filter by <=[date-time] */ dateCreatedBefore?: Date; /** Filter by Regex Pattern in content name */ contentName?: string; /** Filter by Regex Pattern in template content */ content?: string; /** Filter by array of valid language(s) */ language?: Array<string>; /** Filter by array of contentType(s) */ contentType?: Array<string>; /** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */ channelEligibility?: Array<string>; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ContentSolution { } export interface ContentListInstance { _version: V2; _solution: ContentSolution; _uri: string; /** * Streams ContentInstance 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 { ContentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void; each(params: ContentListInstanceEachOptions, callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ContentInstance 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: ContentPage) => any): Promise<ContentPage>; /** * Lists ContentInstance 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 { ContentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>; list(params: ContentListInstanceOptions, callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>; /** * Retrieve a single page of ContentInstance 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 { ContentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>; page(params: ContentListInstancePageOptions, callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ContentListInstance(version: V2): ContentListInstance; interface ContentPayload extends TwilioResponsePayload { contents: ContentResource[]; } interface ContentResource { date_created: Date; date_updated: Date; sid: string; account_sid: string; friendly_name: string; language: string; variables: any; types: any; url: string; links: Record<string, string>; } export declare class ContentInstance { protected _version: V2; constructor(_version: V2, payload: ContentResource); /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The unique string that that we created to identify the Content resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. */ accountSid: string; /** * A string name used to describe the Content resource. Not visible to the end recipient. */ friendlyName: string; /** * Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. */ language: string; /** * Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. */ variables: any; /** * The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. */ types: any; /** * The URL of the resource, relative to `https://content.twilio.com`. */ url: string; /** * A list of links related to the Content resource, such as approval_fetch and approval_create */ links: Record<string, string>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { dateCreated: Date; dateUpdated: Date; sid: string; accountSid: string; friendlyName: string; language: string; variables: any; types: any; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class ContentPage extends Page<V2, ContentPayload, ContentResource, ContentInstance> { /** * Initialize the ContentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ContentSolution); /** * Build an instance of ContentInstance * * @param payload - Payload response from the API */ getInstance(payload: ContentResource): ContentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/content/v2/contentAndApprovals.js000064400000014223151677225100014055 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Content * 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.ContentAndApprovalsPage = exports.ContentAndApprovalsInstance = exports.ContentAndApprovalsListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function ContentAndApprovalsListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/ContentAndApprovals`; 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["sortByDate"] !== undefined) data["SortByDate"] = params["sortByDate"]; if (params["sortByContentName"] !== undefined) data["SortByContentName"] = params["sortByContentName"]; if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); if (params["contentName"] !== undefined) data["ContentName"] = params["contentName"]; if (params["content"] !== undefined) data["Content"] = params["content"]; if (params["language"] !== undefined) data["Language"] = serialize.map(params["language"], (e) => e); if (params["contentType"] !== undefined) data["ContentType"] = serialize.map(params["contentType"], (e) => e); if (params["channelEligibility"] !== undefined) data["ChannelEligibility"] = serialize.map(params["channelEligibility"], (e) => e); if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ContentAndApprovalsPage(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 ContentAndApprovalsPage(instance._version, payload, 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; } exports.ContentAndApprovalsListInstance = ContentAndApprovalsListInstance; class ContentAndApprovalsInstance { constructor(_version, payload) { this._version = _version; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.language = payload.language; this.variables = payload.variables; this.types = payload.types; this.approvalRequests = payload.approval_requests; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, language: this.language, variables: this.variables, types: this.types, approvalRequests: this.approvalRequests, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ContentAndApprovalsInstance = ContentAndApprovalsInstance; class ContentAndApprovalsPage extends Page_1.default { /** * Initialize the ContentAndApprovalsPage * * @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 ContentAndApprovalsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ContentAndApprovalsInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ContentAndApprovalsPage = ContentAndApprovalsPage; rest/content/v2/contentAndApprovals.d.ts000064400000023541151677225100014314 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; /** * Options to pass to each */ export interface ContentAndApprovalsListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Whether to sort by ascending or descending date updated */ sortByDate?: string; /** Whether to sort by ascending or descending content name */ sortByContentName?: string; /** Filter by >=[date-time] */ dateCreatedAfter?: Date; /** Filter by <=[date-time] */ dateCreatedBefore?: Date; /** Filter by Regex Pattern in content name */ contentName?: string; /** Filter by Regex Pattern in template content */ content?: string; /** Filter by array of valid language(s) */ language?: Array<string>; /** Filter by array of contentType(s) */ contentType?: Array<string>; /** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */ channelEligibility?: Array<string>; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ContentAndApprovalsInstance, 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 ContentAndApprovalsListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Whether to sort by ascending or descending date updated */ sortByDate?: string; /** Whether to sort by ascending or descending content name */ sortByContentName?: string; /** Filter by >=[date-time] */ dateCreatedAfter?: Date; /** Filter by <=[date-time] */ dateCreatedBefore?: Date; /** Filter by Regex Pattern in content name */ contentName?: string; /** Filter by Regex Pattern in template content */ content?: string; /** Filter by array of valid language(s) */ language?: Array<string>; /** Filter by array of contentType(s) */ contentType?: Array<string>; /** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */ channelEligibility?: Array<string>; /** 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 ContentAndApprovalsListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Whether to sort by ascending or descending date updated */ sortByDate?: string; /** Whether to sort by ascending or descending content name */ sortByContentName?: string; /** Filter by >=[date-time] */ dateCreatedAfter?: Date; /** Filter by <=[date-time] */ dateCreatedBefore?: Date; /** Filter by Regex Pattern in content name */ contentName?: string; /** Filter by Regex Pattern in template content */ content?: string; /** Filter by array of valid language(s) */ language?: Array<string>; /** Filter by array of contentType(s) */ contentType?: Array<string>; /** Filter by array of ChannelEligibility(s), where ChannelEligibility=<channel>:<status> */ channelEligibility?: Array<string>; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ContentAndApprovalsSolution { } export interface ContentAndApprovalsListInstance { _version: V2; _solution: ContentAndApprovalsSolution; _uri: string; /** * Streams ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void; each(params: ContentAndApprovalsListInstanceEachOptions, callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ContentAndApprovalsInstance 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: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>; /** * Lists ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ContentAndApprovalsInstance[]) => any): Promise<ContentAndApprovalsInstance[]>; list(params: ContentAndApprovalsListInstanceOptions, callback?: (error: Error | null, items: ContentAndApprovalsInstance[]) => any): Promise<ContentAndApprovalsInstance[]>; /** * Retrieve a single page of ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>; page(params: ContentAndApprovalsListInstancePageOptions, callback?: (error: Error | null, items: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ContentAndApprovalsListInstance(version: V2): ContentAndApprovalsListInstance; interface ContentAndApprovalsPayload extends TwilioResponsePayload { contents: ContentAndApprovalsResource[]; } interface ContentAndApprovalsResource { date_created: Date; date_updated: Date; sid: string; account_sid: string; friendly_name: string; language: string; variables: any; types: any; approval_requests: any; } export declare class ContentAndApprovalsInstance { protected _version: V2; constructor(_version: V2, payload: ContentAndApprovalsResource); /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The unique string that that we created to identify the Content resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. */ accountSid: string; /** * A string name used to describe the Content resource. Not visible to the end recipient. */ friendlyName: string; /** * Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. */ language: string; /** * Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. */ variables: any; /** * The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. */ types: any; /** * The submitted information and approval request status of the Content resource. */ approvalRequests: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { dateCreated: Date; dateUpdated: Date; sid: string; accountSid: string; friendlyName: string; language: string; variables: any; types: any; approvalRequests: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class ContentAndApprovalsPage extends Page<V2, ContentAndApprovalsPayload, ContentAndApprovalsResource, ContentAndApprovalsInstance> { /** * Initialize the ContentAndApprovalsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ContentAndApprovalsSolution); /** * Build an instance of ContentAndApprovalsInstance * * @param payload - Payload response from the API */ getInstance(payload: ContentAndApprovalsResource): ContentAndApprovalsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/content/v1/content.js000064400000021407151677225100011543 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Content * 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.ContentPage = exports.ContentListInstance = exports.ContentInstance = exports.ContentContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const approvalCreate_1 = require("./content/approvalCreate"); const approvalFetch_1 = require("./content/approvalFetch"); class ContentContextImpl { 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 = `/Content/${sid}`; } get approvalCreate() { this._approvalCreate = this._approvalCreate || (0, approvalCreate_1.ApprovalCreateListInstance)(this._version, this._solution.sid); return this._approvalCreate; } get approvalFetch() { this._approvalFetch = this._approvalFetch || (0, approvalFetch_1.ApprovalFetchListInstance)(this._version, this._solution.sid); return this._approvalFetch; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ContentInstance(operationVersion, payload, 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.ContentContextImpl = ContentContextImpl; class ContentInstance { constructor(_version, payload, sid) { this._version = _version; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.language = payload.language; this.variables = payload.variables; this.types = payload.types; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ContentContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ContentInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the approvalCreate. */ approvalCreate() { return this._proxy.approvalCreate; } /** * Access the approvalFetch. */ approvalFetch() { return this._proxy.approvalFetch; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, language: this.language, variables: this.variables, types: this.types, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ContentInstance = ContentInstance; function ContentListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ContentContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Content`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ContentInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ContentPage(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 ContentPage(instance._version, payload, 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; } exports.ContentListInstance = ContentListInstance; class ContentPage extends Page_1.default { /** * Initialize the ContentPage * * @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 ContentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ContentInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ContentPage = ContentPage; rest/content/v1/content/approvalCreate.js000064400000006326151677225100014516 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Content * 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.ApprovalCreateInstance = exports.ApprovalCreateListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function ApprovalCreateListInstance(version, sid) { if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { sid }; instance._uri = `/Content/${sid}/ApprovalRequests/whatsapp`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ApprovalCreateInstance(operationVersion, payload, instance._solution.sid)); 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; } exports.ApprovalCreateListInstance = ApprovalCreateListInstance; class ApprovalCreateInstance { constructor(_version, payload, sid) { this._version = _version; this.name = payload.name; this.category = payload.category; this.contentType = payload.content_type; this.status = payload.status; this.rejectionReason = payload.rejection_reason; this.allowCategoryChange = payload.allow_category_change; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { name: this.name, category: this.category, contentType: this.contentType, status: this.status, rejectionReason: this.rejectionReason, allowCategoryChange: this.allowCategoryChange, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ApprovalCreateInstance = ApprovalCreateInstance; rest/content/v1/content/approvalCreate.d.ts000064400000004260151677225100014745 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; /** * Options to pass to create a ApprovalCreateInstance */ export interface ApprovalCreateListInstanceCreateOptions { /** */ body?: object; } export interface ApprovalCreateSolution { sid: string; } export interface ApprovalCreateListInstance { _version: V1; _solution: ApprovalCreateSolution; _uri: string; /** * Create a ApprovalCreateInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApprovalCreateInstance */ create(callback?: (error: Error | null, item?: ApprovalCreateInstance) => any): Promise<ApprovalCreateInstance>; /** * Create a ApprovalCreateInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ApprovalCreateInstance */ create(params: object, callback?: (error: Error | null, item?: ApprovalCreateInstance) => any): Promise<ApprovalCreateInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ApprovalCreateListInstance(version: V1, sid: string): ApprovalCreateListInstance; interface ApprovalCreateResource { name: string; category: string; content_type: string; status: string; rejection_reason: string; allow_category_change: boolean; } export declare class ApprovalCreateInstance { protected _version: V1; constructor(_version: V1, payload: ApprovalCreateResource, sid: string); name: string; category: string; contentType: string; status: string; rejectionReason: string; allowCategoryChange: boolean; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { name: string; category: string; contentType: string; status: string; rejectionReason: string; allowCategoryChange: boolean; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/content/v1/content/approvalFetch.js000064400000007533151677225100014345 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Content * 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.ApprovalFetchListInstance = exports.ApprovalFetchInstance = exports.ApprovalFetchContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class ApprovalFetchContextImpl { 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 = `/Content/${sid}/ApprovalRequests`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ApprovalFetchInstance(operationVersion, payload, 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.ApprovalFetchContextImpl = ApprovalFetchContextImpl; class ApprovalFetchInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.whatsapp = payload.whatsapp; this.url = payload.url; this._solution = { sid }; } get _proxy() { this._context = this._context || new ApprovalFetchContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a ApprovalFetchInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApprovalFetchInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, whatsapp: this.whatsapp, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ApprovalFetchInstance = ApprovalFetchInstance; function ApprovalFetchListInstance(version, sid) { if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new ApprovalFetchContextImpl(version, sid); }; instance._version = version; instance._solution = { sid }; 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; } exports.ApprovalFetchListInstance = ApprovalFetchListInstance; rest/content/v1/content/approvalFetch.d.ts000064400000006274151677225100014602 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export interface ApprovalFetchContext { /** * Fetch a ApprovalFetchInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApprovalFetchInstance */ fetch(callback?: (error: Error | null, item?: ApprovalFetchInstance) => any): Promise<ApprovalFetchInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ApprovalFetchContextSolution { sid: string; } export declare class ApprovalFetchContextImpl implements ApprovalFetchContext { protected _version: V1; protected _solution: ApprovalFetchContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: ApprovalFetchInstance) => any): Promise<ApprovalFetchInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ApprovalFetchContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ApprovalFetchResource { sid: string; account_sid: string; whatsapp: any; url: string; } export declare class ApprovalFetchInstance { protected _version: V1; protected _solution: ApprovalFetchContextSolution; protected _context?: ApprovalFetchContext; constructor(_version: V1, payload: ApprovalFetchResource, sid: string); /** * The unique string that that we created to identify the Content resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. */ accountSid: string; /** * Contains the whatsapp approval information for the Content resource, with fields such as approval status, rejection reason, and category, amongst others. */ whatsapp: any; /** * The URL of the resource, relative to `https://content.twilio.com`. */ url: string; private get _proxy(); /** * Fetch a ApprovalFetchInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApprovalFetchInstance */ fetch(callback?: (error: Error | null, item?: ApprovalFetchInstance) => any): Promise<ApprovalFetchInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; whatsapp: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ApprovalFetchSolution { sid: string; } export interface ApprovalFetchListInstance { _version: V1; _solution: ApprovalFetchSolution; _uri: string; (): ApprovalFetchContext; get(): ApprovalFetchContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ApprovalFetchListInstance(version: V1, sid: string): ApprovalFetchListInstance; export {}; rest/content/v1/content.d.ts000064400000025310151677225100011774 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { ApprovalCreateListInstance } from "./content/approvalCreate"; import { ApprovalFetchListInstance } from "./content/approvalFetch"; /** * Options to pass to create a ContentInstance */ export interface ContentListInstanceCreateOptions { /** */ body?: object; } /** * Options to pass to each */ export interface ContentListInstanceEachOptions { /** 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: ContentInstance, 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 ContentListInstanceOptions { /** 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 ContentListInstancePageOptions { /** 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 ContentContext { approvalCreate: ApprovalCreateListInstance; approvalFetch: ApprovalFetchListInstance; /** * Remove a ContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ContentInstance */ fetch(callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ContentContextSolution { sid: string; } export declare class ContentContextImpl implements ContentContext { protected _version: V1; protected _solution: ContentContextSolution; protected _uri: string; protected _approvalCreate?: ApprovalCreateListInstance; protected _approvalFetch?: ApprovalFetchListInstance; constructor(_version: V1, sid: string); get approvalCreate(): ApprovalCreateListInstance; get approvalFetch(): ApprovalFetchListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ContentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ContentPayload extends TwilioResponsePayload { contents: ContentResource[]; } interface ContentResource { date_created: Date; date_updated: Date; sid: string; account_sid: string; friendly_name: string; language: string; variables: any; types: any; url: string; links: Record<string, string>; } export declare class ContentInstance { protected _version: V1; protected _solution: ContentContextSolution; protected _context?: ContentContext; constructor(_version: V1, payload: ContentResource, sid?: string); /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The unique string that that we created to identify the Content resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. */ accountSid: string; /** * A string name used to describe the Content resource. Not visible to the end recipient. */ friendlyName: string; /** * Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. */ language: string; /** * Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. */ variables: any; /** * The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. */ types: any; /** * The URL of the resource, relative to `https://content.twilio.com`. */ url: string; /** * A list of links related to the Content resource, such as approval_fetch and approval_create */ links: Record<string, string>; private get _proxy(); /** * Remove a ContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ContentInstance */ fetch(callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>; /** * Access the approvalCreate. */ approvalCreate(): ApprovalCreateListInstance; /** * Access the approvalFetch. */ approvalFetch(): ApprovalFetchListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { dateCreated: Date; dateUpdated: Date; sid: string; accountSid: string; friendlyName: string; language: string; variables: any; types: any; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ContentSolution { } export interface ContentListInstance { _version: V1; _solution: ContentSolution; _uri: string; (sid: string): ContentContext; get(sid: string): ContentContext; /** * Create a ContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ContentInstance */ create(callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>; /** * Create a ContentInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ContentInstance */ create(params: object, callback?: (error: Error | null, item?: ContentInstance) => any): Promise<ContentInstance>; /** * Streams ContentInstance 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 { ContentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void; each(params: ContentListInstanceEachOptions, callback?: (item: ContentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ContentInstance 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: ContentPage) => any): Promise<ContentPage>; /** * Lists ContentInstance 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 { ContentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>; list(params: ContentListInstanceOptions, callback?: (error: Error | null, items: ContentInstance[]) => any): Promise<ContentInstance[]>; /** * Retrieve a single page of ContentInstance 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 { ContentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>; page(params: ContentListInstancePageOptions, callback?: (error: Error | null, items: ContentPage) => any): Promise<ContentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ContentListInstance(version: V1): ContentListInstance; export declare class ContentPage extends Page<V1, ContentPayload, ContentResource, ContentInstance> { /** * Initialize the ContentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ContentSolution); /** * Build an instance of ContentInstance * * @param payload - Payload response from the API */ getInstance(payload: ContentResource): ContentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/content/v1/contentAndApprovals.js000064400000012050151677225100014050 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Content * 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.ContentAndApprovalsPage = exports.ContentAndApprovalsInstance = exports.ContentAndApprovalsListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function ContentAndApprovalsListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/ContentAndApprovals`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ContentAndApprovalsPage(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 ContentAndApprovalsPage(instance._version, payload, 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; } exports.ContentAndApprovalsListInstance = ContentAndApprovalsListInstance; class ContentAndApprovalsInstance { constructor(_version, payload) { this._version = _version; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.language = payload.language; this.variables = payload.variables; this.types = payload.types; this.approvalRequests = payload.approval_requests; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, language: this.language, variables: this.variables, types: this.types, approvalRequests: this.approvalRequests, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ContentAndApprovalsInstance = ContentAndApprovalsInstance; class ContentAndApprovalsPage extends Page_1.default { /** * Initialize the ContentAndApprovalsPage * * @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 ContentAndApprovalsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ContentAndApprovalsInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ContentAndApprovalsPage = ContentAndApprovalsPage; rest/content/v1/contentAndApprovals.d.ts000064400000017144151677225100014315 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface ContentAndApprovalsListInstanceEachOptions { /** 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: ContentAndApprovalsInstance, 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 ContentAndApprovalsListInstanceOptions { /** 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 ContentAndApprovalsListInstancePageOptions { /** 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 ContentAndApprovalsSolution { } export interface ContentAndApprovalsListInstance { _version: V1; _solution: ContentAndApprovalsSolution; _uri: string; /** * Streams ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void; each(params: ContentAndApprovalsListInstanceEachOptions, callback?: (item: ContentAndApprovalsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ContentAndApprovalsInstance 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: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>; /** * Lists ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ContentAndApprovalsInstance[]) => any): Promise<ContentAndApprovalsInstance[]>; list(params: ContentAndApprovalsListInstanceOptions, callback?: (error: Error | null, items: ContentAndApprovalsInstance[]) => any): Promise<ContentAndApprovalsInstance[]>; /** * Retrieve a single page of ContentAndApprovalsInstance 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 { ContentAndApprovalsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>; page(params: ContentAndApprovalsListInstancePageOptions, callback?: (error: Error | null, items: ContentAndApprovalsPage) => any): Promise<ContentAndApprovalsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ContentAndApprovalsListInstance(version: V1): ContentAndApprovalsListInstance; interface ContentAndApprovalsPayload extends TwilioResponsePayload { contents: ContentAndApprovalsResource[]; } interface ContentAndApprovalsResource { date_created: Date; date_updated: Date; sid: string; account_sid: string; friendly_name: string; language: string; variables: any; types: any; approval_requests: any; } export declare class ContentAndApprovalsInstance { protected _version: V1; constructor(_version: V1, payload: ContentAndApprovalsResource); /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The unique string that that we created to identify the Content resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. */ accountSid: string; /** * A string name used to describe the Content resource. Not visible to the end recipient. */ friendlyName: string; /** * Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. */ language: string; /** * Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. */ variables: any; /** * The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. */ types: any; /** * The submitted information and approval request status of the Content resource. */ approvalRequests: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { dateCreated: Date; dateUpdated: Date; sid: string; accountSid: string; friendlyName: string; language: string; variables: any; types: any; approvalRequests: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class ContentAndApprovalsPage extends Page<V1, ContentAndApprovalsPayload, ContentAndApprovalsResource, ContentAndApprovalsInstance> { /** * Initialize the ContentAndApprovalsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ContentAndApprovalsSolution); /** * Build an instance of ContentAndApprovalsInstance * * @param payload - Payload response from the API */ getInstance(payload: ContentAndApprovalsResource): ContentAndApprovalsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/content/v1/legacyContent.js000064400000012130151677225100012661 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Content * 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.LegacyContentPage = exports.LegacyContentInstance = exports.LegacyContentListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function LegacyContentListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/LegacyContent`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new LegacyContentPage(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 LegacyContentPage(instance._version, payload, 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; } exports.LegacyContentListInstance = LegacyContentListInstance; class LegacyContentInstance { constructor(_version, payload) { this._version = _version; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.language = payload.language; this.variables = payload.variables; this.types = payload.types; this.legacyTemplateName = payload.legacy_template_name; this.legacyBody = payload.legacy_body; this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, language: this.language, variables: this.variables, types: this.types, legacyTemplateName: this.legacyTemplateName, legacyBody: this.legacyBody, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LegacyContentInstance = LegacyContentInstance; class LegacyContentPage extends Page_1.default { /** * Initialize the LegacyContentPage * * @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 LegacyContentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new LegacyContentInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LegacyContentPage = LegacyContentPage; rest/content/v1/legacyContent.d.ts000064400000017454151677225100013133 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface LegacyContentListInstanceEachOptions { /** 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: LegacyContentInstance, 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 LegacyContentListInstanceOptions { /** 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 LegacyContentListInstancePageOptions { /** 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 LegacyContentSolution { } export interface LegacyContentListInstance { _version: V1; _solution: LegacyContentSolution; _uri: string; /** * Streams LegacyContentInstance 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 { LegacyContentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: LegacyContentInstance, done: (err?: Error) => void) => void): void; each(params: LegacyContentListInstanceEachOptions, callback?: (item: LegacyContentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of LegacyContentInstance 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: LegacyContentPage) => any): Promise<LegacyContentPage>; /** * Lists LegacyContentInstance 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 { LegacyContentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: LegacyContentInstance[]) => any): Promise<LegacyContentInstance[]>; list(params: LegacyContentListInstanceOptions, callback?: (error: Error | null, items: LegacyContentInstance[]) => any): Promise<LegacyContentInstance[]>; /** * Retrieve a single page of LegacyContentInstance 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 { LegacyContentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: LegacyContentPage) => any): Promise<LegacyContentPage>; page(params: LegacyContentListInstancePageOptions, callback?: (error: Error | null, items: LegacyContentPage) => any): Promise<LegacyContentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function LegacyContentListInstance(version: V1): LegacyContentListInstance; interface LegacyContentPayload extends TwilioResponsePayload { contents: LegacyContentResource[]; } interface LegacyContentResource { date_created: Date; date_updated: Date; sid: string; account_sid: string; friendly_name: string; language: string; variables: any; types: any; legacy_template_name: string; legacy_body: string; url: string; } export declare class LegacyContentInstance { protected _version: V1; constructor(_version: V1, payload: LegacyContentResource); /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The unique string that that we created to identify the Content resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. */ accountSid: string; /** * A string name used to describe the Content resource. Not visible to the end recipient. */ friendlyName: string; /** * Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. */ language: string; /** * Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. */ variables: any; /** * The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. */ types: any; /** * The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed */ legacyTemplateName: string; /** * The string body field of the legacy content template associated with this Content resource */ legacyBody: string; /** * The URL of the resource, relative to `https://content.twilio.com`. */ url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { dateCreated: Date; dateUpdated: Date; sid: string; accountSid: string; friendlyName: string; language: string; variables: any; types: any; legacyTemplateName: string; legacyBody: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class LegacyContentPage extends Page<V1, LegacyContentPayload, LegacyContentResource, LegacyContentInstance> { /** * Initialize the LegacyContentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: LegacyContentSolution); /** * Build an instance of LegacyContentInstance * * @param payload - Payload response from the API */ getInstance(payload: LegacyContentResource): LegacyContentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/content/V1.js000064400000003532151677225100010030 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Content * 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 content_1 = require("./v1/content"); const contentAndApprovals_1 = require("./v1/contentAndApprovals"); const legacyContent_1 = require("./v1/legacyContent"); class V1 extends Version_1.default { /** * Initialize the V1 version of Content * * @param domain - The Twilio (Twilio.Content) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for contents resource */ get contents() { this._contents = this._contents || (0, content_1.ContentListInstance)(this); return this._contents; } /** Getter for contentAndApprovals resource */ get contentAndApprovals() { this._contentAndApprovals = this._contentAndApprovals || (0, contentAndApprovals_1.ContentAndApprovalsListInstance)(this); return this._contentAndApprovals; } /** Getter for legacyContents resource */ get legacyContents() { this._legacyContents = this._legacyContents || (0, legacyContent_1.LegacyContentListInstance)(this); return this._legacyContents; } } exports.default = V1; rest/ServerlessBase.js000064400000002064151677225100011017 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./serverless/V1")); class ServerlessBase extends Domain_1.default { /** * Initialize serverless domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://serverless.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = ServerlessBase; rest/Video.js000064400000003107151677225100007134 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const VideoBase_1 = __importDefault(require("./VideoBase")); class Video extends VideoBase_1.default { /** * @deprecated - Use v1.compositions instead */ get compositions() { console.warn("compositions is deprecated. Use v1.compositions instead."); return this.v1.compositions; } /** * @deprecated - Use v1.compositionHooks instead */ get compositionHooks() { console.warn("compositionHooks is deprecated. Use v1.compositionHooks instead."); return this.v1.compositionHooks; } /** * @deprecated - Use v1.compositionSettings instead */ get compositionSettings() { console.warn("compositionSettings is deprecated. Use v1.compositionSettings instead."); return this.v1.compositionSettings; } /** * @deprecated - Use v1.recordings instead */ get recordings() { console.warn("recordings is deprecated. Use v1.recordings instead."); return this.v1.recordings; } /** * @deprecated - Use v1.recordingSettings instead */ get recordingSettings() { console.warn("recordingSettings is deprecated. Use v1.recordingSettings instead."); return this.v1.recordingSettings; } /** * @deprecated - Use v1.rooms instead */ get rooms() { console.warn("rooms is deprecated. Use v1.rooms instead."); return this.v1.rooms; } } module.exports = Video; rest/MicrovisorBase.d.ts000064400000000462151677225100011252 0ustar00import Domain from "../base/Domain"; import V1 from "./microvisor/V1"; declare class MicrovisorBase extends Domain { _v1?: V1; /** * Initialize microvisor domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = MicrovisorBase; rest/InsightsBase.d.ts000064400000000452151677225100010705 0ustar00import Domain from "../base/Domain"; import V1 from "./insights/V1"; declare class InsightsBase extends Domain { _v1?: V1; /** * Initialize insights domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = InsightsBase; rest/Numbers.js000064400000001043151677225100007476 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const NumbersBase_1 = __importDefault(require("./NumbersBase")); class Numbers extends NumbersBase_1.default { /** * @deprecated - Use v2.regulatoryCompliance instead */ get regulatoryCompliance() { console.warn("regulatoryCompliance is deprecated. Use v2.regulatoryCompliance instead."); return this.v2.regulatoryCompliance; } } module.exports = Numbers; rest/MonitorBase.d.ts000064400000000446151677225100010547 0ustar00import Domain from "../base/Domain"; import V1 from "./monitor/V1"; declare class MonitorBase extends Domain { _v1?: V1; /** * Initialize monitor domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = MonitorBase; rest/Numbers.d.ts000064400000000512151677225100007732 0ustar00import { RegulatoryComplianceListInstance } from "./numbers/v2/regulatoryCompliance"; import NumbersBase from "./NumbersBase"; declare class Numbers extends NumbersBase { /** * @deprecated - Use v2.regulatoryCompliance instead */ get regulatoryCompliance(): RegulatoryComplianceListInstance; } export = Numbers; rest/SupersimBase.js000064400000002052151677225100010466 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./supersim/V1")); class SupersimBase extends Domain_1.default { /** * Initialize supersim domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://supersim.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = SupersimBase; rest/accounts/V1.d.ts000064400000002776151677225100010442 0ustar00import AccountsBase from "../AccountsBase"; import Version from "../../base/Version"; import { AuthTokenPromotionListInstance } from "./v1/authTokenPromotion"; import { CredentialListInstance } from "./v1/credential"; 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; /** credentials - { Twilio.Accounts.V1.CredentialListInstance } resource */ protected _credentials?: CredentialListInstance; /** 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 credentials resource */ get credentials(): CredentialListInstance; /** Getter for safelist resource */ get safelist(): SafelistListInstance; /** Getter for secondaryAuthToken resource */ get secondaryAuthToken(): SecondaryAuthTokenListInstance; } rest/accounts/v1/secondaryAuthToken.d.ts000064400000010224151677225100014277 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; 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>; /** * 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>; /** * 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>; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<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>; /** * 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>; /** * 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 {}; rest/accounts/v1/authTokenPromotion.d.ts000064400000007001151677225100014335 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; 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>; /** * 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>; /** * 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>; /** * 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 {}; rest/accounts/v1/credential/publicKey.d.ts000064400000026527151677225100014543 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * 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>; /** * 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>; /** * 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>; /** * 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>; fetch(callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<PublicKeyInstance>; update(params?: PublicKeyContextUpdateOptions | ((error: Error | null, item?: PublicKeyInstance) => any), callback?: (error: Error | null, item?: PublicKeyInstance) => any): Promise<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>; /** * 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>; /** * 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>; /** * 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>; /** * 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; /** * 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>; /** * 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[]>; /** * 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>; /** * 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 {}; rest/accounts/v1/credential/aws.d.ts000064400000025423151677225100013400 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * 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>; /** * 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>; /** * 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>; /** * 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>; fetch(callback?: (error: Error | null, item?: AwsInstance) => any): Promise<AwsInstance>; update(params?: AwsContextUpdateOptions | ((error: Error | null, item?: AwsInstance) => any), callback?: (error: Error | null, item?: AwsInstance) => any): Promise<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>; /** * 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>; /** * 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>; /** * 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>; /** * 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; /** * 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>; /** * 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[]>; /** * 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>; /** * 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 {}; rest/accounts/v1/credential/aws.js000064400000021715151677225100013144 0ustar00"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.AwsListInstance = exports.AwsInstance = exports.AwsContextImpl = void 0; 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 instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AwsInstance(operationVersion, payload, 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"; 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; } /** * 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); } /** * Fetch a AwsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AwsInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(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"; 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.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 = {}; 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.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; } exports.AwsListInstance = AwsListInstance; 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; rest/accounts/v1/credential/publicKey.js000064400000022217151677225100014277 0ustar00"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.PublicKeyListInstance = exports.PublicKeyInstance = exports.PublicKeyContextImpl = void 0; 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 instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PublicKeyInstance(operationVersion, payload, 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"; 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; } /** * 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); } /** * Fetch a PublicKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PublicKeyInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(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"; 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.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 = {}; 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.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; } exports.PublicKeyListInstance = PublicKeyListInstance; 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; rest/accounts/v1/safelist.js000064400000010401151677225100012040 0ustar00"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 = exports.SafelistListInstance = void 0; 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"; 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.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.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 = {}; 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.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; } exports.SafelistListInstance = SafelistListInstance; 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; rest/accounts/v1/authTokenPromotion.js000064400000007334151677225100014112 0ustar00"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.AuthTokenPromotionListInstance = exports.AuthTokenPromotionInstance = exports.AuthTokenPromotionContextImpl = void 0; 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 instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", }); operationPromise = operationPromise.then((payload) => new AuthTokenPromotionInstance(operationVersion, payload)); 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); } /** * 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; } exports.AuthTokenPromotionListInstance = AuthTokenPromotionListInstance; rest/accounts/v1/secondaryAuthToken.js000064400000010544151677225100014050 0ustar00"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.SecondaryAuthTokenListInstance = exports.SecondaryAuthTokenInstance = exports.SecondaryAuthTokenContextImpl = void 0; 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 instance = this; let operationVersion = instance._version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", }); operationPromise = operationPromise.then((payload) => new SecondaryAuthTokenInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); 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); } /** * Remove a SecondaryAuthTokenInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(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; } exports.SecondaryAuthTokenListInstance = SecondaryAuthTokenListInstance; rest/accounts/v1/credential.d.ts000064400000001341151677225100012577 0ustar00/// <reference types="node" /> 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; rest/accounts/v1/credential.js000064400000003536151677225100012353 0ustar00"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 = void 0; 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; } exports.CredentialListInstance = CredentialListInstance; rest/accounts/v1/safelist.d.ts000064400000007004151677225100012301 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a SafelistInstance */ export interface SafelistListInstanceCreateOptions { /** The phone number 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 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 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>; /** * 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>; /** * 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>; /** * 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 in SafeList. */ phoneNumber: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; phoneNumber: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/accounts/V1.js000064400000004175151677225100010201 0ustar00"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 credential_1 = require("./v1/credential"); 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 credentials resource */ get credentials() { this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this); return this._credentials; } /** 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; rest/EventsBase.d.ts000064400000000442151677225100010360 0ustar00import Domain from "../base/Domain"; import V1 from "./events/V1"; declare class EventsBase extends Domain { _v1?: V1; /** * Initialize events domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = EventsBase; rest/VerifyBase.js000064400000002040151677225100010120 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V2_1 = __importDefault(require("./verify/V2")); class VerifyBase extends Domain_1.default { /** * Initialize verify domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://verify.twilio.com"); } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = VerifyBase; rest/marketplace/V1.d.ts000064400000002451151677225100011101 0ustar00import MarketplaceBase from "../MarketplaceBase"; import Version from "../../base/Version"; import { AvailableAddOnListInstance } from "./v1/availableAddOn"; import { InstalledAddOnListInstance } from "./v1/installedAddOn"; import { ModuleDataManagementListInstance } from "./v1/moduleDataManagement"; export default class V1 extends Version { /** * Initialize the V1 version of Marketplace * * @param domain - The Twilio (Twilio.Marketplace) domain */ constructor(domain: MarketplaceBase); /** availableAddOns - { Twilio.Marketplace.V1.AvailableAddOnListInstance } resource */ protected _availableAddOns?: AvailableAddOnListInstance; /** installedAddOns - { Twilio.Marketplace.V1.InstalledAddOnListInstance } resource */ protected _installedAddOns?: InstalledAddOnListInstance; /** moduleDataManagement - { Twilio.Marketplace.V1.ModuleDataManagementListInstance } resource */ protected _moduleDataManagement?: ModuleDataManagementListInstance; /** Getter for availableAddOns resource */ get availableAddOns(): AvailableAddOnListInstance; /** Getter for installedAddOns resource */ get installedAddOns(): InstalledAddOnListInstance; /** Getter for moduleDataManagement resource */ get moduleDataManagement(): ModuleDataManagementListInstance; } rest/marketplace/v1/installedAddOn.js000064400000025621151677225100013576 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Marketplace * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InstalledAddOnPage = exports.InstalledAddOnListInstance = exports.InstalledAddOnInstance = exports.InstalledAddOnContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const installedAddOnExtension_1 = require("./installedAddOn/installedAddOnExtension"); const installedAddOnUsage_1 = require("./installedAddOn/installedAddOnUsage"); class InstalledAddOnContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/InstalledAddOns/${sid}`; } get extensions() { this._extensions = this._extensions || (0, installedAddOnExtension_1.InstalledAddOnExtensionListInstance)(this._version, this._solution.sid); return this._extensions; } get usage() { this._usage = this._usage || (0, installedAddOnUsage_1.InstalledAddOnUsageListInstance)(this._version, this._solution.sid); return this._usage; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InstalledAddOnInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["configuration"] !== undefined) data["Configuration"] = serialize.object(params["configuration"]); if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnContextImpl = InstalledAddOnContextImpl; class InstalledAddOnInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.description = payload.description; this.configuration = payload.configuration; this.uniqueName = payload.unique_name; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InstalledAddOnContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the extensions. */ extensions() { return this._proxy.extensions; } /** * Access the usage. */ usage() { return this._proxy.usage; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, description: this.description, configuration: this.configuration, uniqueName: this.uniqueName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnInstance = InstalledAddOnInstance; function InstalledAddOnListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InstalledAddOnContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/InstalledAddOns`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["availableAddOnSid"] === null || params["availableAddOnSid"] === undefined) { throw new Error("Required parameter \"params['availableAddOnSid']\" missing."); } if (params["acceptTermsOfService"] === null || params["acceptTermsOfService"] === undefined) { throw new Error("Required parameter \"params['acceptTermsOfService']\" missing."); } let data = {}; data["AvailableAddOnSid"] = params["availableAddOnSid"]; data["AcceptTermsOfService"] = serialize.bool(params["acceptTermsOfService"]); if (params["configuration"] !== undefined) data["Configuration"] = serialize.object(params["configuration"]); if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new InstalledAddOnPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.InstalledAddOnListInstance = InstalledAddOnListInstance; class InstalledAddOnPage extends Page_1.default { /** * Initialize the InstalledAddOnPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of InstalledAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InstalledAddOnInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnPage = InstalledAddOnPage; rest/marketplace/v1/moduleDataManagement.js000064400000013004151677225100014755 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Marketplace * 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.ModuleDataManagementListInstance = exports.ModuleDataManagementInstance = exports.ModuleDataManagementContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class ModuleDataManagementContextImpl { 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 = `/Listing/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ModuleDataManagementInstance(operationVersion, payload, 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["moduleInfo"] !== undefined) data["ModuleInfo"] = params["moduleInfo"]; if (params["description"] !== undefined) data["Description"] = params["description"]; if (params["documentation"] !== undefined) data["Documentation"] = params["documentation"]; if (params["policies"] !== undefined) data["Policies"] = params["policies"]; if (params["support"] !== undefined) data["Support"] = params["support"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ModuleDataManagementInstance(operationVersion, payload, 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.ModuleDataManagementContextImpl = ModuleDataManagementContextImpl; class ModuleDataManagementInstance { constructor(_version, payload, sid) { this._version = _version; this.url = payload.url; this.sid = payload.sid; this.description = payload.description; this.support = payload.support; this.policies = payload.policies; this.moduleInfo = payload.module_info; this.documentation = payload.documentation; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ModuleDataManagementContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a ModuleDataManagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ModuleDataManagementInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { url: this.url, sid: this.sid, description: this.description, support: this.support, policies: this.policies, moduleInfo: this.moduleInfo, documentation: this.documentation, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ModuleDataManagementInstance = ModuleDataManagementInstance; function ModuleDataManagementListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ModuleDataManagementContextImpl(version, sid); }; 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; } exports.ModuleDataManagementListInstance = ModuleDataManagementListInstance; rest/marketplace/v1/availableAddOn/availableAddOnExtension.js000064400000016443151677225100020264 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Marketplace * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AvailableAddOnExtensionPage = exports.AvailableAddOnExtensionListInstance = exports.AvailableAddOnExtensionInstance = exports.AvailableAddOnExtensionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class AvailableAddOnExtensionContextImpl { constructor(_version, availableAddOnSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(availableAddOnSid)) { throw new Error("Parameter 'availableAddOnSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { availableAddOnSid, sid }; this._uri = `/AvailableAddOns/${availableAddOnSid}/Extensions/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AvailableAddOnExtensionInstance(operationVersion, payload, instance._solution.availableAddOnSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnExtensionContextImpl = AvailableAddOnExtensionContextImpl; class AvailableAddOnExtensionInstance { constructor(_version, payload, availableAddOnSid, sid) { this._version = _version; this.sid = payload.sid; this.availableAddOnSid = payload.available_add_on_sid; this.friendlyName = payload.friendly_name; this.productName = payload.product_name; this.uniqueName = payload.unique_name; this.url = payload.url; this._solution = { availableAddOnSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AvailableAddOnExtensionContextImpl(this._version, this._solution.availableAddOnSid, this._solution.sid); return this._context; } /** * Fetch a AvailableAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnExtensionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, availableAddOnSid: this.availableAddOnSid, friendlyName: this.friendlyName, productName: this.productName, uniqueName: this.uniqueName, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnExtensionInstance = AvailableAddOnExtensionInstance; function AvailableAddOnExtensionListInstance(version, availableAddOnSid) { if (!(0, utility_1.isValidPathParam)(availableAddOnSid)) { throw new Error("Parameter 'availableAddOnSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AvailableAddOnExtensionContextImpl(version, availableAddOnSid, sid); }; instance._version = version; instance._solution = { availableAddOnSid }; instance._uri = `/AvailableAddOns/${availableAddOnSid}/Extensions`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AvailableAddOnExtensionPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new AvailableAddOnExtensionPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.AvailableAddOnExtensionListInstance = AvailableAddOnExtensionListInstance; class AvailableAddOnExtensionPage extends Page_1.default { /** * Initialize the AvailableAddOnExtensionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of AvailableAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AvailableAddOnExtensionInstance(this._version, payload, this._solution.availableAddOnSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnExtensionPage = AvailableAddOnExtensionPage; rest/marketplace/v1/availableAddOn/availableAddOnExtension.d.ts000064400000021646151677225100020521 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to each */ export interface AvailableAddOnExtensionListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface AvailableAddOnExtensionListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AvailableAddOnExtensionListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AvailableAddOnExtensionContext { /** * Fetch a AvailableAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: AvailableAddOnExtensionInstance) => any): Promise<AvailableAddOnExtensionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AvailableAddOnExtensionContextSolution { availableAddOnSid: string; sid: string; } export declare class AvailableAddOnExtensionContextImpl implements AvailableAddOnExtensionContext { protected _version: V1; protected _solution: AvailableAddOnExtensionContextSolution; protected _uri: string; constructor(_version: V1, availableAddOnSid: string, sid: string); fetch(callback?: (error: Error | null, item?: AvailableAddOnExtensionInstance) => any): Promise<AvailableAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AvailableAddOnExtensionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AvailableAddOnExtensionPayload extends TwilioResponsePayload { extensions: AvailableAddOnExtensionResource[]; } interface AvailableAddOnExtensionResource { sid: string; available_add_on_sid: string; friendly_name: string; product_name: string; unique_name: string; url: string; } export declare class AvailableAddOnExtensionInstance { protected _version: V1; protected _solution: AvailableAddOnExtensionContextSolution; protected _context?: AvailableAddOnExtensionContext; constructor(_version: V1, payload: AvailableAddOnExtensionResource, availableAddOnSid: string, sid?: string); /** * The unique string that we created to identify the AvailableAddOnExtension resource. */ sid: string; /** * The SID of the AvailableAddOn resource to which this extension applies. */ availableAddOnSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The name of the Product this Extension is used within. */ productName: string; /** * An application-defined string that uniquely identifies the resource. */ uniqueName: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a AvailableAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: AvailableAddOnExtensionInstance) => any): Promise<AvailableAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; availableAddOnSid: string; friendlyName: string; productName: string; uniqueName: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AvailableAddOnExtensionSolution { availableAddOnSid: string; } export interface AvailableAddOnExtensionListInstance { _version: V1; _solution: AvailableAddOnExtensionSolution; _uri: string; (sid: string): AvailableAddOnExtensionContext; get(sid: string): AvailableAddOnExtensionContext; /** * Streams AvailableAddOnExtensionInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnExtensionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void): void; each(params: AvailableAddOnExtensionListInstanceEachOptions, callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AvailableAddOnExtensionInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: AvailableAddOnExtensionPage) => any): Promise<AvailableAddOnExtensionPage>; /** * Lists AvailableAddOnExtensionInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnExtensionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AvailableAddOnExtensionInstance[]) => any): Promise<AvailableAddOnExtensionInstance[]>; list(params: AvailableAddOnExtensionListInstanceOptions, callback?: (error: Error | null, items: AvailableAddOnExtensionInstance[]) => any): Promise<AvailableAddOnExtensionInstance[]>; /** * Retrieve a single page of AvailableAddOnExtensionInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnExtensionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AvailableAddOnExtensionPage) => any): Promise<AvailableAddOnExtensionPage>; page(params: AvailableAddOnExtensionListInstancePageOptions, callback?: (error: Error | null, items: AvailableAddOnExtensionPage) => any): Promise<AvailableAddOnExtensionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AvailableAddOnExtensionListInstance(version: V1, availableAddOnSid: string): AvailableAddOnExtensionListInstance; export declare class AvailableAddOnExtensionPage extends Page<V1, AvailableAddOnExtensionPayload, AvailableAddOnExtensionResource, AvailableAddOnExtensionInstance> { /** * Initialize the AvailableAddOnExtensionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AvailableAddOnExtensionSolution); /** * Build an instance of AvailableAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload: AvailableAddOnExtensionResource): AvailableAddOnExtensionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/marketplace/v1/installedAddOn/installedAddOnUsage.js000064400000007222151677225100017445 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Marketplace * 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.InstalledAddOnUsageInstance = exports.InstalledAddOnUsageListInstance = exports.MarketplaceInstalledAddOnBillingUsageResponseBillableItems = exports.CreateMarketplaceBillingUsageRequestBillableItems = exports.CreateMarketplaceBillingUsageRequest = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class CreateMarketplaceBillingUsageRequest { } exports.CreateMarketplaceBillingUsageRequest = CreateMarketplaceBillingUsageRequest; class CreateMarketplaceBillingUsageRequestBillableItems { } exports.CreateMarketplaceBillingUsageRequestBillableItems = CreateMarketplaceBillingUsageRequestBillableItems; class MarketplaceInstalledAddOnBillingUsageResponseBillableItems { } exports.MarketplaceInstalledAddOnBillingUsageResponseBillableItems = MarketplaceInstalledAddOnBillingUsageResponseBillableItems; function InstalledAddOnUsageListInstance(version, installedAddOnSid) { if (!(0, utility_1.isValidPathParam)(installedAddOnSid)) { throw new Error("Parameter 'installedAddOnSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { installedAddOnSid }; instance._uri = `/InstalledAddOns/${installedAddOnSid}/Usage`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnUsageInstance(operationVersion, payload, instance._solution.installedAddOnSid)); 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; } exports.InstalledAddOnUsageListInstance = InstalledAddOnUsageListInstance; class InstalledAddOnUsageInstance { constructor(_version, payload, installedAddOnSid) { this._version = _version; this.billableItems = payload.billable_items; this.totalSubmitted = payload.total_submitted; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { billableItems: this.billableItems, totalSubmitted: this.totalSubmitted, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnUsageInstance = InstalledAddOnUsageInstance; rest/marketplace/v1/installedAddOn/installedAddOnUsage.d.ts000064400000005140151677225100017676 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export declare class CreateMarketplaceBillingUsageRequest { "billableItems"?: Array<CreateMarketplaceBillingUsageRequestBillableItems>; } export declare class CreateMarketplaceBillingUsageRequestBillableItems { /** * */ "quantity": number; /** * */ "sid": string; } export declare class MarketplaceInstalledAddOnBillingUsageResponseBillableItems { /** * */ "quantity"?: number; /** * */ "sid"?: string; /** * Whether this billable item was successfully submitted for billing. */ "submitted"?: boolean; } /** * Options to pass to create a InstalledAddOnUsageInstance */ export interface InstalledAddOnUsageListInstanceCreateOptions { /** */ createMarketplaceBillingUsageRequest: CreateMarketplaceBillingUsageRequest; } export interface InstalledAddOnUsageSolution { installedAddOnSid: string; } export interface InstalledAddOnUsageListInstance { _version: V1; _solution: InstalledAddOnUsageSolution; _uri: string; /** * Create a InstalledAddOnUsageInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnUsageInstance */ create(params: CreateMarketplaceBillingUsageRequest, callback?: (error: Error | null, item?: InstalledAddOnUsageInstance) => any): Promise<InstalledAddOnUsageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InstalledAddOnUsageListInstance(version: V1, installedAddOnSid: string): InstalledAddOnUsageListInstance; interface InstalledAddOnUsageResource { billable_items: Array<MarketplaceInstalledAddOnBillingUsageResponseBillableItems>; total_submitted: number; } export declare class InstalledAddOnUsageInstance { protected _version: V1; constructor(_version: V1, payload: InstalledAddOnUsageResource, installedAddOnSid: string); billableItems: Array<MarketplaceInstalledAddOnBillingUsageResponseBillableItems>; /** * Represents the total quantity submitted. */ totalSubmitted: number; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { billableItems: MarketplaceInstalledAddOnBillingUsageResponseBillableItems[]; totalSubmitted: number; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/marketplace/v1/installedAddOn/installedAddOnExtension.js000064400000020773151677225100020363 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Marketplace * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InstalledAddOnExtensionPage = exports.InstalledAddOnExtensionListInstance = exports.InstalledAddOnExtensionInstance = exports.InstalledAddOnExtensionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class InstalledAddOnExtensionContextImpl { constructor(_version, installedAddOnSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(installedAddOnSid)) { throw new Error("Parameter 'installedAddOnSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { installedAddOnSid, sid }; this._uri = `/InstalledAddOns/${installedAddOnSid}/Extensions/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InstalledAddOnExtensionInstance(operationVersion, payload, instance._solution.installedAddOnSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["enabled"] === null || params["enabled"] === undefined) { throw new Error("Required parameter \"params['enabled']\" missing."); } let data = {}; data["Enabled"] = serialize.bool(params["enabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnExtensionInstance(operationVersion, payload, instance._solution.installedAddOnSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnExtensionContextImpl = InstalledAddOnExtensionContextImpl; class InstalledAddOnExtensionInstance { constructor(_version, payload, installedAddOnSid, sid) { this._version = _version; this.sid = payload.sid; this.installedAddOnSid = payload.installed_add_on_sid; this.friendlyName = payload.friendly_name; this.productName = payload.product_name; this.uniqueName = payload.unique_name; this.enabled = payload.enabled; this.url = payload.url; this._solution = { installedAddOnSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InstalledAddOnExtensionContextImpl(this._version, this._solution.installedAddOnSid, this._solution.sid); return this._context; } /** * Fetch a InstalledAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, installedAddOnSid: this.installedAddOnSid, friendlyName: this.friendlyName, productName: this.productName, uniqueName: this.uniqueName, enabled: this.enabled, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnExtensionInstance = InstalledAddOnExtensionInstance; function InstalledAddOnExtensionListInstance(version, installedAddOnSid) { if (!(0, utility_1.isValidPathParam)(installedAddOnSid)) { throw new Error("Parameter 'installedAddOnSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InstalledAddOnExtensionContextImpl(version, installedAddOnSid, sid); }; instance._version = version; instance._solution = { installedAddOnSid }; instance._uri = `/InstalledAddOns/${installedAddOnSid}/Extensions`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnExtensionPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new InstalledAddOnExtensionPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.InstalledAddOnExtensionListInstance = InstalledAddOnExtensionListInstance; class InstalledAddOnExtensionPage extends Page_1.default { /** * Initialize the InstalledAddOnExtensionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of InstalledAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InstalledAddOnExtensionInstance(this._version, payload, this._solution.installedAddOnSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnExtensionPage = InstalledAddOnExtensionPage; rest/marketplace/v1/installedAddOn/installedAddOnExtension.d.ts000064400000024455151677225100020620 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to update a InstalledAddOnExtensionInstance */ export interface InstalledAddOnExtensionContextUpdateOptions { /** Whether the Extension should be invoked. */ enabled: boolean; } /** * Options to pass to each */ export interface InstalledAddOnExtensionListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface InstalledAddOnExtensionListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InstalledAddOnExtensionListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InstalledAddOnExtensionContext { /** * Fetch a InstalledAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Update a InstalledAddOnExtensionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ update(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InstalledAddOnExtensionContextSolution { installedAddOnSid: string; sid: string; } export declare class InstalledAddOnExtensionContextImpl implements InstalledAddOnExtensionContext { protected _version: V1; protected _solution: InstalledAddOnExtensionContextSolution; protected _uri: string; constructor(_version: V1, installedAddOnSid: string, sid: string); fetch(callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; update(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InstalledAddOnExtensionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InstalledAddOnExtensionPayload extends TwilioResponsePayload { extensions: InstalledAddOnExtensionResource[]; } interface InstalledAddOnExtensionResource { sid: string; installed_add_on_sid: string; friendly_name: string; product_name: string; unique_name: string; enabled: boolean; url: string; } export declare class InstalledAddOnExtensionInstance { protected _version: V1; protected _solution: InstalledAddOnExtensionContextSolution; protected _context?: InstalledAddOnExtensionContext; constructor(_version: V1, payload: InstalledAddOnExtensionResource, installedAddOnSid: string, sid?: string); /** * The unique string that we created to identify the InstalledAddOn Extension resource. */ sid: string; /** * The SID of the InstalledAddOn resource to which this extension applies. */ installedAddOnSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The name of the Product this Extension is used within. */ productName: string; /** * An application-defined string that uniquely identifies the resource. */ uniqueName: string; /** * Whether the Extension will be invoked. */ enabled: boolean; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a InstalledAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Update a InstalledAddOnExtensionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ update(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; installedAddOnSid: string; friendlyName: string; productName: string; uniqueName: string; enabled: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InstalledAddOnExtensionSolution { installedAddOnSid: string; } export interface InstalledAddOnExtensionListInstance { _version: V1; _solution: InstalledAddOnExtensionSolution; _uri: string; (sid: string): InstalledAddOnExtensionContext; get(sid: string): InstalledAddOnExtensionContext; /** * Streams InstalledAddOnExtensionInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnExtensionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void): void; each(params: InstalledAddOnExtensionListInstanceEachOptions, callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InstalledAddOnExtensionInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: InstalledAddOnExtensionPage) => any): Promise<InstalledAddOnExtensionPage>; /** * Lists InstalledAddOnExtensionInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnExtensionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InstalledAddOnExtensionInstance[]) => any): Promise<InstalledAddOnExtensionInstance[]>; list(params: InstalledAddOnExtensionListInstanceOptions, callback?: (error: Error | null, items: InstalledAddOnExtensionInstance[]) => any): Promise<InstalledAddOnExtensionInstance[]>; /** * Retrieve a single page of InstalledAddOnExtensionInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnExtensionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InstalledAddOnExtensionPage) => any): Promise<InstalledAddOnExtensionPage>; page(params: InstalledAddOnExtensionListInstancePageOptions, callback?: (error: Error | null, items: InstalledAddOnExtensionPage) => any): Promise<InstalledAddOnExtensionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InstalledAddOnExtensionListInstance(version: V1, installedAddOnSid: string): InstalledAddOnExtensionListInstance; export declare class InstalledAddOnExtensionPage extends Page<V1, InstalledAddOnExtensionPayload, InstalledAddOnExtensionResource, InstalledAddOnExtensionInstance> { /** * Initialize the InstalledAddOnExtensionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InstalledAddOnExtensionSolution); /** * Build an instance of InstalledAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload: InstalledAddOnExtensionResource): InstalledAddOnExtensionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/marketplace/v1/moduleDataManagement.d.ts000064400000012162151677225100015215 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to update a ModuleDataManagementInstance */ export interface ModuleDataManagementContextUpdateOptions { /** */ moduleInfo?: string; /** */ description?: string; /** */ documentation?: string; /** */ policies?: string; /** */ support?: string; } export interface ModuleDataManagementContext { /** * Fetch a ModuleDataManagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ModuleDataManagementInstance */ fetch(callback?: (error: Error | null, item?: ModuleDataManagementInstance) => any): Promise<ModuleDataManagementInstance>; /** * Update a ModuleDataManagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ModuleDataManagementInstance */ update(callback?: (error: Error | null, item?: ModuleDataManagementInstance) => any): Promise<ModuleDataManagementInstance>; /** * Update a ModuleDataManagementInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ModuleDataManagementInstance */ update(params: ModuleDataManagementContextUpdateOptions, callback?: (error: Error | null, item?: ModuleDataManagementInstance) => any): Promise<ModuleDataManagementInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ModuleDataManagementContextSolution { sid: string; } export declare class ModuleDataManagementContextImpl implements ModuleDataManagementContext { protected _version: V1; protected _solution: ModuleDataManagementContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: ModuleDataManagementInstance) => any): Promise<ModuleDataManagementInstance>; update(params?: ModuleDataManagementContextUpdateOptions | ((error: Error | null, item?: ModuleDataManagementInstance) => any), callback?: (error: Error | null, item?: ModuleDataManagementInstance) => any): Promise<ModuleDataManagementInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ModuleDataManagementContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ModuleDataManagementResource { url: string; sid: string; description: any; support: any; policies: any; module_info: any; documentation: any; } export declare class ModuleDataManagementInstance { protected _version: V1; protected _solution: ModuleDataManagementContextSolution; protected _context?: ModuleDataManagementContext; constructor(_version: V1, payload: ModuleDataManagementResource, sid?: string); url: string; sid: string; description: any; support: any; policies: any; moduleInfo: any; documentation: any; private get _proxy(); /** * Fetch a ModuleDataManagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ModuleDataManagementInstance */ fetch(callback?: (error: Error | null, item?: ModuleDataManagementInstance) => any): Promise<ModuleDataManagementInstance>; /** * Update a ModuleDataManagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ModuleDataManagementInstance */ update(callback?: (error: Error | null, item?: ModuleDataManagementInstance) => any): Promise<ModuleDataManagementInstance>; /** * Update a ModuleDataManagementInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ModuleDataManagementInstance */ update(params: ModuleDataManagementContextUpdateOptions, callback?: (error: Error | null, item?: ModuleDataManagementInstance) => any): Promise<ModuleDataManagementInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { url: string; sid: string; description: any; support: any; policies: any; moduleInfo: any; documentation: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ModuleDataManagementSolution { } export interface ModuleDataManagementListInstance { _version: V1; _solution: ModuleDataManagementSolution; _uri: string; (sid: string): ModuleDataManagementContext; get(sid: string): ModuleDataManagementContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ModuleDataManagementListInstance(version: V1): ModuleDataManagementListInstance; export {}; rest/marketplace/v1/availableAddOn.js000064400000015731151677225100013540 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Marketplace * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AvailableAddOnPage = exports.AvailableAddOnListInstance = exports.AvailableAddOnInstance = exports.AvailableAddOnContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const availableAddOnExtension_1 = require("./availableAddOn/availableAddOnExtension"); class AvailableAddOnContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/AvailableAddOns/${sid}`; } get extensions() { this._extensions = this._extensions || (0, availableAddOnExtension_1.AvailableAddOnExtensionListInstance)(this._version, this._solution.sid); return this._extensions; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AvailableAddOnInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnContextImpl = AvailableAddOnContextImpl; class AvailableAddOnInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.description = payload.description; this.pricingType = payload.pricing_type; this.configurationSchema = payload.configuration_schema; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AvailableAddOnContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a AvailableAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the extensions. */ extensions() { return this._proxy.extensions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, description: this.description, pricingType: this.pricingType, configurationSchema: this.configurationSchema, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnInstance = AvailableAddOnInstance; function AvailableAddOnListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AvailableAddOnContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/AvailableAddOns`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AvailableAddOnPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new AvailableAddOnPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.AvailableAddOnListInstance = AvailableAddOnListInstance; class AvailableAddOnPage extends Page_1.default { /** * Initialize the AvailableAddOnPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of AvailableAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AvailableAddOnInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnPage = AvailableAddOnPage; rest/marketplace/v1/installedAddOn.d.ts000064400000032575151677225100014040 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { InstalledAddOnExtensionListInstance } from "./installedAddOn/installedAddOnExtension"; import { InstalledAddOnUsageListInstance } from "./installedAddOn/installedAddOnUsage"; /** * Options to pass to update a InstalledAddOnInstance */ export interface InstalledAddOnContextUpdateOptions { /** Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured */ configuration?: any; /** An application-defined string that uniquely identifies the resource. This value must be unique within the Account. */ uniqueName?: string; } /** * Options to pass to create a InstalledAddOnInstance */ export interface InstalledAddOnListInstanceCreateOptions { /** The SID of the AvaliableAddOn to install. */ availableAddOnSid: string; /** Whether the Terms of Service were accepted. */ acceptTermsOfService: boolean; /** The JSON object that represents the configuration of the new Add-on being installed. */ configuration?: any; /** An application-defined string that uniquely identifies the resource. This value must be unique within the Account. */ uniqueName?: string; } /** * Options to pass to each */ export interface InstalledAddOnListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface InstalledAddOnListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InstalledAddOnListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InstalledAddOnContext { extensions: InstalledAddOnExtensionListInstance; usage: InstalledAddOnUsageListInstance; /** * Remove a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ fetch(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Update a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ update(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Update a InstalledAddOnInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ update(params: InstalledAddOnContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InstalledAddOnContextSolution { sid: string; } export declare class InstalledAddOnContextImpl implements InstalledAddOnContext { protected _version: V1; protected _solution: InstalledAddOnContextSolution; protected _uri: string; protected _extensions?: InstalledAddOnExtensionListInstance; protected _usage?: InstalledAddOnUsageListInstance; constructor(_version: V1, sid: string); get extensions(): InstalledAddOnExtensionListInstance; get usage(): InstalledAddOnUsageListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; update(params?: InstalledAddOnContextUpdateOptions | ((error: Error | null, item?: InstalledAddOnInstance) => any), callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InstalledAddOnContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InstalledAddOnPayload extends TwilioResponsePayload { installed_add_ons: InstalledAddOnResource[]; } interface InstalledAddOnResource { sid: string; account_sid: string; friendly_name: string; description: string; configuration: any; unique_name: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class InstalledAddOnInstance { protected _version: V1; protected _solution: InstalledAddOnContextSolution; protected _context?: InstalledAddOnContext; constructor(_version: V1, payload: InstalledAddOnResource, sid?: string); /** * The unique string that we created to identify the InstalledAddOn resource. This Sid can also be found in the Console on that specific Add-ons page as the \'Available Add-on Sid\'. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the InstalledAddOn resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * A short description of the Add-on\'s functionality. */ description: string; /** * The JSON object that represents the current configuration of installed Add-on. */ configuration: any; /** * An application-defined string that uniquely identifies the resource. */ uniqueName: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ fetch(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Update a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ update(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Update a InstalledAddOnInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ update(params: InstalledAddOnContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Access the extensions. */ extensions(): InstalledAddOnExtensionListInstance; /** * Access the usage. */ usage(): InstalledAddOnUsageListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; description: string; configuration: any; uniqueName: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InstalledAddOnSolution { } export interface InstalledAddOnListInstance { _version: V1; _solution: InstalledAddOnSolution; _uri: string; (sid: string): InstalledAddOnContext; get(sid: string): InstalledAddOnContext; /** * Create a InstalledAddOnInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ create(params: InstalledAddOnListInstanceCreateOptions, callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Streams InstalledAddOnInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void): void; each(params: InstalledAddOnListInstanceEachOptions, callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InstalledAddOnInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: InstalledAddOnPage) => any): Promise<InstalledAddOnPage>; /** * Lists InstalledAddOnInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InstalledAddOnInstance[]) => any): Promise<InstalledAddOnInstance[]>; list(params: InstalledAddOnListInstanceOptions, callback?: (error: Error | null, items: InstalledAddOnInstance[]) => any): Promise<InstalledAddOnInstance[]>; /** * Retrieve a single page of InstalledAddOnInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InstalledAddOnPage) => any): Promise<InstalledAddOnPage>; page(params: InstalledAddOnListInstancePageOptions, callback?: (error: Error | null, items: InstalledAddOnPage) => any): Promise<InstalledAddOnPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InstalledAddOnListInstance(version: V1): InstalledAddOnListInstance; export declare class InstalledAddOnPage extends Page<V1, InstalledAddOnPayload, InstalledAddOnResource, InstalledAddOnInstance> { /** * Initialize the InstalledAddOnPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InstalledAddOnSolution); /** * Build an instance of InstalledAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload: InstalledAddOnResource): InstalledAddOnInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/marketplace/v1/availableAddOn.d.ts000064400000021327151677225100013772 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { AvailableAddOnExtensionListInstance } from "./availableAddOn/availableAddOnExtension"; /** * Options to pass to each */ export interface AvailableAddOnListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface AvailableAddOnListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AvailableAddOnListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AvailableAddOnContext { extensions: AvailableAddOnExtensionListInstance; /** * Fetch a AvailableAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnInstance */ fetch(callback?: (error: Error | null, item?: AvailableAddOnInstance) => any): Promise<AvailableAddOnInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AvailableAddOnContextSolution { sid: string; } export declare class AvailableAddOnContextImpl implements AvailableAddOnContext { protected _version: V1; protected _solution: AvailableAddOnContextSolution; protected _uri: string; protected _extensions?: AvailableAddOnExtensionListInstance; constructor(_version: V1, sid: string); get extensions(): AvailableAddOnExtensionListInstance; fetch(callback?: (error: Error | null, item?: AvailableAddOnInstance) => any): Promise<AvailableAddOnInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AvailableAddOnContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AvailableAddOnPayload extends TwilioResponsePayload { available_add_ons: AvailableAddOnResource[]; } interface AvailableAddOnResource { sid: string; friendly_name: string; description: string; pricing_type: string; configuration_schema: any; url: string; links: Record<string, string>; } export declare class AvailableAddOnInstance { protected _version: V1; protected _solution: AvailableAddOnContextSolution; protected _context?: AvailableAddOnContext; constructor(_version: V1, payload: AvailableAddOnResource, sid?: string); /** * The unique string that we created to identify the AvailableAddOn resource. */ sid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * A short description of the Add-on\'s functionality. */ description: string; /** * How customers are charged for using this Add-on. */ pricingType: string; /** * The JSON object with the configuration that must be provided when installing a given Add-on. */ configurationSchema: any; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a AvailableAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnInstance */ fetch(callback?: (error: Error | null, item?: AvailableAddOnInstance) => any): Promise<AvailableAddOnInstance>; /** * Access the extensions. */ extensions(): AvailableAddOnExtensionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; description: string; pricingType: string; configurationSchema: any; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AvailableAddOnSolution { } export interface AvailableAddOnListInstance { _version: V1; _solution: AvailableAddOnSolution; _uri: string; (sid: string): AvailableAddOnContext; get(sid: string): AvailableAddOnContext; /** * Streams AvailableAddOnInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void): void; each(params: AvailableAddOnListInstanceEachOptions, callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AvailableAddOnInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: AvailableAddOnPage) => any): Promise<AvailableAddOnPage>; /** * Lists AvailableAddOnInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AvailableAddOnInstance[]) => any): Promise<AvailableAddOnInstance[]>; list(params: AvailableAddOnListInstanceOptions, callback?: (error: Error | null, items: AvailableAddOnInstance[]) => any): Promise<AvailableAddOnInstance[]>; /** * Retrieve a single page of AvailableAddOnInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AvailableAddOnPage) => any): Promise<AvailableAddOnPage>; page(params: AvailableAddOnListInstancePageOptions, callback?: (error: Error | null, items: AvailableAddOnPage) => any): Promise<AvailableAddOnPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AvailableAddOnListInstance(version: V1): AvailableAddOnListInstance; export declare class AvailableAddOnPage extends Page<V1, AvailableAddOnPayload, AvailableAddOnResource, AvailableAddOnInstance> { /** * Initialize the AvailableAddOnPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AvailableAddOnSolution); /** * Build an instance of AvailableAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload: AvailableAddOnResource): AvailableAddOnInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/marketplace/V1.js000064400000003703151677225100010646 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Marketplace * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const availableAddOn_1 = require("./v1/availableAddOn"); const installedAddOn_1 = require("./v1/installedAddOn"); const moduleDataManagement_1 = require("./v1/moduleDataManagement"); class V1 extends Version_1.default { /** * Initialize the V1 version of Marketplace * * @param domain - The Twilio (Twilio.Marketplace) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for availableAddOns resource */ get availableAddOns() { this._availableAddOns = this._availableAddOns || (0, availableAddOn_1.AvailableAddOnListInstance)(this); return this._availableAddOns; } /** Getter for installedAddOns resource */ get installedAddOns() { this._installedAddOns = this._installedAddOns || (0, installedAddOn_1.InstalledAddOnListInstance)(this); return this._installedAddOns; } /** Getter for moduleDataManagement resource */ get moduleDataManagement() { this._moduleDataManagement = this._moduleDataManagement || (0, moduleDataManagement_1.ModuleDataManagementListInstance)(this); return this._moduleDataManagement; } } exports.default = V1; rest/Conversations.d.ts000064400000003176151677225100011165 0ustar00import { AddressConfigurationListInstance } from "./conversations/v1/addressConfiguration"; import { ConfigurationListInstance } from "./conversations/v1/configuration"; import { ConversationListInstance } from "./conversations/v1/conversation"; import { CredentialListInstance } from "./conversations/v1/credential"; import { ParticipantConversationListInstance } from "./conversations/v1/participantConversation"; import { RoleListInstance } from "./conversations/v1/role"; import { ServiceListInstance } from "./conversations/v1/service"; import { UserListInstance } from "./conversations/v1/user"; import ConversationsBase from "./ConversationsBase"; declare class Conversations extends ConversationsBase { /** * @deprecated - Use v1.configuration instead */ get configuration(): ConfigurationListInstance; /** * @deprecated - Use v1.addressConfigurations instead */ get addressConfigurations(): AddressConfigurationListInstance; /** * @deprecated - Use v1.conversations instead */ get conversations(): ConversationListInstance; /** * @deprecated - Use v1.credentials instead */ get credentials(): CredentialListInstance; /** * @deprecated - Use v1.participantConversations instead */ get participantConversations(): ParticipantConversationListInstance; /** * @deprecated - Use v1.roles instead */ get roles(): RoleListInstance; /** * @deprecated - Use v1.services instead */ get services(): ServiceListInstance; /** * @deprecated - Use v1.users instead */ get users(): UserListInstance; } export = Conversations; rest/pricing/V2.d.ts000064400000001777151677225100010257 0ustar00import PricingBase from "../PricingBase"; import Version from "../../base/Version"; import { CountryListInstance } from "./v2/country"; import { NumberListInstance } from "./v2/number"; import { VoiceListInstance } from "./v2/voice"; export default class V2 extends Version { /** * Initialize the V2 version of Pricing * * @param domain - The Twilio (Twilio.Pricing) domain */ constructor(domain: PricingBase); /** countries - { Twilio.Pricing.V2.CountryListInstance } resource */ protected _countries?: CountryListInstance; /** numbers - { Twilio.Pricing.V2.NumberListInstance } resource */ protected _numbers?: NumberListInstance; /** voice - { Twilio.Pricing.V2.VoiceListInstance } resource */ protected _voice?: VoiceListInstance; /** Getter for countries resource */ get countries(): CountryListInstance; /** Getter for numbers resource */ get numbers(): NumberListInstance; /** Getter for voice resource */ get voice(): VoiceListInstance; } rest/pricing/V1.d.ts000064400000002066151677225100010246 0ustar00import PricingBase from "../PricingBase"; import Version from "../../base/Version"; import { MessagingListInstance } from "./v1/messaging"; import { PhoneNumberListInstance } from "./v1/phoneNumber"; import { VoiceListInstance } from "./v1/voice"; export default class V1 extends Version { /** * Initialize the V1 version of Pricing * * @param domain - The Twilio (Twilio.Pricing) domain */ constructor(domain: PricingBase); /** messaging - { Twilio.Pricing.V1.MessagingListInstance } resource */ protected _messaging?: MessagingListInstance; /** phoneNumbers - { Twilio.Pricing.V1.PhoneNumberListInstance } resource */ protected _phoneNumbers?: PhoneNumberListInstance; /** voice - { Twilio.Pricing.V1.VoiceListInstance } resource */ protected _voice?: VoiceListInstance; /** Getter for messaging resource */ get messaging(): MessagingListInstance; /** Getter for phoneNumbers resource */ get phoneNumbers(): PhoneNumberListInstance; /** Getter for voice resource */ get voice(): VoiceListInstance; } rest/pricing/V2.js000064400000003212151677225100010005 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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 country_1 = require("./v2/country"); const number_1 = require("./v2/number"); const voice_1 = require("./v2/voice"); class V2 extends Version_1.default { /** * Initialize the V2 version of Pricing * * @param domain - The Twilio (Twilio.Pricing) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for countries resource */ get countries() { this._countries = this._countries || (0, country_1.CountryListInstance)(this); return this._countries; } /** Getter for numbers resource */ get numbers() { this._numbers = this._numbers || (0, number_1.NumberListInstance)(this); return this._numbers; } /** Getter for voice resource */ get voice() { this._voice = this._voice || (0, voice_1.VoiceListInstance)(this); return this._voice; } } exports.default = V2; rest/pricing/v2/voice/country.d.ts000064400000021300151677225100013107 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export declare class PricingV2TrunkingCountryInstanceOriginatingCallPrices { "basePrice"?: number; "currentPrice"?: number; "numberType"?: string; } export declare class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices { "originationPrefixes"?: Array<string>; "destinationPrefixes"?: Array<string>; "basePrice"?: number; "currentPrice"?: number; "friendlyName"?: string; } /** * Options to pass to each */ export interface CountryListInstanceEachOptions { /** 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: CountryInstance, 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 CountryListInstanceOptions { /** 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 CountryListInstancePageOptions { /** 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 CountryContext { /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CountryContextSolution { isoCountry: string; } export declare class CountryContextImpl implements CountryContext { protected _version: V2; protected _solution: CountryContextSolution; protected _uri: string; constructor(_version: V2, isoCountry: string); fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CountryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CountryPayload extends TwilioResponsePayload { countries: CountryResource[]; } interface CountryResource { country: string; iso_country: string; outbound_prefix_prices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>; inbound_call_prices: Array<PricingV2TrunkingCountryInstanceOriginatingCallPrices>; price_unit: string; url: string; } export declare class CountryInstance { protected _version: V2; protected _solution: CountryContextSolution; protected _context?: CountryContext; constructor(_version: V2, payload: CountryResource, isoCountry?: string); /** * The name of the country. */ country: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). */ isoCountry: string; /** * The list of [OutboundPrefixPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. */ outboundPrefixPrices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>; /** * The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. */ inboundCallPrices: Array<PricingV2TrunkingCountryInstanceOriginatingCallPrices>; /** * The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { country: string; isoCountry: string; outboundPrefixPrices: PricingV2TrunkingCountryInstanceTerminatingPrefixPrices[]; inboundCallPrices: PricingV2TrunkingCountryInstanceOriginatingCallPrices[]; priceUnit: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CountrySolution { } export interface CountryListInstance { _version: V2; _solution: CountrySolution; _uri: string; (isoCountry: string): CountryContext; get(isoCountry: string): CountryContext; /** * Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>; /** * Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; /** * Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CountryListInstance(version: V2): CountryListInstance; export declare class CountryPage extends Page<V2, CountryPayload, CountryResource, CountryInstance> { /** * Initialize the CountryPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: CountrySolution); /** * Build an instance of CountryInstance * * @param payload - Payload response from the API */ getInstance(payload: CountryResource): CountryInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/pricing/v2/voice/number.d.ts000064400000013266151677225100012710 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../V2"; /** * The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. */ export declare class PricingV2VoiceVoiceNumberInboundCallPrice { "basePrice"?: number; "currentPrice"?: number; "numberType"?: string; } export declare class PricingV2VoiceVoiceNumberOutboundCallPrices { "basePrice"?: number; "currentPrice"?: number; "originationPrefixes"?: Array<string>; } /** * Options to pass to fetch a NumberInstance */ export interface NumberContextFetchOptions { /** The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. */ originationNumber?: string; } export interface NumberContext { /** * Fetch a NumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Fetch a NumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface NumberContextSolution { destinationNumber: string; } export declare class NumberContextImpl implements NumberContext { protected _version: V2; protected _solution: NumberContextSolution; protected _uri: string; constructor(_version: V2, destinationNumber: string); fetch(params?: NumberContextFetchOptions | ((error: Error | null, item?: NumberInstance) => any), callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): NumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface NumberResource { destination_number: string; origination_number: string; country: string; iso_country: string; outbound_call_prices: Array<PricingV2VoiceVoiceNumberOutboundCallPrices>; inbound_call_price: PricingV2VoiceVoiceNumberInboundCallPrice; price_unit: string; url: string; } export declare class NumberInstance { protected _version: V2; protected _solution: NumberContextSolution; protected _context?: NumberContext; constructor(_version: V2, payload: NumberResource, destinationNumber?: string); /** * The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ destinationNumber: string; /** * The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ originationNumber: string; /** * The name of the country. */ country: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) */ isoCountry: string; /** * The list of [OutboundCallPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-call-price-with-origin) records. */ outboundCallPrices: Array<PricingV2VoiceVoiceNumberOutboundCallPrices>; inboundCallPrice: PricingV2VoiceVoiceNumberInboundCallPrice; /** * The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a NumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Fetch a NumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { destinationNumber: string; originationNumber: string; country: string; isoCountry: string; outboundCallPrices: PricingV2VoiceVoiceNumberOutboundCallPrices[]; inboundCallPrice: PricingV2VoiceVoiceNumberInboundCallPrice; priceUnit: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface NumberSolution { } export interface NumberListInstance { _version: V2; _solution: NumberSolution; _uri: string; (destinationNumber: string): NumberContext; get(destinationNumber: string): NumberContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NumberListInstance(version: V2): NumberListInstance; export {}; rest/pricing/v2/voice/country.js000064400000015661151677225100012670 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.CountryPage = exports.CountryListInstance = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = exports.PricingV2TrunkingCountryInstanceOriginatingCallPrices = void 0; 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 PricingV2TrunkingCountryInstanceOriginatingCallPrices { } exports.PricingV2TrunkingCountryInstanceOriginatingCallPrices = PricingV2TrunkingCountryInstanceOriginatingCallPrices; class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices { } exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = PricingV2TrunkingCountryInstanceTerminatingPrefixPrices; class CountryContextImpl { constructor(_version, isoCountry) { this._version = _version; if (!(0, utility_1.isValidPathParam)(isoCountry)) { throw new Error("Parameter 'isoCountry' is not valid."); } this._solution = { isoCountry }; this._uri = `/Voice/Countries/${isoCountry}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CountryInstance(operationVersion, payload, instance._solution.isoCountry)); 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.CountryContextImpl = CountryContextImpl; class CountryInstance { constructor(_version, payload, isoCountry) { this._version = _version; this.country = payload.country; this.isoCountry = payload.iso_country; this.outboundPrefixPrices = payload.outbound_prefix_prices; this.inboundCallPrices = payload.inbound_call_prices; this.priceUnit = payload.price_unit; this.url = payload.url; this._solution = { isoCountry: isoCountry || this.isoCountry }; } get _proxy() { this._context = this._context || new CountryContextImpl(this._version, this._solution.isoCountry); return this._context; } /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { country: this.country, isoCountry: this.isoCountry, outboundPrefixPrices: this.outboundPrefixPrices, inboundCallPrices: this.inboundCallPrices, priceUnit: this.priceUnit, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryInstance = CountryInstance; function CountryListInstance(version) { const instance = ((isoCountry) => instance.get(isoCountry)); instance.get = function get(isoCountry) { return new CountryContextImpl(version, isoCountry); }; instance._version = version; instance._solution = {}; instance._uri = `/Voice/Countries`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CountryPage(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 CountryPage(instance._version, payload, 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; } exports.CountryListInstance = CountryListInstance; class CountryPage extends Page_1.default { /** * Initialize the CountryPage * * @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 CountryInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CountryInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryPage = CountryPage; rest/pricing/v2/voice/number.js000064400000012064151677225100012447 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.NumberListInstance = exports.NumberInstance = exports.NumberContextImpl = exports.PricingV2VoiceVoiceNumberOutboundCallPrices = exports.PricingV2VoiceVoiceNumberInboundCallPrice = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); /** * The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. */ class PricingV2VoiceVoiceNumberInboundCallPrice { } exports.PricingV2VoiceVoiceNumberInboundCallPrice = PricingV2VoiceVoiceNumberInboundCallPrice; class PricingV2VoiceVoiceNumberOutboundCallPrices { } exports.PricingV2VoiceVoiceNumberOutboundCallPrices = PricingV2VoiceVoiceNumberOutboundCallPrices; class NumberContextImpl { constructor(_version, destinationNumber) { this._version = _version; if (!(0, utility_1.isValidPathParam)(destinationNumber)) { throw new Error("Parameter 'destinationNumber' is not valid."); } this._solution = { destinationNumber }; this._uri = `/Voice/Numbers/${destinationNumber}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["originationNumber"] !== undefined) data["OriginationNumber"] = params["originationNumber"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new NumberInstance(operationVersion, payload, instance._solution.destinationNumber)); 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.NumberContextImpl = NumberContextImpl; class NumberInstance { constructor(_version, payload, destinationNumber) { this._version = _version; this.destinationNumber = payload.destination_number; this.originationNumber = payload.origination_number; this.country = payload.country; this.isoCountry = payload.iso_country; this.outboundCallPrices = payload.outbound_call_prices; this.inboundCallPrice = payload.inbound_call_price; this.priceUnit = payload.price_unit; this.url = payload.url; this._solution = { destinationNumber: destinationNumber || this.destinationNumber, }; } get _proxy() { this._context = this._context || new NumberContextImpl(this._version, this._solution.destinationNumber); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { destinationNumber: this.destinationNumber, originationNumber: this.originationNumber, country: this.country, isoCountry: this.isoCountry, outboundCallPrices: this.outboundCallPrices, inboundCallPrice: this.inboundCallPrice, priceUnit: this.priceUnit, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NumberInstance = NumberInstance; function NumberListInstance(version) { const instance = ((destinationNumber) => instance.get(destinationNumber)); instance.get = function get(destinationNumber) { return new NumberContextImpl(version, destinationNumber); }; 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; } exports.NumberListInstance = NumberListInstance; rest/pricing/v2/country.d.ts000064400000021311151677225100012004 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; export declare class PricingV2TrunkingCountryInstanceOriginatingCallPrices { "basePrice"?: number; "currentPrice"?: number; "numberType"?: string; } export declare class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices { "originationPrefixes"?: Array<string>; "destinationPrefixes"?: Array<string>; "basePrice"?: number; "currentPrice"?: number; "friendlyName"?: string; } /** * Options to pass to each */ export interface CountryListInstanceEachOptions { /** 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: CountryInstance, 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 CountryListInstanceOptions { /** 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 CountryListInstancePageOptions { /** 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 CountryContext { /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CountryContextSolution { isoCountry: string; } export declare class CountryContextImpl implements CountryContext { protected _version: V2; protected _solution: CountryContextSolution; protected _uri: string; constructor(_version: V2, isoCountry: string); fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CountryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CountryPayload extends TwilioResponsePayload { countries: CountryResource[]; } interface CountryResource { country: string; iso_country: string; terminating_prefix_prices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>; originating_call_prices: Array<PricingV2TrunkingCountryInstanceOriginatingCallPrices>; price_unit: string; url: string; } export declare class CountryInstance { protected _version: V2; protected _solution: CountryContextSolution; protected _context?: CountryContext; constructor(_version: V2, payload: CountryResource, isoCountry?: string); /** * The name of the country. */ country: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). */ isoCountry: string; /** * The list of [TerminatingPrefixPrice](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. */ terminatingPrefixPrices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>; /** * The list of [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. */ originatingCallPrices: Array<PricingV2TrunkingCountryInstanceOriginatingCallPrices>; /** * The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { country: string; isoCountry: string; terminatingPrefixPrices: PricingV2TrunkingCountryInstanceTerminatingPrefixPrices[]; originatingCallPrices: PricingV2TrunkingCountryInstanceOriginatingCallPrices[]; priceUnit: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CountrySolution { } export interface CountryListInstance { _version: V2; _solution: CountrySolution; _uri: string; (isoCountry: string): CountryContext; get(isoCountry: string): CountryContext; /** * Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>; /** * Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; /** * Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CountryListInstance(version: V2): CountryListInstance; export declare class CountryPage extends Page<V2, CountryPayload, CountryResource, CountryInstance> { /** * Initialize the CountryPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: CountrySolution); /** * Build an instance of CountryInstance * * @param payload - Payload response from the API */ getInstance(payload: CountryResource): CountryInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/pricing/v2/number.d.ts000064400000013275151677225100011603 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; export declare class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices { "originationPrefixes"?: Array<string>; "destinationPrefixes"?: Array<string>; "basePrice"?: number; "currentPrice"?: number; "friendlyName"?: string; } /** * The [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. */ export declare class PricingV2TrunkingNumberOriginatingCallPrice { "basePrice"?: number; "currentPrice"?: number; "numberType"?: string; } /** * Options to pass to fetch a NumberInstance */ export interface NumberContextFetchOptions { /** The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. */ originationNumber?: string; } export interface NumberContext { /** * Fetch a NumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Fetch a NumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface NumberContextSolution { destinationNumber: string; } export declare class NumberContextImpl implements NumberContext { protected _version: V2; protected _solution: NumberContextSolution; protected _uri: string; constructor(_version: V2, destinationNumber: string); fetch(params?: NumberContextFetchOptions | ((error: Error | null, item?: NumberInstance) => any), callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): NumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface NumberResource { destination_number: string; origination_number: string; country: string; iso_country: string; terminating_prefix_prices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>; originating_call_price: PricingV2TrunkingNumberOriginatingCallPrice; price_unit: string; url: string; } export declare class NumberInstance { protected _version: V2; protected _solution: NumberContextSolution; protected _context?: NumberContext; constructor(_version: V2, payload: NumberResource, destinationNumber?: string); /** * The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ destinationNumber: string; /** * The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ originationNumber: string; /** * The name of the country. */ country: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) */ isoCountry: string; terminatingPrefixPrices: Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>; originatingCallPrice: PricingV2TrunkingNumberOriginatingCallPrice; /** * The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a NumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Fetch a NumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(params: NumberContextFetchOptions, callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { destinationNumber: string; originationNumber: string; country: string; isoCountry: string; terminatingPrefixPrices: PricingV2TrunkingCountryInstanceTerminatingPrefixPrices[]; originatingCallPrice: PricingV2TrunkingNumberOriginatingCallPrice; priceUnit: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface NumberSolution { } export interface NumberListInstance { _version: V2; _solution: NumberSolution; _uri: string; (destinationNumber: string): NumberContext; get(destinationNumber: string): NumberContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NumberListInstance(version: V2): NumberListInstance; export {}; rest/pricing/v2/country.js000064400000015707151677225100011564 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.CountryPage = exports.CountryListInstance = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = exports.PricingV2TrunkingCountryInstanceOriginatingCallPrices = void 0; 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 PricingV2TrunkingCountryInstanceOriginatingCallPrices { } exports.PricingV2TrunkingCountryInstanceOriginatingCallPrices = PricingV2TrunkingCountryInstanceOriginatingCallPrices; class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices { } exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = PricingV2TrunkingCountryInstanceTerminatingPrefixPrices; class CountryContextImpl { constructor(_version, isoCountry) { this._version = _version; if (!(0, utility_1.isValidPathParam)(isoCountry)) { throw new Error("Parameter 'isoCountry' is not valid."); } this._solution = { isoCountry }; this._uri = `/Trunking/Countries/${isoCountry}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CountryInstance(operationVersion, payload, instance._solution.isoCountry)); 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.CountryContextImpl = CountryContextImpl; class CountryInstance { constructor(_version, payload, isoCountry) { this._version = _version; this.country = payload.country; this.isoCountry = payload.iso_country; this.terminatingPrefixPrices = payload.terminating_prefix_prices; this.originatingCallPrices = payload.originating_call_prices; this.priceUnit = payload.price_unit; this.url = payload.url; this._solution = { isoCountry: isoCountry || this.isoCountry }; } get _proxy() { this._context = this._context || new CountryContextImpl(this._version, this._solution.isoCountry); return this._context; } /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { country: this.country, isoCountry: this.isoCountry, terminatingPrefixPrices: this.terminatingPrefixPrices, originatingCallPrices: this.originatingCallPrices, priceUnit: this.priceUnit, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryInstance = CountryInstance; function CountryListInstance(version) { const instance = ((isoCountry) => instance.get(isoCountry)); instance.get = function get(isoCountry) { return new CountryContextImpl(version, isoCountry); }; instance._version = version; instance._solution = {}; instance._uri = `/Trunking/Countries`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CountryPage(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 CountryPage(instance._version, payload, 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; } exports.CountryListInstance = CountryListInstance; class CountryPage extends Page_1.default { /** * Initialize the CountryPage * * @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 CountryInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CountryInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryPage = CountryPage; rest/pricing/v2/number.js000064400000012216151677225100011341 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.NumberListInstance = exports.NumberInstance = exports.NumberContextImpl = exports.PricingV2TrunkingNumberOriginatingCallPrice = exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PricingV2TrunkingCountryInstanceTerminatingPrefixPrices { } exports.PricingV2TrunkingCountryInstanceTerminatingPrefixPrices = PricingV2TrunkingCountryInstanceTerminatingPrefixPrices; /** * The [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. */ class PricingV2TrunkingNumberOriginatingCallPrice { } exports.PricingV2TrunkingNumberOriginatingCallPrice = PricingV2TrunkingNumberOriginatingCallPrice; class NumberContextImpl { constructor(_version, destinationNumber) { this._version = _version; if (!(0, utility_1.isValidPathParam)(destinationNumber)) { throw new Error("Parameter 'destinationNumber' is not valid."); } this._solution = { destinationNumber }; this._uri = `/Trunking/Numbers/${destinationNumber}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["originationNumber"] !== undefined) data["OriginationNumber"] = params["originationNumber"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new NumberInstance(operationVersion, payload, instance._solution.destinationNumber)); 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.NumberContextImpl = NumberContextImpl; class NumberInstance { constructor(_version, payload, destinationNumber) { this._version = _version; this.destinationNumber = payload.destination_number; this.originationNumber = payload.origination_number; this.country = payload.country; this.isoCountry = payload.iso_country; this.terminatingPrefixPrices = payload.terminating_prefix_prices; this.originatingCallPrice = payload.originating_call_price; this.priceUnit = payload.price_unit; this.url = payload.url; this._solution = { destinationNumber: destinationNumber || this.destinationNumber, }; } get _proxy() { this._context = this._context || new NumberContextImpl(this._version, this._solution.destinationNumber); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { destinationNumber: this.destinationNumber, originationNumber: this.originationNumber, country: this.country, isoCountry: this.isoCountry, terminatingPrefixPrices: this.terminatingPrefixPrices, originatingCallPrice: this.originatingCallPrice, priceUnit: this.priceUnit, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NumberInstance = NumberInstance; function NumberListInstance(version) { const instance = ((destinationNumber) => instance.get(destinationNumber)); instance.get = function get(destinationNumber) { return new NumberContextImpl(version, destinationNumber); }; 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; } exports.NumberListInstance = NumberListInstance; rest/pricing/v2/voice.d.ts000064400000001312151677225100011405 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; import { CountryListInstance } from "./voice/country"; import { NumberListInstance } from "./voice/number"; export interface VoiceSolution { } export interface VoiceListInstance { _version: V2; _solution: VoiceSolution; _uri: string; _countries?: CountryListInstance; countries: CountryListInstance; _numbers?: NumberListInstance; numbers: NumberListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function VoiceListInstance(version: V2): VoiceListInstance; rest/pricing/v2/voice.js000064400000003521151677225100011155 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.VoiceListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const country_1 = require("./voice/country"); const number_1 = require("./voice/number"); function VoiceListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Voice`; Object.defineProperty(instance, "countries", { get: function countries() { if (!instance._countries) { instance._countries = (0, country_1.CountryListInstance)(instance._version); } return instance._countries; }, }); Object.defineProperty(instance, "numbers", { get: function numbers() { if (!instance._numbers) { instance._numbers = (0, number_1.NumberListInstance)(instance._version); } return instance._numbers; }, }); 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; } exports.VoiceListInstance = VoiceListInstance; rest/pricing/v1/voice/country.d.ts000064400000021234151677225100013114 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export declare class PricingV1VoiceVoiceCountryInstanceInboundCallPrices { "basePrice"?: number; "currentPrice"?: number; "numberType"?: string; } export declare class PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices { "prefixes"?: Array<string>; "basePrice"?: number; "currentPrice"?: number; "friendlyName"?: string; } /** * Options to pass to each */ export interface CountryListInstanceEachOptions { /** 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: CountryInstance, 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 CountryListInstanceOptions { /** 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 CountryListInstancePageOptions { /** 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 CountryContext { /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CountryContextSolution { isoCountry: string; } export declare class CountryContextImpl implements CountryContext { protected _version: V1; protected _solution: CountryContextSolution; protected _uri: string; constructor(_version: V1, isoCountry: string); fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CountryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CountryPayload extends TwilioResponsePayload { countries: CountryResource[]; } interface CountryResource { country: string; iso_country: string; outbound_prefix_prices: Array<PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices>; inbound_call_prices: Array<PricingV1VoiceVoiceCountryInstanceInboundCallPrices>; price_unit: string; url: string; } export declare class CountryInstance { protected _version: V1; protected _solution: CountryContextSolution; protected _context?: CountryContext; constructor(_version: V1, payload: CountryResource, isoCountry?: string); /** * The name of the country. */ country: string; /** * The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). */ isoCountry: string; /** * The list of OutboundPrefixPrice records, which include a list of the `prefixes`, the `friendly_name`, `base_price`, and the `current_price` for those prefixes. */ outboundPrefixPrices: Array<PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices>; /** * The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. */ inboundCallPrices: Array<PricingV1VoiceVoiceCountryInstanceInboundCallPrices>; /** * The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { country: string; isoCountry: string; outboundPrefixPrices: PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices[]; inboundCallPrices: PricingV1VoiceVoiceCountryInstanceInboundCallPrices[]; priceUnit: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CountrySolution { } export interface CountryListInstance { _version: V1; _solution: CountrySolution; _uri: string; (isoCountry: string): CountryContext; get(isoCountry: string): CountryContext; /** * Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>; /** * Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; /** * Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CountryListInstance(version: V1): CountryListInstance; export declare class CountryPage extends Page<V1, CountryPayload, CountryResource, CountryInstance> { /** * Initialize the CountryPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CountrySolution); /** * Build an instance of CountryInstance * * @param payload - Payload response from the API */ getInstance(payload: CountryResource): CountryInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/pricing/v1/voice/number.d.ts000064400000010011151677225100012670 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; /** * The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. If `null`, the Phone Number is not a Twilio number owned by this account. */ export declare class PricingV1VoiceVoiceNumberInboundCallPrice { "basePrice"?: number; "currentPrice"?: number; "numberType"?: string; } /** * The OutboundCallPrice record, which includes a list of `origination_prefixes` and the `base_price` and `current_price` for those prefixes. */ export declare class PricingV1VoiceVoiceNumberOutboundCallPrice { "basePrice"?: number; "currentPrice"?: number; } export interface NumberContext { /** * Fetch a NumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface NumberContextSolution { number: string; } export declare class NumberContextImpl implements NumberContext { protected _version: V1; protected _solution: NumberContextSolution; protected _uri: string; constructor(_version: V1, number: string); fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): NumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface NumberResource { number: string; country: string; iso_country: string; outbound_call_price: PricingV1VoiceVoiceNumberOutboundCallPrice; inbound_call_price: PricingV1VoiceVoiceNumberInboundCallPrice; price_unit: string; url: string; } export declare class NumberInstance { protected _version: V1; protected _solution: NumberContextSolution; protected _context?: NumberContext; constructor(_version: V1, payload: NumberResource, number?: string); /** * The phone number. */ number: string; /** * The name of the country. */ country: string; /** * The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). */ isoCountry: string; outboundCallPrice: PricingV1VoiceVoiceNumberOutboundCallPrice; inboundCallPrice: PricingV1VoiceVoiceNumberInboundCallPrice; /** * The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a NumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(callback?: (error: Error | null, item?: NumberInstance) => any): Promise<NumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { number: string; country: string; isoCountry: string; outboundCallPrice: PricingV1VoiceVoiceNumberOutboundCallPrice; inboundCallPrice: PricingV1VoiceVoiceNumberInboundCallPrice; priceUnit: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface NumberSolution { } export interface NumberListInstance { _version: V1; _solution: NumberSolution; _uri: string; (number: string): NumberContext; get(number: string): NumberContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NumberListInstance(version: V1): NumberListInstance; export {}; rest/pricing/v1/voice/country.js000064400000015645151677225100012671 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.CountryPage = exports.CountryListInstance = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices = exports.PricingV1VoiceVoiceCountryInstanceInboundCallPrices = void 0; 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 PricingV1VoiceVoiceCountryInstanceInboundCallPrices { } exports.PricingV1VoiceVoiceCountryInstanceInboundCallPrices = PricingV1VoiceVoiceCountryInstanceInboundCallPrices; class PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices { } exports.PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices = PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices; class CountryContextImpl { constructor(_version, isoCountry) { this._version = _version; if (!(0, utility_1.isValidPathParam)(isoCountry)) { throw new Error("Parameter 'isoCountry' is not valid."); } this._solution = { isoCountry }; this._uri = `/Voice/Countries/${isoCountry}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CountryInstance(operationVersion, payload, instance._solution.isoCountry)); 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.CountryContextImpl = CountryContextImpl; class CountryInstance { constructor(_version, payload, isoCountry) { this._version = _version; this.country = payload.country; this.isoCountry = payload.iso_country; this.outboundPrefixPrices = payload.outbound_prefix_prices; this.inboundCallPrices = payload.inbound_call_prices; this.priceUnit = payload.price_unit; this.url = payload.url; this._solution = { isoCountry: isoCountry || this.isoCountry }; } get _proxy() { this._context = this._context || new CountryContextImpl(this._version, this._solution.isoCountry); return this._context; } /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { country: this.country, isoCountry: this.isoCountry, outboundPrefixPrices: this.outboundPrefixPrices, inboundCallPrices: this.inboundCallPrices, priceUnit: this.priceUnit, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryInstance = CountryInstance; function CountryListInstance(version) { const instance = ((isoCountry) => instance.get(isoCountry)); instance.get = function get(isoCountry) { return new CountryContextImpl(version, isoCountry); }; instance._version = version; instance._solution = {}; instance._uri = `/Voice/Countries`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CountryPage(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 CountryPage(instance._version, payload, 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; } exports.CountryListInstance = CountryListInstance; class CountryPage extends Page_1.default { /** * Initialize the CountryPage * * @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 CountryInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CountryInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryPage = CountryPage; rest/pricing/v1/voice/number.js000064400000011301151677225100012437 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.NumberListInstance = exports.NumberInstance = exports.NumberContextImpl = exports.PricingV1VoiceVoiceNumberOutboundCallPrice = exports.PricingV1VoiceVoiceNumberInboundCallPrice = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); /** * The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. If `null`, the Phone Number is not a Twilio number owned by this account. */ class PricingV1VoiceVoiceNumberInboundCallPrice { } exports.PricingV1VoiceVoiceNumberInboundCallPrice = PricingV1VoiceVoiceNumberInboundCallPrice; /** * The OutboundCallPrice record, which includes a list of `origination_prefixes` and the `base_price` and `current_price` for those prefixes. */ class PricingV1VoiceVoiceNumberOutboundCallPrice { } exports.PricingV1VoiceVoiceNumberOutboundCallPrice = PricingV1VoiceVoiceNumberOutboundCallPrice; class NumberContextImpl { constructor(_version, number) { this._version = _version; if (!(0, utility_1.isValidPathParam)(number)) { throw new Error("Parameter 'number' is not valid."); } this._solution = { number }; this._uri = `/Voice/Numbers/${number}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new NumberInstance(operationVersion, payload, instance._solution.number)); 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.NumberContextImpl = NumberContextImpl; class NumberInstance { constructor(_version, payload, number) { this._version = _version; this.number = payload.number; this.country = payload.country; this.isoCountry = payload.iso_country; this.outboundCallPrice = payload.outbound_call_price; this.inboundCallPrice = payload.inbound_call_price; this.priceUnit = payload.price_unit; this.url = payload.url; this._solution = { number: number || this.number }; } get _proxy() { this._context = this._context || new NumberContextImpl(this._version, this._solution.number); return this._context; } /** * Fetch a NumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NumberInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { number: this.number, country: this.country, isoCountry: this.isoCountry, outboundCallPrice: this.outboundCallPrice, inboundCallPrice: this.inboundCallPrice, priceUnit: this.priceUnit, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NumberInstance = NumberInstance; function NumberListInstance(version) { const instance = ((number) => instance.get(number)); instance.get = function get(number) { return new NumberContextImpl(version, number); }; 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; } exports.NumberListInstance = NumberListInstance; rest/pricing/v1/phoneNumber.js000064400000003061151677225100012330 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.PhoneNumberListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const country_1 = require("./phoneNumber/country"); function PhoneNumberListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/PhoneNumbers`; Object.defineProperty(instance, "countries", { get: function countries() { if (!instance._countries) { instance._countries = (0, country_1.CountryListInstance)(instance._version); } return instance._countries; }, }); 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; } exports.PhoneNumberListInstance = PhoneNumberListInstance; rest/pricing/v1/messaging.d.ts000064400000001151151677225100012255 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; import { CountryListInstance } from "./messaging/country"; export interface MessagingSolution { } export interface MessagingListInstance { _version: V1; _solution: MessagingSolution; _uri: string; _countries?: CountryListInstance; countries: CountryListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessagingListInstance(version: V1): MessagingListInstance; rest/pricing/v1/messaging.js000064400000003044151677225100012024 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.MessagingListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const country_1 = require("./messaging/country"); function MessagingListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Messaging`; Object.defineProperty(instance, "countries", { get: function countries() { if (!instance._countries) { instance._countries = (0, country_1.CountryListInstance)(instance._version); } return instance._countries; }, }); 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; } exports.MessagingListInstance = MessagingListInstance; rest/pricing/v1/phoneNumber.d.ts000064400000001165151677225100012567 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; import { CountryListInstance } from "./phoneNumber/country"; export interface PhoneNumberSolution { } export interface PhoneNumberListInstance { _version: V1; _solution: PhoneNumberSolution; _uri: string; _countries?: CountryListInstance; countries: CountryListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PhoneNumberListInstance(version: V1): PhoneNumberListInstance; rest/pricing/v1/phoneNumber/country.d.ts000064400000020113151677225100014264 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export declare class PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices { "basePrice"?: number; "currentPrice"?: number; "numberType"?: string; } /** * Options to pass to each */ export interface CountryListInstanceEachOptions { /** 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: CountryInstance, 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 CountryListInstanceOptions { /** 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 CountryListInstancePageOptions { /** 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 CountryContext { /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CountryContextSolution { isoCountry: string; } export declare class CountryContextImpl implements CountryContext { protected _version: V1; protected _solution: CountryContextSolution; protected _uri: string; constructor(_version: V1, isoCountry: string); fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CountryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CountryPayload extends TwilioResponsePayload { countries: CountryResource[]; } interface CountryResource { country: string; iso_country: string; phone_number_prices: Array<PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices>; price_unit: string; url: string; } export declare class CountryInstance { protected _version: V1; protected _solution: CountryContextSolution; protected _context?: CountryContext; constructor(_version: V1, payload: CountryResource, isoCountry?: string); /** * The name of the country. */ country: string; /** * The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). */ isoCountry: string; /** * The list of [PhoneNumberPrice](https://www.twilio.com/docs/phone-numbers/pricing#phone-number-price) records. */ phoneNumberPrices: Array<PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices>; /** * The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { country: string; isoCountry: string; phoneNumberPrices: PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices[]; priceUnit: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CountrySolution { } export interface CountryListInstance { _version: V1; _solution: CountrySolution; _uri: string; (isoCountry: string): CountryContext; get(isoCountry: string): CountryContext; /** * Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>; /** * Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; /** * Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CountryListInstance(version: V1): CountryListInstance; export declare class CountryPage extends Page<V1, CountryPayload, CountryResource, CountryInstance> { /** * Initialize the CountryPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CountrySolution); /** * Build an instance of CountryInstance * * @param payload - Payload response from the API */ getInstance(payload: CountryResource): CountryInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/pricing/v1/phoneNumber/country.js000064400000015147151677225100014043 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.CountryPage = exports.CountryListInstance = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices = void 0; 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 PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices { } exports.PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices = PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices; class CountryContextImpl { constructor(_version, isoCountry) { this._version = _version; if (!(0, utility_1.isValidPathParam)(isoCountry)) { throw new Error("Parameter 'isoCountry' is not valid."); } this._solution = { isoCountry }; this._uri = `/PhoneNumbers/Countries/${isoCountry}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CountryInstance(operationVersion, payload, instance._solution.isoCountry)); 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.CountryContextImpl = CountryContextImpl; class CountryInstance { constructor(_version, payload, isoCountry) { this._version = _version; this.country = payload.country; this.isoCountry = payload.iso_country; this.phoneNumberPrices = payload.phone_number_prices; this.priceUnit = payload.price_unit; this.url = payload.url; this._solution = { isoCountry: isoCountry || this.isoCountry }; } get _proxy() { this._context = this._context || new CountryContextImpl(this._version, this._solution.isoCountry); return this._context; } /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { country: this.country, isoCountry: this.isoCountry, phoneNumberPrices: this.phoneNumberPrices, priceUnit: this.priceUnit, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryInstance = CountryInstance; function CountryListInstance(version) { const instance = ((isoCountry) => instance.get(isoCountry)); instance.get = function get(isoCountry) { return new CountryContextImpl(version, isoCountry); }; instance._version = version; instance._solution = {}; instance._uri = `/PhoneNumbers/Countries`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CountryPage(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 CountryPage(instance._version, payload, 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; } exports.CountryListInstance = CountryListInstance; class CountryPage extends Page_1.default { /** * Initialize the CountryPage * * @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 CountryInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CountryInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryPage = CountryPage; rest/pricing/v1/messaging/country.d.ts000064400000022036151677225100013765 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export declare class PricingV1MessagingMessagingCountryInstanceInboundSmsPrices { "basePrice"?: number; "currentPrice"?: number; "numberType"?: string; } export declare class PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices { "carrier"?: string; "mcc"?: string; "mnc"?: string; "prices"?: Array<PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices>; } export declare class PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices { "basePrice"?: number; "currentPrice"?: number; "numberType"?: string; } /** * Options to pass to each */ export interface CountryListInstanceEachOptions { /** 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: CountryInstance, 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 CountryListInstanceOptions { /** 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 CountryListInstancePageOptions { /** 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 CountryContext { /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CountryContextSolution { isoCountry: string; } export declare class CountryContextImpl implements CountryContext { protected _version: V1; protected _solution: CountryContextSolution; protected _uri: string; constructor(_version: V1, isoCountry: string); fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CountryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CountryPayload extends TwilioResponsePayload { countries: CountryResource[]; } interface CountryResource { country: string; iso_country: string; outbound_sms_prices: Array<PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices>; inbound_sms_prices: Array<PricingV1MessagingMessagingCountryInstanceInboundSmsPrices>; price_unit: string; url: string; } export declare class CountryInstance { protected _version: V1; protected _solution: CountryContextSolution; protected _context?: CountryContext; constructor(_version: V1, payload: CountryResource, isoCountry?: string); /** * The name of the country. */ country: string; /** * The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). */ isoCountry: string; /** * The list of [OutboundSMSPrice](https://www.twilio.com/docs/sms/api/pricing#outbound-sms-price) records that represent the price to send a message for each MCC/MNC applicable in this country. */ outboundSmsPrices: Array<PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices>; /** * The list of [InboundPrice](https://www.twilio.com/docs/sms/api/pricing#inbound-price) records that describe the price to receive an inbound SMS to the different Twilio phone number types supported in this country */ inboundSmsPrices: Array<PricingV1MessagingMessagingCountryInstanceInboundSmsPrices>; /** * The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback?: (error: Error | null, item?: CountryInstance) => any): Promise<CountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { country: string; isoCountry: string; outboundSmsPrices: PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices[]; inboundSmsPrices: PricingV1MessagingMessagingCountryInstanceInboundSmsPrices[]; priceUnit: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CountrySolution { } export interface CountryListInstance { _version: V1; _solution: CountrySolution; _uri: string; (isoCountry: string): CountryContext; get(isoCountry: string): CountryContext; /** * Streams CountryInstance 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 { CountryListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; each(params: CountryListInstanceEachOptions, callback?: (item: CountryInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CountryInstance 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: CountryPage) => any): Promise<CountryPage>; /** * Lists CountryInstance 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 { CountryListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; list(params: CountryListInstanceOptions, callback?: (error: Error | null, items: CountryInstance[]) => any): Promise<CountryInstance[]>; /** * Retrieve a single page of CountryInstance 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 { CountryListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; page(params: CountryListInstancePageOptions, callback?: (error: Error | null, items: CountryPage) => any): Promise<CountryPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CountryListInstance(version: V1): CountryListInstance; export declare class CountryPage extends Page<V1, CountryPayload, CountryResource, CountryInstance> { /** * Initialize the CountryPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CountrySolution); /** * Build an instance of CountryInstance * * @param payload - Payload response from the API */ getInstance(payload: CountryResource): CountryInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/pricing/v1/messaging/country.js000064400000016364151677225100013540 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.CountryPage = exports.CountryListInstance = exports.CountryInstance = exports.CountryContextImpl = exports.PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices = exports.PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices = exports.PricingV1MessagingMessagingCountryInstanceInboundSmsPrices = void 0; 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 PricingV1MessagingMessagingCountryInstanceInboundSmsPrices { } exports.PricingV1MessagingMessagingCountryInstanceInboundSmsPrices = PricingV1MessagingMessagingCountryInstanceInboundSmsPrices; class PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices { } exports.PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices = PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices; class PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices { } exports.PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices = PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices; class CountryContextImpl { constructor(_version, isoCountry) { this._version = _version; if (!(0, utility_1.isValidPathParam)(isoCountry)) { throw new Error("Parameter 'isoCountry' is not valid."); } this._solution = { isoCountry }; this._uri = `/Messaging/Countries/${isoCountry}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CountryInstance(operationVersion, payload, instance._solution.isoCountry)); 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.CountryContextImpl = CountryContextImpl; class CountryInstance { constructor(_version, payload, isoCountry) { this._version = _version; this.country = payload.country; this.isoCountry = payload.iso_country; this.outboundSmsPrices = payload.outbound_sms_prices; this.inboundSmsPrices = payload.inbound_sms_prices; this.priceUnit = payload.price_unit; this.url = payload.url; this._solution = { isoCountry: isoCountry || this.isoCountry }; } get _proxy() { this._context = this._context || new CountryContextImpl(this._version, this._solution.isoCountry); return this._context; } /** * Fetch a CountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CountryInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { country: this.country, isoCountry: this.isoCountry, outboundSmsPrices: this.outboundSmsPrices, inboundSmsPrices: this.inboundSmsPrices, priceUnit: this.priceUnit, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryInstance = CountryInstance; function CountryListInstance(version) { const instance = ((isoCountry) => instance.get(isoCountry)); instance.get = function get(isoCountry) { return new CountryContextImpl(version, isoCountry); }; instance._version = version; instance._solution = {}; instance._uri = `/Messaging/Countries`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CountryPage(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 CountryPage(instance._version, payload, 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; } exports.CountryListInstance = CountryListInstance; class CountryPage extends Page_1.default { /** * Initialize the CountryPage * * @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 CountryInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CountryInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CountryPage = CountryPage; rest/pricing/v1/voice.d.ts000064400000001312151677225100011404 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; import { CountryListInstance } from "./voice/country"; import { NumberListInstance } from "./voice/number"; export interface VoiceSolution { } export interface VoiceListInstance { _version: V1; _solution: VoiceSolution; _uri: string; _countries?: CountryListInstance; countries: CountryListInstance; _numbers?: NumberListInstance; numbers: NumberListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function VoiceListInstance(version: V1): VoiceListInstance; rest/pricing/v1/voice.js000064400000003521151677225100011154 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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.VoiceListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const country_1 = require("./voice/country"); const number_1 = require("./voice/number"); function VoiceListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Voice`; Object.defineProperty(instance, "countries", { get: function countries() { if (!instance._countries) { instance._countries = (0, country_1.CountryListInstance)(instance._version); } return instance._countries; }, }); Object.defineProperty(instance, "numbers", { get: function numbers() { if (!instance._numbers) { instance._numbers = (0, number_1.NumberListInstance)(instance._version); } return instance._numbers; }, }); 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; } exports.VoiceListInstance = VoiceListInstance; rest/pricing/V1.js000064400000003277151677225100010017 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Pricing * 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 messaging_1 = require("./v1/messaging"); const phoneNumber_1 = require("./v1/phoneNumber"); const voice_1 = require("./v1/voice"); class V1 extends Version_1.default { /** * Initialize the V1 version of Pricing * * @param domain - The Twilio (Twilio.Pricing) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for messaging resource */ get messaging() { this._messaging = this._messaging || (0, messaging_1.MessagingListInstance)(this); return this._messaging; } /** Getter for phoneNumbers resource */ get phoneNumbers() { this._phoneNumbers = this._phoneNumbers || (0, phoneNumber_1.PhoneNumberListInstance)(this); return this._phoneNumbers; } /** Getter for voice resource */ get voice() { this._voice = this._voice || (0, voice_1.VoiceListInstance)(this); return this._voice; } } exports.default = V1; rest/IntelligenceBase.d.ts000064400000000472151677225100011521 0ustar00import Domain from "../base/Domain"; import V2 from "./intelligence/V2"; declare class IntelligenceBase extends Domain { _v2?: V2; /** * Initialize intelligence domain * * @param twilio - The twilio client */ constructor(twilio: any); get v2(): V2; } export = IntelligenceBase; rest/VideoBase.js000064400000002033151677225100007724 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./video/V1")); class VideoBase extends Domain_1.default { /** * Initialize video domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://video.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = VideoBase; rest/ChatBase.d.ts000064400000000622151677225100007773 0ustar00import Domain from "../base/Domain"; import V1 from "./chat/V1"; import V2 from "./chat/V2"; import V3 from "./chat/V3"; declare class ChatBase extends Domain { _v1?: V1; _v2?: V2; _v3?: V3; /** * Initialize chat domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; get v2(): V2; get v3(): V3; } export = ChatBase; rest/Trunking.d.ts000064400000000407151677225100010123 0ustar00import { TrunkListInstance } from "./trunking/v1/trunk"; import TrunkingBase from "./TrunkingBase"; declare class Trunking extends TrunkingBase { /** * @deprecated - Use v1.trunks instead */ get trunks(): TrunkListInstance; } export = Trunking; rest/Monitor.d.ts000064400000000631151677225100007750 0ustar00import { AlertListInstance } from "./monitor/v1/alert"; import { EventListInstance } from "./monitor/v1/event"; import MonitorBase from "./MonitorBase"; declare class Monitor extends MonitorBase { /** * @deprecated - Use v1.alerts instead */ get alerts(): AlertListInstance; /** * @deprecated - Use v1.events instead */ get events(): EventListInstance; } export = Monitor; rest/Chat.d.ts000064400000001106151677225100007176 0ustar00import { CredentialListInstance } from "./chat/v2/credential"; import { ServiceListInstance } from "./chat/v2/service"; import { ChannelListInstance } from "./chat/v3/channel"; import ChatBase from "./ChatBase"; declare class Chat extends ChatBase { /** * @deprecated - Use v2.credentials instead */ get credentials(): CredentialListInstance; /** * @deprecated - Use v2.services instead */ get services(): ServiceListInstance; /** * @deprecated - Use v3.channels instead */ get channels(): ChannelListInstance; } export = Chat; rest/Insights.js000064400000002402151677225100007653 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const InsightsBase_1 = __importDefault(require("./InsightsBase")); class Insights extends InsightsBase_1.default { /** * @deprecated - Use v1.settings instead */ get settings() { console.warn("settings is deprecated. Use v1.settings instead."); return this.v1.settings; } /** * @deprecated - Use v1.calls instead */ get calls() { console.warn("calls is deprecated. Use v1.calls instead."); return this.v1.calls; } /** * @deprecated - Use v1.callSummaries instead */ get callSummaries() { console.warn("callSummaries is deprecated. Use v1.callSummaries instead."); return this.v1.callSummaries; } /** * @deprecated - Use v1.conferences instead */ get conferences() { console.warn("conferences is deprecated. Use v1.conferences instead."); return this.v1.conferences; } /** * @deprecated - Use v1.rooms instead */ get rooms() { console.warn("rooms is deprecated. Use v1.rooms instead."); return this.v1.rooms; } } module.exports = Insights; rest/MicrovisorBase.js000064400000002064151677225100011016 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./microvisor/V1")); class MicrovisorBase extends Domain_1.default { /** * Initialize microvisor domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://microvisor.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = MicrovisorBase; rest/preview/Wireless.js000064400000003264151677225100011350 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const command_1 = require("./wireless/command"); const ratePlan_1 = require("./wireless/ratePlan"); const sim_1 = require("./wireless/sim"); class Wireless extends Version_1.default { /** * Initialize the Wireless version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain) { super(domain, "wireless"); } /** Getter for commands resource */ get commands() { this._commands = this._commands || (0, command_1.CommandListInstance)(this); return this._commands; } /** Getter for ratePlans resource */ get ratePlans() { this._ratePlans = this._ratePlans || (0, ratePlan_1.RatePlanListInstance)(this); return this._ratePlans; } /** Getter for sims resource */ get sims() { this._sims = this._sims || (0, sim_1.SimListInstance)(this); return this._sims; } } exports.default = Wireless; rest/preview/hosted_numbers/authorizationDocument.d.ts000064400000036531151677225100017432 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import HostedNumbers from "../HostedNumbers"; import { DependentHostedNumberOrderListInstance } from "./authorizationDocument/dependentHostedNumberOrder"; export type AuthorizationDocumentStatus = "opened" | "signing" | "signed" | "canceled" | "failed"; /** * Options to pass to update a AuthorizationDocumentInstance */ export interface AuthorizationDocumentContextUpdateOptions { /** A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio\\\'s platform. */ hostedNumberOrderSids?: Array<string>; /** A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. */ addressSid?: string; /** Email that this AuthorizationDocument will be sent to for signing. */ email?: string; /** Email recipients who will be informed when an Authorization Document has been sent and signed */ ccEmails?: Array<string>; /** */ status?: AuthorizationDocumentStatus; /** The title of the person authorized to sign the Authorization Document for this phone number. */ contactTitle?: string; /** The contact phone number of the person authorized to sign the Authorization Document. */ contactPhoneNumber?: string; } /** * Options to pass to create a AuthorizationDocumentInstance */ export interface AuthorizationDocumentListInstanceCreateOptions { /** A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio\\\'s platform. */ hostedNumberOrderSids: Array<string>; /** A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. */ addressSid: string; /** Email that this AuthorizationDocument will be sent to for signing. */ email: string; /** The title of the person authorized to sign the Authorization Document for this phone number. */ contactTitle: string; /** The contact phone number of the person authorized to sign the Authorization Document. */ contactPhoneNumber: string; /** Email recipients who will be informed when an Authorization Document has been sent and signed. */ ccEmails?: Array<string>; } /** * Options to pass to each */ export interface AuthorizationDocumentListInstanceEachOptions { /** Email that this AuthorizationDocument will be sent to for signing. */ email?: string; /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: AuthorizationDocumentStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface AuthorizationDocumentListInstanceOptions { /** Email that this AuthorizationDocument will be sent to for signing. */ email?: string; /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: AuthorizationDocumentStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AuthorizationDocumentListInstancePageOptions { /** Email that this AuthorizationDocument will be sent to for signing. */ email?: string; /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: AuthorizationDocumentStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AuthorizationDocumentContext { dependentHostedNumberOrders: DependentHostedNumberOrderListInstance; /** * Fetch a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ fetch(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Update a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ update(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Update a AuthorizationDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ update(params: AuthorizationDocumentContextUpdateOptions, callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AuthorizationDocumentContextSolution { sid: string; } export declare class AuthorizationDocumentContextImpl implements AuthorizationDocumentContext { protected _version: HostedNumbers; protected _solution: AuthorizationDocumentContextSolution; protected _uri: string; protected _dependentHostedNumberOrders?: DependentHostedNumberOrderListInstance; constructor(_version: HostedNumbers, sid: string); get dependentHostedNumberOrders(): DependentHostedNumberOrderListInstance; fetch(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; update(params?: AuthorizationDocumentContextUpdateOptions | ((error: Error | null, item?: AuthorizationDocumentInstance) => any), callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AuthorizationDocumentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AuthorizationDocumentPayload extends TwilioResponsePayload { items: AuthorizationDocumentResource[]; } interface AuthorizationDocumentResource { sid: string; address_sid: string; status: AuthorizationDocumentStatus; email: string; cc_emails: Array<string>; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class AuthorizationDocumentInstance { protected _version: HostedNumbers; protected _solution: AuthorizationDocumentContextSolution; protected _context?: AuthorizationDocumentContext; constructor(_version: HostedNumbers, payload: AuthorizationDocumentResource, sid?: string); /** * A 34 character string that uniquely identifies this AuthorizationDocument. */ sid: string; /** * A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. */ addressSid: string; status: AuthorizationDocumentStatus; /** * Email that this AuthorizationDocument will be sent to for signing. */ email: string; /** * Email recipients who will be informed when an Authorization Document has been sent and signed. */ ccEmails: Array<string>; /** * The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ fetch(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Update a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ update(callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Update a AuthorizationDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ update(params: AuthorizationDocumentContextUpdateOptions, callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Access the dependentHostedNumberOrders. */ dependentHostedNumberOrders(): DependentHostedNumberOrderListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; addressSid: string; status: AuthorizationDocumentStatus; email: string; ccEmails: string[]; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AuthorizationDocumentSolution { } export interface AuthorizationDocumentListInstance { _version: HostedNumbers; _solution: AuthorizationDocumentSolution; _uri: string; (sid: string): AuthorizationDocumentContext; get(sid: string): AuthorizationDocumentContext; /** * Create a AuthorizationDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ create(params: AuthorizationDocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: AuthorizationDocumentInstance) => any): Promise<AuthorizationDocumentInstance>; /** * Streams AuthorizationDocumentInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AuthorizationDocumentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void): void; each(params: AuthorizationDocumentListInstanceEachOptions, callback?: (item: AuthorizationDocumentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AuthorizationDocumentInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: AuthorizationDocumentPage) => any): Promise<AuthorizationDocumentPage>; /** * Lists AuthorizationDocumentInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AuthorizationDocumentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AuthorizationDocumentInstance[]) => any): Promise<AuthorizationDocumentInstance[]>; list(params: AuthorizationDocumentListInstanceOptions, callback?: (error: Error | null, items: AuthorizationDocumentInstance[]) => any): Promise<AuthorizationDocumentInstance[]>; /** * Retrieve a single page of AuthorizationDocumentInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AuthorizationDocumentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AuthorizationDocumentPage) => any): Promise<AuthorizationDocumentPage>; page(params: AuthorizationDocumentListInstancePageOptions, callback?: (error: Error | null, items: AuthorizationDocumentPage) => any): Promise<AuthorizationDocumentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthorizationDocumentListInstance(version: HostedNumbers): AuthorizationDocumentListInstance; export declare class AuthorizationDocumentPage extends Page<HostedNumbers, AuthorizationDocumentPayload, AuthorizationDocumentResource, AuthorizationDocumentInstance> { /** * Initialize the AuthorizationDocumentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: HostedNumbers, response: Response<string>, solution: AuthorizationDocumentSolution); /** * Build an instance of AuthorizationDocumentInstance * * @param payload - Payload response from the API */ getInstance(payload: AuthorizationDocumentResource): AuthorizationDocumentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/hosted_numbers/hostedNumberOrder.js000064400000034471151677225100016233 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HostedNumberOrderPage = exports.HostedNumberOrderListInstance = exports.HostedNumberOrderInstance = exports.HostedNumberOrderContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class HostedNumberOrderContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/HostedNumberOrders/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["email"] !== undefined) data["Email"] = params["email"]; if (params["ccEmails"] !== undefined) data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e); if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["verificationCode"] !== undefined) data["VerificationCode"] = params["verificationCode"]; if (params["verificationType"] !== undefined) data["VerificationType"] = params["verificationType"]; if (params["verificationDocumentSid"] !== undefined) data["VerificationDocumentSid"] = params["verificationDocumentSid"]; if (params["extension"] !== undefined) data["Extension"] = params["extension"]; if (params["callDelay"] !== undefined) data["CallDelay"] = params["callDelay"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.HostedNumberOrderContextImpl = HostedNumberOrderContextImpl; class HostedNumberOrderInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.incomingPhoneNumberSid = payload.incoming_phone_number_sid; this.addressSid = payload.address_sid; this.signingDocumentSid = payload.signing_document_sid; this.phoneNumber = payload.phone_number; this.capabilities = payload.capabilities; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.status = payload.status; this.failureReason = payload.failure_reason; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.verificationAttempts = deserialize.integer(payload.verification_attempts); this.email = payload.email; this.ccEmails = payload.cc_emails; this.url = payload.url; this.verificationType = payload.verification_type; this.verificationDocumentSid = payload.verification_document_sid; this.extension = payload.extension; this.callDelay = deserialize.integer(payload.call_delay); this.verificationCode = payload.verification_code; this.verificationCallSids = payload.verification_call_sids; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new HostedNumberOrderContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, incomingPhoneNumberSid: this.incomingPhoneNumberSid, addressSid: this.addressSid, signingDocumentSid: this.signingDocumentSid, phoneNumber: this.phoneNumber, capabilities: this.capabilities, friendlyName: this.friendlyName, uniqueName: this.uniqueName, status: this.status, failureReason: this.failureReason, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, verificationAttempts: this.verificationAttempts, email: this.email, ccEmails: this.ccEmails, url: this.url, verificationType: this.verificationType, verificationDocumentSid: this.verificationDocumentSid, extension: this.extension, callDelay: this.callDelay, verificationCode: this.verificationCode, verificationCallSids: this.verificationCallSids, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.HostedNumberOrderInstance = HostedNumberOrderInstance; function HostedNumberOrderListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new HostedNumberOrderContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/HostedNumberOrders`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["phoneNumber"] === null || params["phoneNumber"] === undefined) { throw new Error("Required parameter \"params['phoneNumber']\" missing."); } if (params["smsCapability"] === null || params["smsCapability"] === undefined) { throw new Error("Required parameter \"params['smsCapability']\" missing."); } let data = {}; data["PhoneNumber"] = params["phoneNumber"]; data["SmsCapability"] = serialize.bool(params["smsCapability"]); if (params["accountSid"] !== undefined) data["AccountSid"] = params["accountSid"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["ccEmails"] !== undefined) data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e); if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["statusCallbackUrl"] !== undefined) data["StatusCallbackUrl"] = params["statusCallbackUrl"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["smsApplicationSid"] !== undefined) data["SmsApplicationSid"] = params["smsApplicationSid"]; if (params["addressSid"] !== undefined) data["AddressSid"] = params["addressSid"]; if (params["email"] !== undefined) data["Email"] = params["email"]; if (params["verificationType"] !== undefined) data["VerificationType"] = params["verificationType"]; if (params["verificationDocumentSid"] !== undefined) data["VerificationDocumentSid"] = params["verificationDocumentSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new HostedNumberOrderInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["incomingPhoneNumberSid"] !== undefined) data["IncomingPhoneNumberSid"] = params["incomingPhoneNumberSid"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new HostedNumberOrderPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new HostedNumberOrderPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.HostedNumberOrderListInstance = HostedNumberOrderListInstance; class HostedNumberOrderPage extends Page_1.default { /** * Initialize the HostedNumberOrderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of HostedNumberOrderInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new HostedNumberOrderInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.HostedNumberOrderPage = HostedNumberOrderPage; rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.d.ts000064400000033347151677225100024716 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import HostedNumbers from "../../HostedNumbers"; import { PhoneNumberCapabilities } from "../../../../interfaces"; export type DependentHostedNumberOrderStatus = "received" | "pending-verification" | "verified" | "pending-loa" | "carrier-processing" | "testing" | "completed" | "failed" | "action-required"; export type DependentHostedNumberOrderVerificationType = "phone-call" | "phone-bill"; /** * Options to pass to each */ export interface DependentHostedNumberOrderListInstanceEachOptions { /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: DependentHostedNumberOrderStatus; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; /** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface DependentHostedNumberOrderListInstanceOptions { /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: DependentHostedNumberOrderStatus; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; /** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface DependentHostedNumberOrderListInstancePageOptions { /** Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. */ status?: DependentHostedNumberOrderStatus; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; /** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface DependentHostedNumberOrderSolution { signingDocumentSid: string; } export interface DependentHostedNumberOrderListInstance { _version: HostedNumbers; _solution: DependentHostedNumberOrderSolution; _uri: string; /** * Streams DependentHostedNumberOrderInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { DependentHostedNumberOrderListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void): void; each(params: DependentHostedNumberOrderListInstanceEachOptions, callback?: (item: DependentHostedNumberOrderInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DependentHostedNumberOrderInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: DependentHostedNumberOrderPage) => any): Promise<DependentHostedNumberOrderPage>; /** * Lists DependentHostedNumberOrderInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { DependentHostedNumberOrderListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DependentHostedNumberOrderInstance[]) => any): Promise<DependentHostedNumberOrderInstance[]>; list(params: DependentHostedNumberOrderListInstanceOptions, callback?: (error: Error | null, items: DependentHostedNumberOrderInstance[]) => any): Promise<DependentHostedNumberOrderInstance[]>; /** * Retrieve a single page of DependentHostedNumberOrderInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { DependentHostedNumberOrderListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DependentHostedNumberOrderPage) => any): Promise<DependentHostedNumberOrderPage>; page(params: DependentHostedNumberOrderListInstancePageOptions, callback?: (error: Error | null, items: DependentHostedNumberOrderPage) => any): Promise<DependentHostedNumberOrderPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DependentHostedNumberOrderListInstance(version: HostedNumbers, signingDocumentSid: string): DependentHostedNumberOrderListInstance; interface DependentHostedNumberOrderPayload extends TwilioResponsePayload { items: DependentHostedNumberOrderResource[]; } interface DependentHostedNumberOrderResource { sid: string; account_sid: string; incoming_phone_number_sid: string; address_sid: string; signing_document_sid: string; phone_number: string; capabilities: PhoneNumberCapabilities; friendly_name: string; unique_name: string; status: DependentHostedNumberOrderStatus; failure_reason: string; date_created: Date; date_updated: Date; verification_attempts: number; email: string; cc_emails: Array<string>; verification_type: DependentHostedNumberOrderVerificationType; verification_document_sid: string; extension: string; call_delay: number; verification_code: string; verification_call_sids: Array<string>; } export declare class DependentHostedNumberOrderInstance { protected _version: HostedNumbers; constructor(_version: HostedNumbers, payload: DependentHostedNumberOrderResource, signingDocumentSid: string); /** * A 34 character string that uniquely identifies this Authorization Document */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid: string; /** * A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. */ addressSid: string; /** * A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder. */ signingDocumentSid: string; /** * An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber: string; capabilities: PhoneNumberCapabilities; /** * A human readable description of this resource, up to 64 characters. */ friendlyName: string; /** * Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName: string; status: DependentHostedNumberOrderStatus; /** * A message that explains why a hosted_number_order went to status \"action-required\" */ failureReason: string; /** * The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The number of attempts made to verify ownership of the phone number that is being hosted. */ verificationAttempts: number; /** * Email of the owner of this phone number that is being hosted. */ email: string; /** * Email recipients who will be informed when an Authorization Document has been sent and signed */ ccEmails: Array<string>; verificationType: DependentHostedNumberOrderVerificationType; /** * A 34 character string that uniquely identifies the Identity Document resource that represents the document for verifying ownership of the number to be hosted. */ verificationDocumentSid: string; /** * A numerical extension to be used when making the ownership verification call. */ extension: string; /** * A value between 0-30 specifying the number of seconds to delay initiating the ownership verification call. */ callDelay: number; /** * The digits passed during the ownership verification call. */ verificationCode: string; /** * A list of 34 character strings that are unique identifiers for the calls placed as part of ownership verification. */ verificationCallSids: Array<string>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; incomingPhoneNumberSid: string; addressSid: string; signingDocumentSid: string; phoneNumber: string; capabilities: PhoneNumberCapabilities; friendlyName: string; uniqueName: string; status: DependentHostedNumberOrderStatus; failureReason: string; dateCreated: Date; dateUpdated: Date; verificationAttempts: number; email: string; ccEmails: string[]; verificationType: DependentHostedNumberOrderVerificationType; verificationDocumentSid: string; extension: string; callDelay: number; verificationCode: string; verificationCallSids: string[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class DependentHostedNumberOrderPage extends Page<HostedNumbers, DependentHostedNumberOrderPayload, DependentHostedNumberOrderResource, DependentHostedNumberOrderInstance> { /** * Initialize the DependentHostedNumberOrderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: HostedNumbers, response: Response<string>, solution: DependentHostedNumberOrderSolution); /** * Build an instance of DependentHostedNumberOrderInstance * * @param payload - Payload response from the API */ getInstance(payload: DependentHostedNumberOrderResource): DependentHostedNumberOrderInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/hosted_numbers/authorizationDocument/dependentHostedNumberOrder.js000064400000016674151677225100024466 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DependentHostedNumberOrderPage = exports.DependentHostedNumberOrderInstance = exports.DependentHostedNumberOrderListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function DependentHostedNumberOrderListInstance(version, signingDocumentSid) { if (!(0, utility_1.isValidPathParam)(signingDocumentSid)) { throw new Error("Parameter 'signingDocumentSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { signingDocumentSid }; instance._uri = `/AuthorizationDocuments/${signingDocumentSid}/DependentHostedNumberOrders`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["incomingPhoneNumberSid"] !== undefined) data["IncomingPhoneNumberSid"] = params["incomingPhoneNumberSid"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DependentHostedNumberOrderPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new DependentHostedNumberOrderPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.DependentHostedNumberOrderListInstance = DependentHostedNumberOrderListInstance; class DependentHostedNumberOrderInstance { constructor(_version, payload, signingDocumentSid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.incomingPhoneNumberSid = payload.incoming_phone_number_sid; this.addressSid = payload.address_sid; this.signingDocumentSid = payload.signing_document_sid; this.phoneNumber = payload.phone_number; this.capabilities = payload.capabilities; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.status = payload.status; this.failureReason = payload.failure_reason; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.verificationAttempts = deserialize.integer(payload.verification_attempts); this.email = payload.email; this.ccEmails = payload.cc_emails; this.verificationType = payload.verification_type; this.verificationDocumentSid = payload.verification_document_sid; this.extension = payload.extension; this.callDelay = deserialize.integer(payload.call_delay); this.verificationCode = payload.verification_code; this.verificationCallSids = payload.verification_call_sids; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, incomingPhoneNumberSid: this.incomingPhoneNumberSid, addressSid: this.addressSid, signingDocumentSid: this.signingDocumentSid, phoneNumber: this.phoneNumber, capabilities: this.capabilities, friendlyName: this.friendlyName, uniqueName: this.uniqueName, status: this.status, failureReason: this.failureReason, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, verificationAttempts: this.verificationAttempts, email: this.email, ccEmails: this.ccEmails, verificationType: this.verificationType, verificationDocumentSid: this.verificationDocumentSid, extension: this.extension, callDelay: this.callDelay, verificationCode: this.verificationCode, verificationCallSids: this.verificationCallSids, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DependentHostedNumberOrderInstance = DependentHostedNumberOrderInstance; class DependentHostedNumberOrderPage extends Page_1.default { /** * Initialize the DependentHostedNumberOrderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of DependentHostedNumberOrderInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DependentHostedNumberOrderInstance(this._version, payload, this._solution.signingDocumentSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DependentHostedNumberOrderPage = DependentHostedNumberOrderPage; rest/preview/hosted_numbers/authorizationDocument.js000064400000026651151677225100017200 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AuthorizationDocumentPage = exports.AuthorizationDocumentListInstance = exports.AuthorizationDocumentInstance = exports.AuthorizationDocumentContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const dependentHostedNumberOrder_1 = require("./authorizationDocument/dependentHostedNumberOrder"); class AuthorizationDocumentContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/AuthorizationDocuments/${sid}`; } get dependentHostedNumberOrders() { this._dependentHostedNumberOrders = this._dependentHostedNumberOrders || (0, dependentHostedNumberOrder_1.DependentHostedNumberOrderListInstance)(this._version, this._solution.sid); return this._dependentHostedNumberOrders; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AuthorizationDocumentInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["hostedNumberOrderSids"] !== undefined) data["HostedNumberOrderSids"] = serialize.map(params["hostedNumberOrderSids"], (e) => e); if (params["addressSid"] !== undefined) data["AddressSid"] = params["addressSid"]; if (params["email"] !== undefined) data["Email"] = params["email"]; if (params["ccEmails"] !== undefined) data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e); if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["contactTitle"] !== undefined) data["ContactTitle"] = params["contactTitle"]; if (params["contactPhoneNumber"] !== undefined) data["ContactPhoneNumber"] = params["contactPhoneNumber"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AuthorizationDocumentInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthorizationDocumentContextImpl = AuthorizationDocumentContextImpl; class AuthorizationDocumentInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.addressSid = payload.address_sid; this.status = payload.status; this.email = payload.email; this.ccEmails = payload.cc_emails; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AuthorizationDocumentContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a AuthorizationDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizationDocumentInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the dependentHostedNumberOrders. */ dependentHostedNumberOrders() { return this._proxy.dependentHostedNumberOrders; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, addressSid: this.addressSid, status: this.status, email: this.email, ccEmails: this.ccEmails, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthorizationDocumentInstance = AuthorizationDocumentInstance; function AuthorizationDocumentListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AuthorizationDocumentContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/AuthorizationDocuments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["hostedNumberOrderSids"] === null || params["hostedNumberOrderSids"] === undefined) { throw new Error("Required parameter \"params['hostedNumberOrderSids']\" missing."); } if (params["addressSid"] === null || params["addressSid"] === undefined) { throw new Error("Required parameter \"params['addressSid']\" missing."); } if (params["email"] === null || params["email"] === undefined) { throw new Error("Required parameter \"params['email']\" missing."); } if (params["contactTitle"] === null || params["contactTitle"] === undefined) { throw new Error("Required parameter \"params['contactTitle']\" missing."); } if (params["contactPhoneNumber"] === null || params["contactPhoneNumber"] === undefined) { throw new Error("Required parameter \"params['contactPhoneNumber']\" missing."); } let data = {}; data["HostedNumberOrderSids"] = serialize.map(params["hostedNumberOrderSids"], (e) => e); data["AddressSid"] = params["addressSid"]; data["Email"] = params["email"]; data["ContactTitle"] = params["contactTitle"]; data["ContactPhoneNumber"] = params["contactPhoneNumber"]; if (params["ccEmails"] !== undefined) data["CcEmails"] = serialize.map(params["ccEmails"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AuthorizationDocumentInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["email"] !== undefined) data["Email"] = params["email"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AuthorizationDocumentPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new AuthorizationDocumentPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.AuthorizationDocumentListInstance = AuthorizationDocumentListInstance; class AuthorizationDocumentPage extends Page_1.default { /** * Initialize the AuthorizationDocumentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of AuthorizationDocumentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AuthorizationDocumentInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthorizationDocumentPage = AuthorizationDocumentPage; rest/preview/hosted_numbers/hostedNumberOrder.d.ts000064400000053245151677225100016467 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import HostedNumbers from "../HostedNumbers"; import { PhoneNumberCapabilities } from "../../../interfaces"; export type HostedNumberOrderStatus = "received" | "pending-verification" | "verified" | "pending-loa" | "carrier-processing" | "testing" | "completed" | "failed" | "action-required"; export type HostedNumberOrderVerificationType = "phone-call" | "phone-bill"; /** * Options to pass to update a HostedNumberOrderInstance */ export interface HostedNumberOrderContextUpdateOptions { /** A 64 character string that is a human readable text that describes this resource. */ friendlyName?: string; /** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName?: string; /** Email of the owner of this phone number that is being hosted. */ email?: string; /** Optional. A list of emails that LOA document for this HostedNumberOrder will be carbon copied to. */ ccEmails?: Array<string>; /** */ status?: HostedNumberOrderStatus; /** A verification code that is given to the user via a phone call to the phone number that is being hosted. */ verificationCode?: string; /** */ verificationType?: HostedNumberOrderVerificationType; /** Optional. The unique sid identifier of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when VerificationType is phone-bill. */ verificationDocumentSid?: string; /** Digits to dial after connecting the verification call. */ extension?: string; /** The number of seconds, between 0 and 60, to delay before initiating the verification call. Defaults to 0. */ callDelay?: number; } /** * Options to pass to create a HostedNumberOrderInstance */ export interface HostedNumberOrderListInstanceCreateOptions { /** The number to host in [+E.164](https://en.wikipedia.org/wiki/E.164) format */ phoneNumber: string; /** Used to specify that the SMS capability will be hosted on Twilio\\\'s platform. */ smsCapability: boolean; /** This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to. */ accountSid?: string; /** A 64 character string that is a human readable text that describes this resource. */ friendlyName?: string; /** Optional. Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName?: string; /** Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to. */ ccEmails?: Array<string>; /** The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource. */ smsUrl?: string; /** The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. */ smsMethod?: string; /** A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource. */ smsFallbackUrl?: string; /** The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. */ smsFallbackMethod?: string; /** Optional. The Status Callback URL attached to the IncomingPhoneNumber resource. */ statusCallbackUrl?: string; /** Optional. The Status Callback Method attached to the IncomingPhoneNumber resource. */ statusCallbackMethod?: string; /** Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application. */ smsApplicationSid?: string; /** Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. */ addressSid?: string; /** Optional. Email of the owner of this phone number that is being hosted. */ email?: string; /** */ verificationType?: HostedNumberOrderVerificationType; /** Optional. The unique sid identifier of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when VerificationType is phone-bill. */ verificationDocumentSid?: string; } /** * Options to pass to each */ export interface HostedNumberOrderListInstanceEachOptions { /** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */ status?: HostedNumberOrderStatus; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; /** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface HostedNumberOrderListInstanceOptions { /** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */ status?: HostedNumberOrderStatus; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; /** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface HostedNumberOrderListInstancePageOptions { /** The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. */ status?: HostedNumberOrderStatus; /** An E164 formatted phone number hosted by this HostedNumberOrder. */ phoneNumber?: string; /** A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. */ incomingPhoneNumberSid?: string; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; /** Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface HostedNumberOrderContext { /** * Remove a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Update a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ update(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Update a HostedNumberOrderInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ update(params: HostedNumberOrderContextUpdateOptions, callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface HostedNumberOrderContextSolution { sid: string; } export declare class HostedNumberOrderContextImpl implements HostedNumberOrderContext { protected _version: HostedNumbers; protected _solution: HostedNumberOrderContextSolution; protected _uri: string; constructor(_version: HostedNumbers, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; update(params?: HostedNumberOrderContextUpdateOptions | ((error: Error | null, item?: HostedNumberOrderInstance) => any), callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): HostedNumberOrderContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface HostedNumberOrderPayload extends TwilioResponsePayload { items: HostedNumberOrderResource[]; } interface HostedNumberOrderResource { sid: string; account_sid: string; incoming_phone_number_sid: string; address_sid: string; signing_document_sid: string; phone_number: string; capabilities: PhoneNumberCapabilities; friendly_name: string; unique_name: string; status: HostedNumberOrderStatus; failure_reason: string; date_created: Date; date_updated: Date; verification_attempts: number; email: string; cc_emails: Array<string>; url: string; verification_type: HostedNumberOrderVerificationType; verification_document_sid: string; extension: string; call_delay: number; verification_code: string; verification_call_sids: Array<string>; } export declare class HostedNumberOrderInstance { protected _version: HostedNumbers; protected _solution: HostedNumberOrderContextSolution; protected _context?: HostedNumberOrderContext; constructor(_version: HostedNumbers, payload: HostedNumberOrderResource, sid?: string); /** * A 34 character string that uniquely identifies this HostedNumberOrder. */ sid: string; /** * A 34 character string that uniquely identifies the account. */ accountSid: string; /** * A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the phone number being hosted. */ incomingPhoneNumberSid: string; /** * A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. */ addressSid: string; /** * A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource) the user needs to sign. */ signingDocumentSid: string; /** * Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212 */ phoneNumber: string; capabilities: PhoneNumberCapabilities; /** * A 64 character string that is a human-readable text that describes this resource. */ friendlyName: string; /** * Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. */ uniqueName: string; status: HostedNumberOrderStatus; /** * A message that explains why a hosted_number_order went to status \"action-required\" */ failureReason: string; /** * The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The number of attempts made to verify ownership of the phone number that is being hosted. */ verificationAttempts: number; /** * Email of the owner of this phone number that is being hosted. */ email: string; /** * A list of emails that LOA document for this HostedNumberOrder will be carbon copied to. */ ccEmails: Array<string>; /** * The URL of this HostedNumberOrder. */ url: string; verificationType: HostedNumberOrderVerificationType; /** * A 34 character string that uniquely identifies the Identity Document resource that represents the document for verifying ownership of the number to be hosted. */ verificationDocumentSid: string; /** * A numerical extension to be used when making the ownership verification call. */ extension: string; /** * A value between 0-30 specifying the number of seconds to delay initiating the ownership verification call. */ callDelay: number; /** * A verification code provided in the response for a user to enter when they pick up the phone call. */ verificationCode: string; /** * A list of 34 character strings that are unique identifiers for the calls placed as part of ownership verification. */ verificationCallSids: Array<string>; private get _proxy(); /** * Remove a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ fetch(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Update a HostedNumberOrderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ update(callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Update a HostedNumberOrderInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ update(params: HostedNumberOrderContextUpdateOptions, callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; incomingPhoneNumberSid: string; addressSid: string; signingDocumentSid: string; phoneNumber: string; capabilities: PhoneNumberCapabilities; friendlyName: string; uniqueName: string; status: HostedNumberOrderStatus; failureReason: string; dateCreated: Date; dateUpdated: Date; verificationAttempts: number; email: string; ccEmails: string[]; url: string; verificationType: HostedNumberOrderVerificationType; verificationDocumentSid: string; extension: string; callDelay: number; verificationCode: string; verificationCallSids: string[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface HostedNumberOrderSolution { } export interface HostedNumberOrderListInstance { _version: HostedNumbers; _solution: HostedNumberOrderSolution; _uri: string; (sid: string): HostedNumberOrderContext; get(sid: string): HostedNumberOrderContext; /** * Create a HostedNumberOrderInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed HostedNumberOrderInstance */ create(params: HostedNumberOrderListInstanceCreateOptions, callback?: (error: Error | null, item?: HostedNumberOrderInstance) => any): Promise<HostedNumberOrderInstance>; /** * Streams HostedNumberOrderInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { HostedNumberOrderListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void; each(params: HostedNumberOrderListInstanceEachOptions, callback?: (item: HostedNumberOrderInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of HostedNumberOrderInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>; /** * Lists HostedNumberOrderInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { HostedNumberOrderListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: HostedNumberOrderInstance[]) => any): Promise<HostedNumberOrderInstance[]>; list(params: HostedNumberOrderListInstanceOptions, callback?: (error: Error | null, items: HostedNumberOrderInstance[]) => any): Promise<HostedNumberOrderInstance[]>; /** * Retrieve a single page of HostedNumberOrderInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { HostedNumberOrderListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>; page(params: HostedNumberOrderListInstancePageOptions, callback?: (error: Error | null, items: HostedNumberOrderPage) => any): Promise<HostedNumberOrderPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function HostedNumberOrderListInstance(version: HostedNumbers): HostedNumberOrderListInstance; export declare class HostedNumberOrderPage extends Page<HostedNumbers, HostedNumberOrderPayload, HostedNumberOrderResource, HostedNumberOrderInstance> { /** * Initialize the HostedNumberOrderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: HostedNumbers, response: Response<string>, solution: HostedNumberOrderSolution); /** * Build an instance of HostedNumberOrderInstance * * @param payload - Payload response from the API */ getInstance(payload: HostedNumberOrderResource): HostedNumberOrderInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/marketplace/installedAddOn.js000064400000025013151677225100014724 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InstalledAddOnPage = exports.InstalledAddOnListInstance = exports.InstalledAddOnInstance = exports.InstalledAddOnContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const installedAddOnExtension_1 = require("./installedAddOn/installedAddOnExtension"); class InstalledAddOnContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/InstalledAddOns/${sid}`; } get extensions() { this._extensions = this._extensions || (0, installedAddOnExtension_1.InstalledAddOnExtensionListInstance)(this._version, this._solution.sid); return this._extensions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InstalledAddOnInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["configuration"] !== undefined) data["Configuration"] = serialize.object(params["configuration"]); if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnContextImpl = InstalledAddOnContextImpl; class InstalledAddOnInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.description = payload.description; this.configuration = payload.configuration; this.uniqueName = payload.unique_name; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InstalledAddOnContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the extensions. */ extensions() { return this._proxy.extensions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, description: this.description, configuration: this.configuration, uniqueName: this.uniqueName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnInstance = InstalledAddOnInstance; function InstalledAddOnListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InstalledAddOnContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/InstalledAddOns`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["availableAddOnSid"] === null || params["availableAddOnSid"] === undefined) { throw new Error("Required parameter \"params['availableAddOnSid']\" missing."); } if (params["acceptTermsOfService"] === null || params["acceptTermsOfService"] === undefined) { throw new Error("Required parameter \"params['acceptTermsOfService']\" missing."); } let data = {}; data["AvailableAddOnSid"] = params["availableAddOnSid"]; data["AcceptTermsOfService"] = serialize.bool(params["acceptTermsOfService"]); if (params["configuration"] !== undefined) data["Configuration"] = serialize.object(params["configuration"]); if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new InstalledAddOnPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.InstalledAddOnListInstance = InstalledAddOnListInstance; class InstalledAddOnPage extends Page_1.default { /** * Initialize the InstalledAddOnPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of InstalledAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InstalledAddOnInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnPage = InstalledAddOnPage; rest/preview/marketplace/availableAddOn/availableAddOnExtension.js000064400000016437151677225100021422 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AvailableAddOnExtensionPage = exports.AvailableAddOnExtensionListInstance = exports.AvailableAddOnExtensionInstance = exports.AvailableAddOnExtensionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class AvailableAddOnExtensionContextImpl { constructor(_version, availableAddOnSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(availableAddOnSid)) { throw new Error("Parameter 'availableAddOnSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { availableAddOnSid, sid }; this._uri = `/AvailableAddOns/${availableAddOnSid}/Extensions/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AvailableAddOnExtensionInstance(operationVersion, payload, instance._solution.availableAddOnSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnExtensionContextImpl = AvailableAddOnExtensionContextImpl; class AvailableAddOnExtensionInstance { constructor(_version, payload, availableAddOnSid, sid) { this._version = _version; this.sid = payload.sid; this.availableAddOnSid = payload.available_add_on_sid; this.friendlyName = payload.friendly_name; this.productName = payload.product_name; this.uniqueName = payload.unique_name; this.url = payload.url; this._solution = { availableAddOnSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AvailableAddOnExtensionContextImpl(this._version, this._solution.availableAddOnSid, this._solution.sid); return this._context; } /** * Fetch a AvailableAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnExtensionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, availableAddOnSid: this.availableAddOnSid, friendlyName: this.friendlyName, productName: this.productName, uniqueName: this.uniqueName, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnExtensionInstance = AvailableAddOnExtensionInstance; function AvailableAddOnExtensionListInstance(version, availableAddOnSid) { if (!(0, utility_1.isValidPathParam)(availableAddOnSid)) { throw new Error("Parameter 'availableAddOnSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AvailableAddOnExtensionContextImpl(version, availableAddOnSid, sid); }; instance._version = version; instance._solution = { availableAddOnSid }; instance._uri = `/AvailableAddOns/${availableAddOnSid}/Extensions`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AvailableAddOnExtensionPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new AvailableAddOnExtensionPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.AvailableAddOnExtensionListInstance = AvailableAddOnExtensionListInstance; class AvailableAddOnExtensionPage extends Page_1.default { /** * Initialize the AvailableAddOnExtensionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of AvailableAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AvailableAddOnExtensionInstance(this._version, payload, this._solution.availableAddOnSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnExtensionPage = AvailableAddOnExtensionPage; rest/preview/marketplace/availableAddOn/availableAddOnExtension.d.ts000064400000022000151677225100021635 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import Marketplace from "../../Marketplace"; /** * Options to pass to each */ export interface AvailableAddOnExtensionListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface AvailableAddOnExtensionListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AvailableAddOnExtensionListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AvailableAddOnExtensionContext { /** * Fetch a AvailableAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: AvailableAddOnExtensionInstance) => any): Promise<AvailableAddOnExtensionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AvailableAddOnExtensionContextSolution { availableAddOnSid: string; sid: string; } export declare class AvailableAddOnExtensionContextImpl implements AvailableAddOnExtensionContext { protected _version: Marketplace; protected _solution: AvailableAddOnExtensionContextSolution; protected _uri: string; constructor(_version: Marketplace, availableAddOnSid: string, sid: string); fetch(callback?: (error: Error | null, item?: AvailableAddOnExtensionInstance) => any): Promise<AvailableAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AvailableAddOnExtensionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AvailableAddOnExtensionPayload extends TwilioResponsePayload { extensions: AvailableAddOnExtensionResource[]; } interface AvailableAddOnExtensionResource { sid: string; available_add_on_sid: string; friendly_name: string; product_name: string; unique_name: string; url: string; } export declare class AvailableAddOnExtensionInstance { protected _version: Marketplace; protected _solution: AvailableAddOnExtensionContextSolution; protected _context?: AvailableAddOnExtensionContext; constructor(_version: Marketplace, payload: AvailableAddOnExtensionResource, availableAddOnSid: string, sid?: string); /** * The unique string that we created to identify the AvailableAddOnExtension resource. */ sid: string; /** * The SID of the AvailableAddOn resource to which this extension applies. */ availableAddOnSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The name of the Product this Extension is used within. */ productName: string; /** * An application-defined string that uniquely identifies the resource. */ uniqueName: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a AvailableAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: AvailableAddOnExtensionInstance) => any): Promise<AvailableAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; availableAddOnSid: string; friendlyName: string; productName: string; uniqueName: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AvailableAddOnExtensionSolution { availableAddOnSid: string; } export interface AvailableAddOnExtensionListInstance { _version: Marketplace; _solution: AvailableAddOnExtensionSolution; _uri: string; (sid: string): AvailableAddOnExtensionContext; get(sid: string): AvailableAddOnExtensionContext; /** * Streams AvailableAddOnExtensionInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnExtensionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void): void; each(params: AvailableAddOnExtensionListInstanceEachOptions, callback?: (item: AvailableAddOnExtensionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AvailableAddOnExtensionInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: AvailableAddOnExtensionPage) => any): Promise<AvailableAddOnExtensionPage>; /** * Lists AvailableAddOnExtensionInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnExtensionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AvailableAddOnExtensionInstance[]) => any): Promise<AvailableAddOnExtensionInstance[]>; list(params: AvailableAddOnExtensionListInstanceOptions, callback?: (error: Error | null, items: AvailableAddOnExtensionInstance[]) => any): Promise<AvailableAddOnExtensionInstance[]>; /** * Retrieve a single page of AvailableAddOnExtensionInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnExtensionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AvailableAddOnExtensionPage) => any): Promise<AvailableAddOnExtensionPage>; page(params: AvailableAddOnExtensionListInstancePageOptions, callback?: (error: Error | null, items: AvailableAddOnExtensionPage) => any): Promise<AvailableAddOnExtensionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AvailableAddOnExtensionListInstance(version: Marketplace, availableAddOnSid: string): AvailableAddOnExtensionListInstance; export declare class AvailableAddOnExtensionPage extends Page<Marketplace, AvailableAddOnExtensionPayload, AvailableAddOnExtensionResource, AvailableAddOnExtensionInstance> { /** * Initialize the AvailableAddOnExtensionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Marketplace, response: Response<string>, solution: AvailableAddOnExtensionSolution); /** * Build an instance of AvailableAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload: AvailableAddOnExtensionResource): AvailableAddOnExtensionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/marketplace/installedAddOn/installedAddOnExtension.js000064400000020767151677225100021521 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InstalledAddOnExtensionPage = exports.InstalledAddOnExtensionListInstance = exports.InstalledAddOnExtensionInstance = exports.InstalledAddOnExtensionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class InstalledAddOnExtensionContextImpl { constructor(_version, installedAddOnSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(installedAddOnSid)) { throw new Error("Parameter 'installedAddOnSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { installedAddOnSid, sid }; this._uri = `/InstalledAddOns/${installedAddOnSid}/Extensions/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InstalledAddOnExtensionInstance(operationVersion, payload, instance._solution.installedAddOnSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["enabled"] === null || params["enabled"] === undefined) { throw new Error("Required parameter \"params['enabled']\" missing."); } let data = {}; data["Enabled"] = serialize.bool(params["enabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnExtensionInstance(operationVersion, payload, instance._solution.installedAddOnSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnExtensionContextImpl = InstalledAddOnExtensionContextImpl; class InstalledAddOnExtensionInstance { constructor(_version, payload, installedAddOnSid, sid) { this._version = _version; this.sid = payload.sid; this.installedAddOnSid = payload.installed_add_on_sid; this.friendlyName = payload.friendly_name; this.productName = payload.product_name; this.uniqueName = payload.unique_name; this.enabled = payload.enabled; this.url = payload.url; this._solution = { installedAddOnSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InstalledAddOnExtensionContextImpl(this._version, this._solution.installedAddOnSid, this._solution.sid); return this._context; } /** * Fetch a InstalledAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, installedAddOnSid: this.installedAddOnSid, friendlyName: this.friendlyName, productName: this.productName, uniqueName: this.uniqueName, enabled: this.enabled, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnExtensionInstance = InstalledAddOnExtensionInstance; function InstalledAddOnExtensionListInstance(version, installedAddOnSid) { if (!(0, utility_1.isValidPathParam)(installedAddOnSid)) { throw new Error("Parameter 'installedAddOnSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InstalledAddOnExtensionContextImpl(version, installedAddOnSid, sid); }; instance._version = version; instance._solution = { installedAddOnSid }; instance._uri = `/InstalledAddOns/${installedAddOnSid}/Extensions`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InstalledAddOnExtensionPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new InstalledAddOnExtensionPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.InstalledAddOnExtensionListInstance = InstalledAddOnExtensionListInstance; class InstalledAddOnExtensionPage extends Page_1.default { /** * Initialize the InstalledAddOnExtensionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of InstalledAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InstalledAddOnExtensionInstance(this._version, payload, this._solution.installedAddOnSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InstalledAddOnExtensionPage = InstalledAddOnExtensionPage; rest/preview/marketplace/installedAddOn/installedAddOnExtension.d.ts000064400000024607151677225100021752 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import Marketplace from "../../Marketplace"; /** * Options to pass to update a InstalledAddOnExtensionInstance */ export interface InstalledAddOnExtensionContextUpdateOptions { /** Whether the Extension should be invoked. */ enabled: boolean; } /** * Options to pass to each */ export interface InstalledAddOnExtensionListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface InstalledAddOnExtensionListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InstalledAddOnExtensionListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InstalledAddOnExtensionContext { /** * Fetch a InstalledAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Update a InstalledAddOnExtensionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ update(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InstalledAddOnExtensionContextSolution { installedAddOnSid: string; sid: string; } export declare class InstalledAddOnExtensionContextImpl implements InstalledAddOnExtensionContext { protected _version: Marketplace; protected _solution: InstalledAddOnExtensionContextSolution; protected _uri: string; constructor(_version: Marketplace, installedAddOnSid: string, sid: string); fetch(callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; update(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InstalledAddOnExtensionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InstalledAddOnExtensionPayload extends TwilioResponsePayload { extensions: InstalledAddOnExtensionResource[]; } interface InstalledAddOnExtensionResource { sid: string; installed_add_on_sid: string; friendly_name: string; product_name: string; unique_name: string; enabled: boolean; url: string; } export declare class InstalledAddOnExtensionInstance { protected _version: Marketplace; protected _solution: InstalledAddOnExtensionContextSolution; protected _context?: InstalledAddOnExtensionContext; constructor(_version: Marketplace, payload: InstalledAddOnExtensionResource, installedAddOnSid: string, sid?: string); /** * The unique string that we created to identify the InstalledAddOn Extension resource. */ sid: string; /** * The SID of the InstalledAddOn resource to which this extension applies. */ installedAddOnSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The name of the Product this Extension is used within. */ productName: string; /** * An application-defined string that uniquely identifies the resource. */ uniqueName: string; /** * Whether the Extension will be invoked. */ enabled: boolean; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a InstalledAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Update a InstalledAddOnExtensionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnExtensionInstance */ update(params: InstalledAddOnExtensionContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnExtensionInstance) => any): Promise<InstalledAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; installedAddOnSid: string; friendlyName: string; productName: string; uniqueName: string; enabled: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InstalledAddOnExtensionSolution { installedAddOnSid: string; } export interface InstalledAddOnExtensionListInstance { _version: Marketplace; _solution: InstalledAddOnExtensionSolution; _uri: string; (sid: string): InstalledAddOnExtensionContext; get(sid: string): InstalledAddOnExtensionContext; /** * Streams InstalledAddOnExtensionInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnExtensionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void): void; each(params: InstalledAddOnExtensionListInstanceEachOptions, callback?: (item: InstalledAddOnExtensionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InstalledAddOnExtensionInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: InstalledAddOnExtensionPage) => any): Promise<InstalledAddOnExtensionPage>; /** * Lists InstalledAddOnExtensionInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnExtensionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InstalledAddOnExtensionInstance[]) => any): Promise<InstalledAddOnExtensionInstance[]>; list(params: InstalledAddOnExtensionListInstanceOptions, callback?: (error: Error | null, items: InstalledAddOnExtensionInstance[]) => any): Promise<InstalledAddOnExtensionInstance[]>; /** * Retrieve a single page of InstalledAddOnExtensionInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnExtensionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InstalledAddOnExtensionPage) => any): Promise<InstalledAddOnExtensionPage>; page(params: InstalledAddOnExtensionListInstancePageOptions, callback?: (error: Error | null, items: InstalledAddOnExtensionPage) => any): Promise<InstalledAddOnExtensionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InstalledAddOnExtensionListInstance(version: Marketplace, installedAddOnSid: string): InstalledAddOnExtensionListInstance; export declare class InstalledAddOnExtensionPage extends Page<Marketplace, InstalledAddOnExtensionPayload, InstalledAddOnExtensionResource, InstalledAddOnExtensionInstance> { /** * Initialize the InstalledAddOnExtensionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Marketplace, response: Response<string>, solution: InstalledAddOnExtensionSolution); /** * Build an instance of InstalledAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload: InstalledAddOnExtensionResource): InstalledAddOnExtensionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/marketplace/availableAddOn.js000064400000015725151677225100014676 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AvailableAddOnPage = exports.AvailableAddOnListInstance = exports.AvailableAddOnInstance = exports.AvailableAddOnContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const availableAddOnExtension_1 = require("./availableAddOn/availableAddOnExtension"); class AvailableAddOnContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/AvailableAddOns/${sid}`; } get extensions() { this._extensions = this._extensions || (0, availableAddOnExtension_1.AvailableAddOnExtensionListInstance)(this._version, this._solution.sid); return this._extensions; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AvailableAddOnInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnContextImpl = AvailableAddOnContextImpl; class AvailableAddOnInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.description = payload.description; this.pricingType = payload.pricing_type; this.configurationSchema = payload.configuration_schema; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AvailableAddOnContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a AvailableAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the extensions. */ extensions() { return this._proxy.extensions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, description: this.description, pricingType: this.pricingType, configurationSchema: this.configurationSchema, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnInstance = AvailableAddOnInstance; function AvailableAddOnListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AvailableAddOnContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/AvailableAddOns`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AvailableAddOnPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new AvailableAddOnPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.AvailableAddOnListInstance = AvailableAddOnListInstance; class AvailableAddOnPage extends Page_1.default { /** * Initialize the AvailableAddOnPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of AvailableAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AvailableAddOnInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailableAddOnPage = AvailableAddOnPage; rest/preview/marketplace/installedAddOn.d.ts000064400000032222151677225100015160 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import Marketplace from "../Marketplace"; import { InstalledAddOnExtensionListInstance } from "./installedAddOn/installedAddOnExtension"; /** * Options to pass to update a InstalledAddOnInstance */ export interface InstalledAddOnContextUpdateOptions { /** Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured */ configuration?: any; /** An application-defined string that uniquely identifies the resource. This value must be unique within the Account. */ uniqueName?: string; } /** * Options to pass to create a InstalledAddOnInstance */ export interface InstalledAddOnListInstanceCreateOptions { /** The SID of the AvaliableAddOn to install. */ availableAddOnSid: string; /** Whether the Terms of Service were accepted. */ acceptTermsOfService: boolean; /** The JSON object that represents the configuration of the new Add-on being installed. */ configuration?: any; /** An application-defined string that uniquely identifies the resource. This value must be unique within the Account. */ uniqueName?: string; } /** * Options to pass to each */ export interface InstalledAddOnListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface InstalledAddOnListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InstalledAddOnListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InstalledAddOnContext { extensions: InstalledAddOnExtensionListInstance; /** * Remove a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ fetch(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Update a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ update(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Update a InstalledAddOnInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ update(params: InstalledAddOnContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InstalledAddOnContextSolution { sid: string; } export declare class InstalledAddOnContextImpl implements InstalledAddOnContext { protected _version: Marketplace; protected _solution: InstalledAddOnContextSolution; protected _uri: string; protected _extensions?: InstalledAddOnExtensionListInstance; constructor(_version: Marketplace, sid: string); get extensions(): InstalledAddOnExtensionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; update(params?: InstalledAddOnContextUpdateOptions | ((error: Error | null, item?: InstalledAddOnInstance) => any), callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InstalledAddOnContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InstalledAddOnPayload extends TwilioResponsePayload { installed_add_ons: InstalledAddOnResource[]; } interface InstalledAddOnResource { sid: string; account_sid: string; friendly_name: string; description: string; configuration: any; unique_name: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class InstalledAddOnInstance { protected _version: Marketplace; protected _solution: InstalledAddOnContextSolution; protected _context?: InstalledAddOnContext; constructor(_version: Marketplace, payload: InstalledAddOnResource, sid?: string); /** * The unique string that we created to identify the InstalledAddOn resource. This Sid can also be found in the Console on that specific Add-ons page as the \'Available Add-on Sid\'. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the InstalledAddOn resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * A short description of the Add-on\'s functionality. */ description: string; /** * The JSON object that represents the current configuration of installed Add-on. */ configuration: any; /** * An application-defined string that uniquely identifies the resource. */ uniqueName: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ fetch(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Update a InstalledAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ update(callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Update a InstalledAddOnInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ update(params: InstalledAddOnContextUpdateOptions, callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Access the extensions. */ extensions(): InstalledAddOnExtensionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; description: string; configuration: any; uniqueName: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InstalledAddOnSolution { } export interface InstalledAddOnListInstance { _version: Marketplace; _solution: InstalledAddOnSolution; _uri: string; (sid: string): InstalledAddOnContext; get(sid: string): InstalledAddOnContext; /** * Create a InstalledAddOnInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InstalledAddOnInstance */ create(params: InstalledAddOnListInstanceCreateOptions, callback?: (error: Error | null, item?: InstalledAddOnInstance) => any): Promise<InstalledAddOnInstance>; /** * Streams InstalledAddOnInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void): void; each(params: InstalledAddOnListInstanceEachOptions, callback?: (item: InstalledAddOnInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InstalledAddOnInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: InstalledAddOnPage) => any): Promise<InstalledAddOnPage>; /** * Lists InstalledAddOnInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InstalledAddOnInstance[]) => any): Promise<InstalledAddOnInstance[]>; list(params: InstalledAddOnListInstanceOptions, callback?: (error: Error | null, items: InstalledAddOnInstance[]) => any): Promise<InstalledAddOnInstance[]>; /** * Retrieve a single page of InstalledAddOnInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { InstalledAddOnListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InstalledAddOnPage) => any): Promise<InstalledAddOnPage>; page(params: InstalledAddOnListInstancePageOptions, callback?: (error: Error | null, items: InstalledAddOnPage) => any): Promise<InstalledAddOnPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InstalledAddOnListInstance(version: Marketplace): InstalledAddOnListInstance; export declare class InstalledAddOnPage extends Page<Marketplace, InstalledAddOnPayload, InstalledAddOnResource, InstalledAddOnInstance> { /** * Initialize the InstalledAddOnPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Marketplace, response: Response<string>, solution: InstalledAddOnSolution); /** * Build an instance of InstalledAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload: InstalledAddOnResource): InstalledAddOnInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/marketplace/availableAddOn.d.ts000064400000021461151677225100015124 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import Marketplace from "../Marketplace"; import { AvailableAddOnExtensionListInstance } from "./availableAddOn/availableAddOnExtension"; /** * Options to pass to each */ export interface AvailableAddOnListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface AvailableAddOnListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AvailableAddOnListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AvailableAddOnContext { extensions: AvailableAddOnExtensionListInstance; /** * Fetch a AvailableAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnInstance */ fetch(callback?: (error: Error | null, item?: AvailableAddOnInstance) => any): Promise<AvailableAddOnInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AvailableAddOnContextSolution { sid: string; } export declare class AvailableAddOnContextImpl implements AvailableAddOnContext { protected _version: Marketplace; protected _solution: AvailableAddOnContextSolution; protected _uri: string; protected _extensions?: AvailableAddOnExtensionListInstance; constructor(_version: Marketplace, sid: string); get extensions(): AvailableAddOnExtensionListInstance; fetch(callback?: (error: Error | null, item?: AvailableAddOnInstance) => any): Promise<AvailableAddOnInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AvailableAddOnContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AvailableAddOnPayload extends TwilioResponsePayload { available_add_ons: AvailableAddOnResource[]; } interface AvailableAddOnResource { sid: string; friendly_name: string; description: string; pricing_type: string; configuration_schema: any; url: string; links: Record<string, string>; } export declare class AvailableAddOnInstance { protected _version: Marketplace; protected _solution: AvailableAddOnContextSolution; protected _context?: AvailableAddOnContext; constructor(_version: Marketplace, payload: AvailableAddOnResource, sid?: string); /** * The unique string that we created to identify the AvailableAddOn resource. */ sid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * A short description of the Add-on\'s functionality. */ description: string; /** * How customers are charged for using this Add-on. */ pricingType: string; /** * The JSON object with the configuration that must be provided when installing a given Add-on. */ configurationSchema: any; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a AvailableAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailableAddOnInstance */ fetch(callback?: (error: Error | null, item?: AvailableAddOnInstance) => any): Promise<AvailableAddOnInstance>; /** * Access the extensions. */ extensions(): AvailableAddOnExtensionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; description: string; pricingType: string; configurationSchema: any; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AvailableAddOnSolution { } export interface AvailableAddOnListInstance { _version: Marketplace; _solution: AvailableAddOnSolution; _uri: string; (sid: string): AvailableAddOnContext; get(sid: string): AvailableAddOnContext; /** * Streams AvailableAddOnInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void): void; each(params: AvailableAddOnListInstanceEachOptions, callback?: (item: AvailableAddOnInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AvailableAddOnInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: AvailableAddOnPage) => any): Promise<AvailableAddOnPage>; /** * Lists AvailableAddOnInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AvailableAddOnInstance[]) => any): Promise<AvailableAddOnInstance[]>; list(params: AvailableAddOnListInstanceOptions, callback?: (error: Error | null, items: AvailableAddOnInstance[]) => any): Promise<AvailableAddOnInstance[]>; /** * Retrieve a single page of AvailableAddOnInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { AvailableAddOnListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AvailableAddOnPage) => any): Promise<AvailableAddOnPage>; page(params: AvailableAddOnListInstancePageOptions, callback?: (error: Error | null, items: AvailableAddOnPage) => any): Promise<AvailableAddOnPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AvailableAddOnListInstance(version: Marketplace): AvailableAddOnListInstance; export declare class AvailableAddOnPage extends Page<Marketplace, AvailableAddOnPayload, AvailableAddOnResource, AvailableAddOnInstance> { /** * Initialize the AvailableAddOnPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Marketplace, response: Response<string>, solution: AvailableAddOnSolution); /** * Build an instance of AvailableAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload: AvailableAddOnResource): AvailableAddOnInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service.d.ts000064400000027167151677225100012433 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import Sync from "../Sync"; import { DocumentListInstance } from "./service/document"; import { SyncListListInstance } from "./service/syncList"; import { SyncMapListInstance } from "./service/syncMap"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** */ webhookUrl?: string; /** */ friendlyName?: string; /** */ reachabilityWebhooksEnabled?: boolean; /** */ aclEnabled?: boolean; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** */ friendlyName?: string; /** */ webhookUrl?: string; /** */ reachabilityWebhooksEnabled?: boolean; /** */ aclEnabled?: boolean; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { documents: DocumentListInstance; syncLists: SyncListListInstance; syncMaps: SyncMapListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: Sync; protected _solution: ServiceContextSolution; protected _uri: string; protected _documents?: DocumentListInstance; protected _syncLists?: SyncListListInstance; protected _syncMaps?: SyncMapListInstance; constructor(_version: Sync, sid: string); get documents(): DocumentListInstance; get syncLists(): SyncListListInstance; get syncMaps(): SyncMapListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; date_created: Date; date_updated: Date; url: string; webhook_url: string; reachability_webhooks_enabled: boolean; acl_enabled: boolean; links: Record<string, string>; } export declare class ServiceInstance { protected _version: Sync; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: Sync, payload: ServiceResource, sid?: string); sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; url: string; webhookUrl: string; reachabilityWebhooksEnabled: boolean; aclEnabled: boolean; links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the documents. */ documents(): DocumentListInstance; /** * Access the syncLists. */ syncLists(): SyncListListInstance; /** * Access the syncMaps. */ syncMaps(): SyncMapListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; url: string; webhookUrl: string; reachabilityWebhooksEnabled: boolean; aclEnabled: boolean; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: Sync; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: Sync): ServiceListInstance; export declare class ServicePage extends Page<Sync, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Sync, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service.js000064400000025715151677225100012174 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const document_1 = require("./service/document"); const syncList_1 = require("./service/syncList"); const syncMap_1 = require("./service/syncMap"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get documents() { this._documents = this._documents || (0, document_1.DocumentListInstance)(this._version, this._solution.sid); return this._documents; } get syncLists() { this._syncLists = this._syncLists || (0, syncList_1.SyncListListInstance)(this._version, this._solution.sid); return this._syncLists; } get syncMaps() { this._syncMaps = this._syncMaps || (0, syncMap_1.SyncMapListInstance)(this._version, this._solution.sid); return this._syncMaps; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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["webhookUrl"] !== undefined) data["WebhookUrl"] = params["webhookUrl"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["reachabilityWebhooksEnabled"] !== undefined) data["ReachabilityWebhooksEnabled"] = serialize.bool(params["reachabilityWebhooksEnabled"]); if (params["aclEnabled"] !== undefined) data["AclEnabled"] = serialize.bool(params["aclEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { 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.webhookUrl = payload.webhook_url; this.reachabilityWebhooksEnabled = payload.reachability_webhooks_enabled; this.aclEnabled = payload.acl_enabled; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the documents. */ documents() { return this._proxy.documents; } /** * Access the syncLists. */ syncLists() { return this._proxy.syncLists; } /** * Access the syncMaps. */ syncMaps() { return this._proxy.syncMaps; } /** * 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, webhookUrl: this.webhookUrl, reachabilityWebhooksEnabled: this.reachabilityWebhooksEnabled, aclEnabled: this.aclEnabled, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["webhookUrl"] !== undefined) data["WebhookUrl"] = params["webhookUrl"]; if (params["reachabilityWebhooksEnabled"] !== undefined) data["ReachabilityWebhooksEnabled"] = serialize.bool(params["reachabilityWebhooksEnabled"]); if (params["aclEnabled"] !== undefined) data["AclEnabled"] = serialize.bool(params["aclEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/preview/sync/service/syncList.js000064400000023001151677225100013766 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SyncListPage = exports.SyncListListInstance = exports.SyncListInstance = exports.SyncListContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const syncListItem_1 = require("./syncList/syncListItem"); const syncListPermission_1 = require("./syncList/syncListPermission"); class SyncListContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Lists/${sid}`; } get syncListItems() { this._syncListItems = this._syncListItems || (0, syncListItem_1.SyncListItemListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._syncListItems; } get syncListPermissions() { this._syncListPermissions = this._syncListPermissions || (0, syncListPermission_1.SyncListPermissionListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._syncListPermissions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncListInstance(operationVersion, payload, instance._solution.serviceSid, 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.SyncListContextImpl = SyncListContextImpl; class SyncListInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.url = payload.url; this.links = payload.links; this.revision = payload.revision; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SyncListContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the syncListItems. */ syncListItems() { return this._proxy.syncListItems; } /** * Access the syncListPermissions. */ syncListPermissions() { return this._proxy.syncListPermissions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, serviceSid: this.serviceSid, url: this.url, links: this.links, revision: this.revision, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListInstance = SyncListInstance; function SyncListListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SyncListContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Lists`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListPage(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 SyncListPage(instance._version, payload, 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; } exports.SyncListListInstance = SyncListListInstance; class SyncListPage extends Page_1.default { /** * Initialize the SyncListPage * * @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 SyncListInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncListInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListPage = SyncListPage; rest/preview/sync/service/syncMap.d.ts000064400000023276151677225100014042 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import Sync from "../../Sync"; import { SyncMapItemListInstance } from "./syncMap/syncMapItem"; import { SyncMapPermissionListInstance } from "./syncMap/syncMapPermission"; /** * Options to pass to create a SyncMapInstance */ export interface SyncMapListInstanceCreateOptions { /** */ uniqueName?: string; } /** * Options to pass to each */ export interface SyncMapListInstanceEachOptions { /** 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: SyncMapInstance, 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 SyncMapListInstanceOptions { /** 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 SyncMapListInstancePageOptions { /** 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 SyncMapContext { syncMapItems: SyncMapItemListInstance; syncMapPermissions: SyncMapPermissionListInstance; /** * Remove a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ fetch(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncMapContextSolution { serviceSid: string; sid: string; } export declare class SyncMapContextImpl implements SyncMapContext { protected _version: Sync; protected _solution: SyncMapContextSolution; protected _uri: string; protected _syncMapItems?: SyncMapItemListInstance; protected _syncMapPermissions?: SyncMapPermissionListInstance; constructor(_version: Sync, serviceSid: string, sid: string); get syncMapItems(): SyncMapItemListInstance; get syncMapPermissions(): SyncMapPermissionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncMapContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncMapPayload extends TwilioResponsePayload { maps: SyncMapResource[]; } interface SyncMapResource { sid: string; unique_name: string; account_sid: string; service_sid: string; url: string; links: Record<string, string>; revision: string; date_created: Date; date_updated: Date; created_by: string; } export declare class SyncMapInstance { protected _version: Sync; protected _solution: SyncMapContextSolution; protected _context?: SyncMapContext; constructor(_version: Sync, payload: SyncMapResource, serviceSid: string, sid?: string); sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; revision: string; dateCreated: Date; dateUpdated: Date; createdBy: string; private get _proxy(); /** * Remove a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ fetch(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Access the syncMapItems. */ syncMapItems(): SyncMapItemListInstance; /** * Access the syncMapPermissions. */ syncMapPermissions(): SyncMapPermissionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; revision: string; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncMapSolution { serviceSid: string; } export interface SyncMapListInstance { _version: Sync; _solution: SyncMapSolution; _uri: string; (sid: string): SyncMapContext; get(sid: string): SyncMapContext; /** * Create a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ create(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Create a SyncMapInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ create(params: SyncMapListInstanceCreateOptions, callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Streams SyncMapInstance 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 { SyncMapListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncMapInstance, done: (err?: Error) => void) => void): void; each(params: SyncMapListInstanceEachOptions, callback?: (item: SyncMapInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncMapInstance 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: SyncMapPage) => any): Promise<SyncMapPage>; /** * Lists SyncMapInstance 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 { SyncMapListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncMapInstance[]) => any): Promise<SyncMapInstance[]>; list(params: SyncMapListInstanceOptions, callback?: (error: Error | null, items: SyncMapInstance[]) => any): Promise<SyncMapInstance[]>; /** * Retrieve a single page of SyncMapInstance 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 { SyncMapListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncMapPage) => any): Promise<SyncMapPage>; page(params: SyncMapListInstancePageOptions, callback?: (error: Error | null, items: SyncMapPage) => any): Promise<SyncMapPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncMapListInstance(version: Sync, serviceSid: string): SyncMapListInstance; export declare class SyncMapPage extends Page<Sync, SyncMapPayload, SyncMapResource, SyncMapInstance> { /** * Initialize the SyncMapPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Sync, response: Response<string>, solution: SyncMapSolution); /** * Build an instance of SyncMapInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncMapResource): SyncMapInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service/syncList.d.ts000064400000023445151677225100014236 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import Sync from "../../Sync"; import { SyncListItemListInstance } from "./syncList/syncListItem"; import { SyncListPermissionListInstance } from "./syncList/syncListPermission"; /** * Options to pass to create a SyncListInstance */ export interface SyncListListInstanceCreateOptions { /** */ uniqueName?: string; } /** * Options to pass to each */ export interface SyncListListInstanceEachOptions { /** 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: SyncListInstance, 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 SyncListListInstanceOptions { /** 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 SyncListListInstancePageOptions { /** 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 SyncListContext { syncListItems: SyncListItemListInstance; syncListPermissions: SyncListPermissionListInstance; /** * Remove a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ fetch(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncListContextSolution { serviceSid: string; sid: string; } export declare class SyncListContextImpl implements SyncListContext { protected _version: Sync; protected _solution: SyncListContextSolution; protected _uri: string; protected _syncListItems?: SyncListItemListInstance; protected _syncListPermissions?: SyncListPermissionListInstance; constructor(_version: Sync, serviceSid: string, sid: string); get syncListItems(): SyncListItemListInstance; get syncListPermissions(): SyncListPermissionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncListContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncListPayload extends TwilioResponsePayload { lists: SyncListResource[]; } interface SyncListResource { sid: string; unique_name: string; account_sid: string; service_sid: string; url: string; links: Record<string, string>; revision: string; date_created: Date; date_updated: Date; created_by: string; } export declare class SyncListInstance { protected _version: Sync; protected _solution: SyncListContextSolution; protected _context?: SyncListContext; constructor(_version: Sync, payload: SyncListResource, serviceSid: string, sid?: string); sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; revision: string; dateCreated: Date; dateUpdated: Date; createdBy: string; private get _proxy(); /** * Remove a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ fetch(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Access the syncListItems. */ syncListItems(): SyncListItemListInstance; /** * Access the syncListPermissions. */ syncListPermissions(): SyncListPermissionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; revision: string; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncListSolution { serviceSid: string; } export interface SyncListListInstance { _version: Sync; _solution: SyncListSolution; _uri: string; (sid: string): SyncListContext; get(sid: string): SyncListContext; /** * Create a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ create(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Create a SyncListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ create(params: SyncListListInstanceCreateOptions, callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Streams SyncListInstance 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 { SyncListListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncListInstance, done: (err?: Error) => void) => void): void; each(params: SyncListListInstanceEachOptions, callback?: (item: SyncListInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncListInstance 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: SyncListPage) => any): Promise<SyncListPage>; /** * Lists SyncListInstance 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 { SyncListListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncListInstance[]) => any): Promise<SyncListInstance[]>; list(params: SyncListListInstanceOptions, callback?: (error: Error | null, items: SyncListInstance[]) => any): Promise<SyncListInstance[]>; /** * Retrieve a single page of SyncListInstance 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 { SyncListListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncListPage) => any): Promise<SyncListPage>; page(params: SyncListListInstancePageOptions, callback?: (error: Error | null, items: SyncListPage) => any): Promise<SyncListPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncListListInstance(version: Sync, serviceSid: string): SyncListListInstance; export declare class SyncListPage extends Page<Sync, SyncListPayload, SyncListResource, SyncListInstance> { /** * Initialize the SyncListPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Sync, response: Response<string>, solution: SyncListSolution); /** * Build an instance of SyncListInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncListResource): SyncListInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service/syncList/syncListItem.d.ts000064400000027433151677225100016666 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import Sync from "../../../Sync"; export type SyncListItemQueryFromBoundType = "inclusive" | "exclusive"; export type SyncListItemQueryResultOrder = "asc" | "desc"; /** * Options to pass to remove a SyncListItemInstance */ export interface SyncListItemContextRemoveOptions { /** The If-Match HTTP request header */ ifMatch?: string; } /** * Options to pass to update a SyncListItemInstance */ export interface SyncListItemContextUpdateOptions { /** */ data: any; /** The If-Match HTTP request header */ ifMatch?: string; } /** * Options to pass to create a SyncListItemInstance */ export interface SyncListItemListInstanceCreateOptions { /** */ data: any; } /** * Options to pass to each */ export interface SyncListItemListInstanceEachOptions { /** */ order?: SyncListItemQueryResultOrder; /** */ from?: string; /** */ bounds?: SyncListItemQueryFromBoundType; /** 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: SyncListItemInstance, 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 SyncListItemListInstanceOptions { /** */ order?: SyncListItemQueryResultOrder; /** */ from?: string; /** */ bounds?: SyncListItemQueryFromBoundType; /** 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 SyncListItemListInstancePageOptions { /** */ order?: SyncListItemQueryResultOrder; /** */ from?: string; /** */ bounds?: SyncListItemQueryFromBoundType; /** 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 SyncListItemContext { /** * Remove a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ remove(params: SyncListItemContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ fetch(callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Update a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ update(params: SyncListItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncListItemContextSolution { serviceSid: string; listSid: string; index: number; } export declare class SyncListItemContextImpl implements SyncListItemContext { protected _version: Sync; protected _solution: SyncListItemContextSolution; protected _uri: string; constructor(_version: Sync, serviceSid: string, listSid: string, index: number); remove(params?: SyncListItemContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; update(params: SyncListItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncListItemContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncListItemPayload extends TwilioResponsePayload { items: SyncListItemResource[]; } interface SyncListItemResource { index: number; account_sid: string; service_sid: string; list_sid: string; url: string; revision: string; data: any; date_created: Date; date_updated: Date; created_by: string; } export declare class SyncListItemInstance { protected _version: Sync; protected _solution: SyncListItemContextSolution; protected _context?: SyncListItemContext; constructor(_version: Sync, payload: SyncListItemResource, serviceSid: string, listSid: string, index?: number); index: number; accountSid: string; serviceSid: string; listSid: string; url: string; revision: string; data: any; dateCreated: Date; dateUpdated: Date; createdBy: string; private get _proxy(); /** * Remove a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ remove(params: SyncListItemContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ fetch(callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Update a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ update(params: SyncListItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { index: number; accountSid: string; serviceSid: string; listSid: string; url: string; revision: string; data: any; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncListItemSolution { serviceSid: string; listSid: string; } export interface SyncListItemListInstance { _version: Sync; _solution: SyncListItemSolution; _uri: string; (index: number): SyncListItemContext; get(index: number): SyncListItemContext; /** * Create a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ create(params: SyncListItemListInstanceCreateOptions, callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Streams SyncListItemInstance 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 { SyncListItemListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncListItemInstance, done: (err?: Error) => void) => void): void; each(params: SyncListItemListInstanceEachOptions, callback?: (item: SyncListItemInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncListItemInstance 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: SyncListItemPage) => any): Promise<SyncListItemPage>; /** * Lists SyncListItemInstance 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 { SyncListItemListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncListItemInstance[]) => any): Promise<SyncListItemInstance[]>; list(params: SyncListItemListInstanceOptions, callback?: (error: Error | null, items: SyncListItemInstance[]) => any): Promise<SyncListItemInstance[]>; /** * Retrieve a single page of SyncListItemInstance 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 { SyncListItemListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncListItemPage) => any): Promise<SyncListItemPage>; page(params: SyncListItemListInstancePageOptions, callback?: (error: Error | null, items: SyncListItemPage) => any): Promise<SyncListItemPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncListItemListInstance(version: Sync, serviceSid: string, listSid: string): SyncListItemListInstance; export declare class SyncListItemPage extends Page<Sync, SyncListItemPayload, SyncListItemResource, SyncListItemInstance> { /** * Initialize the SyncListItemPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Sync, response: Response<string>, solution: SyncListItemSolution); /** * Build an instance of SyncListItemInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncListItemResource): SyncListItemInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service/syncList/syncListItem.js000064400000025743151677225100016434 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SyncListItemPage = exports.SyncListItemListInstance = exports.SyncListItemInstance = exports.SyncListItemContextImpl = void 0; 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 SyncListItemContextImpl { constructor(_version, serviceSid, listSid, index) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(listSid)) { throw new Error("Parameter 'listSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(index)) { throw new Error("Parameter 'index' is not valid."); } this._solution = { serviceSid, listSid, index }; this._uri = `/Services/${serviceSid}/Lists/${listSid}/Items/${index}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncListItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid, instance._solution.index)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["data"] === null || params["data"] === undefined) { throw new Error("Required parameter \"params['data']\" missing."); } let data = {}; data["Data"] = serialize.object(params["data"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid, instance._solution.index)); 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.SyncListItemContextImpl = SyncListItemContextImpl; class SyncListItemInstance { constructor(_version, payload, serviceSid, listSid, index) { this._version = _version; this.index = deserialize.integer(payload.index); this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.listSid = payload.list_sid; this.url = payload.url; this.revision = payload.revision; this.data = payload.data; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, listSid, index: index || this.index }; } get _proxy() { this._context = this._context || new SyncListItemContextImpl(this._version, this._solution.serviceSid, this._solution.listSid, this._solution.index); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { index: this.index, accountSid: this.accountSid, serviceSid: this.serviceSid, listSid: this.listSid, url: this.url, revision: this.revision, data: this.data, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListItemInstance = SyncListItemInstance; function SyncListItemListInstance(version, serviceSid, listSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(listSid)) { throw new Error("Parameter 'listSid' is not valid."); } const instance = ((index) => instance.get(index)); instance.get = function get(index) { return new SyncListItemContextImpl(version, serviceSid, listSid, index); }; instance._version = version; instance._solution = { serviceSid, listSid }; instance._uri = `/Services/${serviceSid}/Lists/${listSid}/Items`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["data"] === null || params["data"] === undefined) { throw new Error("Required parameter \"params['data']\" missing."); } let data = {}; data["Data"] = serialize.object(params["data"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid)); 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["order"] !== undefined) data["Order"] = params["order"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["bounds"] !== undefined) data["Bounds"] = params["bounds"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListItemPage(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 SyncListItemPage(instance._version, payload, 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; } exports.SyncListItemListInstance = SyncListItemListInstance; class SyncListItemPage extends Page_1.default { /** * Initialize the SyncListItemPage * * @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 SyncListItemInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncListItemInstance(this._version, payload, this._solution.serviceSid, this._solution.listSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListItemPage = SyncListItemPage; rest/preview/sync/service/syncList/syncListPermission.d.ts000064400000026147151677225100020121 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import Sync from "../../../Sync"; /** * Options to pass to update a SyncListPermissionInstance */ export interface SyncListPermissionContextUpdateOptions { /** Boolean flag specifying whether the identity can read the Sync List. */ read: boolean; /** Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. */ write: boolean; /** Boolean flag specifying whether the identity can delete the Sync List. */ manage: boolean; } /** * Options to pass to each */ export interface SyncListPermissionListInstanceEachOptions { /** 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: SyncListPermissionInstance, 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 SyncListPermissionListInstanceOptions { /** 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 SyncListPermissionListInstancePageOptions { /** 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 SyncListPermissionContext { /** * Remove a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ fetch(callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Update a SyncListPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ update(params: SyncListPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncListPermissionContextSolution { serviceSid: string; listSid: string; identity: string; } export declare class SyncListPermissionContextImpl implements SyncListPermissionContext { protected _version: Sync; protected _solution: SyncListPermissionContextSolution; protected _uri: string; constructor(_version: Sync, serviceSid: string, listSid: string, identity: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; update(params: SyncListPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncListPermissionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncListPermissionPayload extends TwilioResponsePayload { permissions: SyncListPermissionResource[]; } interface SyncListPermissionResource { account_sid: string; service_sid: string; list_sid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; } export declare class SyncListPermissionInstance { protected _version: Sync; protected _solution: SyncListPermissionContextSolution; protected _context?: SyncListPermissionContext; constructor(_version: Sync, payload: SyncListPermissionResource, serviceSid: string, listSid: string, identity?: string); /** * The unique SID identifier of the Twilio Account. */ accountSid: string; /** * The unique SID identifier of the Sync Service Instance. */ serviceSid: string; /** * The unique SID identifier of the Sync List to which the Permission applies. */ listSid: string; /** * Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. */ identity: string; /** * Boolean flag specifying whether the identity can read the Sync List and its Items. */ read: boolean; /** * Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. */ write: boolean; /** * Boolean flag specifying whether the identity can delete the Sync List. */ manage: boolean; /** * Contains an absolute URL for this Sync List Permission. */ url: string; private get _proxy(); /** * Remove a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ fetch(callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Update a SyncListPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ update(params: SyncListPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; listSid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncListPermissionSolution { serviceSid: string; listSid: string; } export interface SyncListPermissionListInstance { _version: Sync; _solution: SyncListPermissionSolution; _uri: string; (identity: string): SyncListPermissionContext; get(identity: string): SyncListPermissionContext; /** * Streams SyncListPermissionInstance 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 { SyncListPermissionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncListPermissionInstance, done: (err?: Error) => void) => void): void; each(params: SyncListPermissionListInstanceEachOptions, callback?: (item: SyncListPermissionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncListPermissionInstance 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: SyncListPermissionPage) => any): Promise<SyncListPermissionPage>; /** * Lists SyncListPermissionInstance 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 { SyncListPermissionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncListPermissionInstance[]) => any): Promise<SyncListPermissionInstance[]>; list(params: SyncListPermissionListInstanceOptions, callback?: (error: Error | null, items: SyncListPermissionInstance[]) => any): Promise<SyncListPermissionInstance[]>; /** * Retrieve a single page of SyncListPermissionInstance 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 { SyncListPermissionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncListPermissionPage) => any): Promise<SyncListPermissionPage>; page(params: SyncListPermissionListInstancePageOptions, callback?: (error: Error | null, items: SyncListPermissionPage) => any): Promise<SyncListPermissionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncListPermissionListInstance(version: Sync, serviceSid: string, listSid: string): SyncListPermissionListInstance; export declare class SyncListPermissionPage extends Page<Sync, SyncListPermissionPayload, SyncListPermissionResource, SyncListPermissionInstance> { /** * Initialize the SyncListPermissionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Sync, response: Response<string>, solution: SyncListPermissionSolution); /** * Build an instance of SyncListPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncListPermissionResource): SyncListPermissionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service/syncList/syncListPermission.js000064400000023520151677225100017655 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SyncListPermissionPage = exports.SyncListPermissionListInstance = exports.SyncListPermissionInstance = exports.SyncListPermissionContextImpl = void 0; 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 SyncListPermissionContextImpl { constructor(_version, serviceSid, listSid, identity) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(listSid)) { throw new Error("Parameter 'listSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } this._solution = { serviceSid, listSid, identity }; this._uri = `/Services/${serviceSid}/Lists/${listSid}/Permissions/${identity}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncListPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid, instance._solution.identity)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["read"] === null || params["read"] === undefined) { throw new Error("Required parameter \"params['read']\" missing."); } if (params["write"] === null || params["write"] === undefined) { throw new Error("Required parameter \"params['write']\" missing."); } if (params["manage"] === null || params["manage"] === undefined) { throw new Error("Required parameter \"params['manage']\" missing."); } let data = {}; data["Read"] = serialize.bool(params["read"]); data["Write"] = serialize.bool(params["write"]); data["Manage"] = serialize.bool(params["manage"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid, instance._solution.identity)); 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.SyncListPermissionContextImpl = SyncListPermissionContextImpl; class SyncListPermissionInstance { constructor(_version, payload, serviceSid, listSid, identity) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.listSid = payload.list_sid; this.identity = payload.identity; this.read = payload.read; this.write = payload.write; this.manage = payload.manage; this.url = payload.url; this._solution = { serviceSid, listSid, identity: identity || this.identity, }; } get _proxy() { this._context = this._context || new SyncListPermissionContextImpl(this._version, this._solution.serviceSid, this._solution.listSid, this._solution.identity); return this._context; } /** * Remove a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, listSid: this.listSid, identity: this.identity, read: this.read, write: this.write, manage: this.manage, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListPermissionInstance = SyncListPermissionInstance; function SyncListPermissionListInstance(version, serviceSid, listSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(listSid)) { throw new Error("Parameter 'listSid' is not valid."); } const instance = ((identity) => instance.get(identity)); instance.get = function get(identity) { return new SyncListPermissionContextImpl(version, serviceSid, listSid, identity); }; instance._version = version; instance._solution = { serviceSid, listSid }; instance._uri = `/Services/${serviceSid}/Lists/${listSid}/Permissions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListPermissionPage(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 SyncListPermissionPage(instance._version, payload, 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; } exports.SyncListPermissionListInstance = SyncListPermissionListInstance; class SyncListPermissionPage extends Page_1.default { /** * Initialize the SyncListPermissionPage * * @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 SyncListPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncListPermissionInstance(this._version, payload, this._solution.serviceSid, this._solution.listSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListPermissionPage = SyncListPermissionPage; rest/preview/sync/service/document/documentPermission.js000064400000023654151677225100017701 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DocumentPermissionPage = exports.DocumentPermissionListInstance = exports.DocumentPermissionInstance = exports.DocumentPermissionContextImpl = void 0; 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 DocumentPermissionContextImpl { constructor(_version, serviceSid, documentSid, identity) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(documentSid)) { throw new Error("Parameter 'documentSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } this._solution = { serviceSid, documentSid, identity }; this._uri = `/Services/${serviceSid}/Documents/${documentSid}/Permissions/${identity}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DocumentPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.documentSid, instance._solution.identity)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["read"] === null || params["read"] === undefined) { throw new Error("Required parameter \"params['read']\" missing."); } if (params["write"] === null || params["write"] === undefined) { throw new Error("Required parameter \"params['write']\" missing."); } if (params["manage"] === null || params["manage"] === undefined) { throw new Error("Required parameter \"params['manage']\" missing."); } let data = {}; data["Read"] = serialize.bool(params["read"]); data["Write"] = serialize.bool(params["write"]); data["Manage"] = serialize.bool(params["manage"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.documentSid, instance._solution.identity)); 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.DocumentPermissionContextImpl = DocumentPermissionContextImpl; class DocumentPermissionInstance { constructor(_version, payload, serviceSid, documentSid, identity) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.documentSid = payload.document_sid; this.identity = payload.identity; this.read = payload.read; this.write = payload.write; this.manage = payload.manage; this.url = payload.url; this._solution = { serviceSid, documentSid, identity: identity || this.identity, }; } get _proxy() { this._context = this._context || new DocumentPermissionContextImpl(this._version, this._solution.serviceSid, this._solution.documentSid, this._solution.identity); return this._context; } /** * Remove a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, documentSid: this.documentSid, identity: this.identity, read: this.read, write: this.write, manage: this.manage, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DocumentPermissionInstance = DocumentPermissionInstance; function DocumentPermissionListInstance(version, serviceSid, documentSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(documentSid)) { throw new Error("Parameter 'documentSid' is not valid."); } const instance = ((identity) => instance.get(identity)); instance.get = function get(identity) { return new DocumentPermissionContextImpl(version, serviceSid, documentSid, identity); }; instance._version = version; instance._solution = { serviceSid, documentSid }; instance._uri = `/Services/${serviceSid}/Documents/${documentSid}/Permissions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentPermissionPage(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 DocumentPermissionPage(instance._version, payload, 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; } exports.DocumentPermissionListInstance = DocumentPermissionListInstance; class DocumentPermissionPage extends Page_1.default { /** * Initialize the DocumentPermissionPage * * @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 DocumentPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DocumentPermissionInstance(this._version, payload, this._solution.serviceSid, this._solution.documentSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DocumentPermissionPage = DocumentPermissionPage; rest/preview/sync/service/document/documentPermission.d.ts000064400000026141151677225100020127 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import Sync from "../../../Sync"; /** * Options to pass to update a DocumentPermissionInstance */ export interface DocumentPermissionContextUpdateOptions { /** Boolean flag specifying whether the identity can read the Sync Document. */ read: boolean; /** Boolean flag specifying whether the identity can update the Sync Document. */ write: boolean; /** Boolean flag specifying whether the identity can delete the Sync Document. */ manage: boolean; } /** * Options to pass to each */ export interface DocumentPermissionListInstanceEachOptions { /** 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: DocumentPermissionInstance, 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 DocumentPermissionListInstanceOptions { /** 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 DocumentPermissionListInstancePageOptions { /** 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 DocumentPermissionContext { /** * Remove a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ fetch(callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Update a DocumentPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ update(params: DocumentPermissionContextUpdateOptions, callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DocumentPermissionContextSolution { serviceSid: string; documentSid: string; identity: string; } export declare class DocumentPermissionContextImpl implements DocumentPermissionContext { protected _version: Sync; protected _solution: DocumentPermissionContextSolution; protected _uri: string; constructor(_version: Sync, serviceSid: string, documentSid: string, identity: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; update(params: DocumentPermissionContextUpdateOptions, callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DocumentPermissionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DocumentPermissionPayload extends TwilioResponsePayload { permissions: DocumentPermissionResource[]; } interface DocumentPermissionResource { account_sid: string; service_sid: string; document_sid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; } export declare class DocumentPermissionInstance { protected _version: Sync; protected _solution: DocumentPermissionContextSolution; protected _context?: DocumentPermissionContext; constructor(_version: Sync, payload: DocumentPermissionResource, serviceSid: string, documentSid: string, identity?: string); /** * The unique SID identifier of the Twilio Account. */ accountSid: string; /** * The unique SID identifier of the Sync Service Instance. */ serviceSid: string; /** * The unique SID identifier of the Sync Document to which the Permission applies. */ documentSid: string; /** * Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. */ identity: string; /** * Boolean flag specifying whether the identity can read the Sync Document. */ read: boolean; /** * Boolean flag specifying whether the identity can update the Sync Document. */ write: boolean; /** * Boolean flag specifying whether the identity can delete the Sync Document. */ manage: boolean; /** * Contains an absolute URL for this Sync Document Permission. */ url: string; private get _proxy(); /** * Remove a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ fetch(callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Update a DocumentPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ update(params: DocumentPermissionContextUpdateOptions, callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; documentSid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DocumentPermissionSolution { serviceSid: string; documentSid: string; } export interface DocumentPermissionListInstance { _version: Sync; _solution: DocumentPermissionSolution; _uri: string; (identity: string): DocumentPermissionContext; get(identity: string): DocumentPermissionContext; /** * Streams DocumentPermissionInstance 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 { DocumentPermissionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DocumentPermissionInstance, done: (err?: Error) => void) => void): void; each(params: DocumentPermissionListInstanceEachOptions, callback?: (item: DocumentPermissionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DocumentPermissionInstance 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: DocumentPermissionPage) => any): Promise<DocumentPermissionPage>; /** * Lists DocumentPermissionInstance 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 { DocumentPermissionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DocumentPermissionInstance[]) => any): Promise<DocumentPermissionInstance[]>; list(params: DocumentPermissionListInstanceOptions, callback?: (error: Error | null, items: DocumentPermissionInstance[]) => any): Promise<DocumentPermissionInstance[]>; /** * Retrieve a single page of DocumentPermissionInstance 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 { DocumentPermissionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DocumentPermissionPage) => any): Promise<DocumentPermissionPage>; page(params: DocumentPermissionListInstancePageOptions, callback?: (error: Error | null, items: DocumentPermissionPage) => any): Promise<DocumentPermissionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DocumentPermissionListInstance(version: Sync, serviceSid: string, documentSid: string): DocumentPermissionListInstance; export declare class DocumentPermissionPage extends Page<Sync, DocumentPermissionPayload, DocumentPermissionResource, DocumentPermissionInstance> { /** * Initialize the DocumentPermissionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Sync, response: Response<string>, solution: DocumentPermissionSolution); /** * Build an instance of DocumentPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload: DocumentPermissionResource): DocumentPermissionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service/document.d.ts000064400000025155151677225100014244 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import Sync from "../../Sync"; import { DocumentPermissionListInstance } from "./document/documentPermission"; /** * Options to pass to update a DocumentInstance */ export interface DocumentContextUpdateOptions { /** */ data: any; /** The If-Match HTTP request header */ ifMatch?: string; } /** * Options to pass to create a DocumentInstance */ export interface DocumentListInstanceCreateOptions { /** */ uniqueName?: string; /** */ data?: any; } /** * Options to pass to each */ export interface DocumentListInstanceEachOptions { /** 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: DocumentInstance, 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 DocumentListInstanceOptions { /** 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 DocumentListInstancePageOptions { /** 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 DocumentContext { documentPermissions: DocumentPermissionListInstance; /** * Remove a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ fetch(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Update a DocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ update(params: DocumentContextUpdateOptions, callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DocumentContextSolution { serviceSid: string; sid: string; } export declare class DocumentContextImpl implements DocumentContext { protected _version: Sync; protected _solution: DocumentContextSolution; protected _uri: string; protected _documentPermissions?: DocumentPermissionListInstance; constructor(_version: Sync, serviceSid: string, sid: string); get documentPermissions(): DocumentPermissionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; update(params: DocumentContextUpdateOptions, callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DocumentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DocumentPayload extends TwilioResponsePayload { documents: DocumentResource[]; } interface DocumentResource { sid: string; unique_name: string; account_sid: string; service_sid: string; url: string; links: Record<string, string>; revision: string; data: any; date_created: Date; date_updated: Date; created_by: string; } export declare class DocumentInstance { protected _version: Sync; protected _solution: DocumentContextSolution; protected _context?: DocumentContext; constructor(_version: Sync, payload: DocumentResource, serviceSid: string, sid?: string); sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; revision: string; data: any; dateCreated: Date; dateUpdated: Date; createdBy: string; private get _proxy(); /** * Remove a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ fetch(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Update a DocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ update(params: DocumentContextUpdateOptions, callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Access the documentPermissions. */ documentPermissions(): DocumentPermissionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; revision: string; data: any; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DocumentSolution { serviceSid: string; } export interface DocumentListInstance { _version: Sync; _solution: DocumentSolution; _uri: string; (sid: string): DocumentContext; get(sid: string): DocumentContext; /** * Create a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ create(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Create a DocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ create(params: DocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Streams DocumentInstance 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 { DocumentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DocumentInstance, done: (err?: Error) => void) => void): void; each(params: DocumentListInstanceEachOptions, callback?: (item: DocumentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DocumentInstance 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: DocumentPage) => any): Promise<DocumentPage>; /** * Lists DocumentInstance 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 { DocumentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DocumentInstance[]) => any): Promise<DocumentInstance[]>; list(params: DocumentListInstanceOptions, callback?: (error: Error | null, items: DocumentInstance[]) => any): Promise<DocumentInstance[]>; /** * Retrieve a single page of DocumentInstance 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 { DocumentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DocumentPage) => any): Promise<DocumentPage>; page(params: DocumentListInstancePageOptions, callback?: (error: Error | null, items: DocumentPage) => any): Promise<DocumentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DocumentListInstance(version: Sync, serviceSid: string): DocumentListInstance; export declare class DocumentPage extends Page<Sync, DocumentPayload, DocumentResource, DocumentInstance> { /** * Initialize the DocumentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Sync, response: Response<string>, solution: DocumentSolution); /** * Build an instance of DocumentInstance * * @param payload - Payload response from the API */ getInstance(payload: DocumentResource): DocumentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service/syncMap/syncMapPermission.d.ts000064400000026005151677225100017516 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import Sync from "../../../Sync"; /** * Options to pass to update a SyncMapPermissionInstance */ export interface SyncMapPermissionContextUpdateOptions { /** Boolean flag specifying whether the identity can read the Sync Map. */ read: boolean; /** Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. */ write: boolean; /** Boolean flag specifying whether the identity can delete the Sync Map. */ manage: boolean; } /** * Options to pass to each */ export interface SyncMapPermissionListInstanceEachOptions { /** 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: SyncMapPermissionInstance, 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 SyncMapPermissionListInstanceOptions { /** 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 SyncMapPermissionListInstancePageOptions { /** 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 SyncMapPermissionContext { /** * Remove a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ fetch(callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Update a SyncMapPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ update(params: SyncMapPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncMapPermissionContextSolution { serviceSid: string; mapSid: string; identity: string; } export declare class SyncMapPermissionContextImpl implements SyncMapPermissionContext { protected _version: Sync; protected _solution: SyncMapPermissionContextSolution; protected _uri: string; constructor(_version: Sync, serviceSid: string, mapSid: string, identity: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; update(params: SyncMapPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncMapPermissionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncMapPermissionPayload extends TwilioResponsePayload { permissions: SyncMapPermissionResource[]; } interface SyncMapPermissionResource { account_sid: string; service_sid: string; map_sid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; } export declare class SyncMapPermissionInstance { protected _version: Sync; protected _solution: SyncMapPermissionContextSolution; protected _context?: SyncMapPermissionContext; constructor(_version: Sync, payload: SyncMapPermissionResource, serviceSid: string, mapSid: string, identity?: string); /** * The unique SID identifier of the Twilio Account. */ accountSid: string; /** * The unique SID identifier of the Sync Service Instance. */ serviceSid: string; /** * The unique SID identifier of the Sync Map to which the Permission applies. */ mapSid: string; /** * Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. */ identity: string; /** * Boolean flag specifying whether the identity can read the Sync Map and its Items. */ read: boolean; /** * Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. */ write: boolean; /** * Boolean flag specifying whether the identity can delete the Sync Map. */ manage: boolean; /** * Contains an absolute URL for this Sync Map Permission. */ url: string; private get _proxy(); /** * Remove a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ fetch(callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Update a SyncMapPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ update(params: SyncMapPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; mapSid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncMapPermissionSolution { serviceSid: string; mapSid: string; } export interface SyncMapPermissionListInstance { _version: Sync; _solution: SyncMapPermissionSolution; _uri: string; (identity: string): SyncMapPermissionContext; get(identity: string): SyncMapPermissionContext; /** * Streams SyncMapPermissionInstance 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 { SyncMapPermissionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncMapPermissionInstance, done: (err?: Error) => void) => void): void; each(params: SyncMapPermissionListInstanceEachOptions, callback?: (item: SyncMapPermissionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncMapPermissionInstance 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: SyncMapPermissionPage) => any): Promise<SyncMapPermissionPage>; /** * Lists SyncMapPermissionInstance 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 { SyncMapPermissionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncMapPermissionInstance[]) => any): Promise<SyncMapPermissionInstance[]>; list(params: SyncMapPermissionListInstanceOptions, callback?: (error: Error | null, items: SyncMapPermissionInstance[]) => any): Promise<SyncMapPermissionInstance[]>; /** * Retrieve a single page of SyncMapPermissionInstance 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 { SyncMapPermissionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncMapPermissionPage) => any): Promise<SyncMapPermissionPage>; page(params: SyncMapPermissionListInstancePageOptions, callback?: (error: Error | null, items: SyncMapPermissionPage) => any): Promise<SyncMapPermissionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncMapPermissionListInstance(version: Sync, serviceSid: string, mapSid: string): SyncMapPermissionListInstance; export declare class SyncMapPermissionPage extends Page<Sync, SyncMapPermissionPayload, SyncMapPermissionResource, SyncMapPermissionInstance> { /** * Initialize the SyncMapPermissionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Sync, response: Response<string>, solution: SyncMapPermissionSolution); /** * Build an instance of SyncMapPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncMapPermissionResource): SyncMapPermissionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service/syncMap/syncMapPermission.js000064400000023435151677225100017266 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SyncMapPermissionPage = exports.SyncMapPermissionListInstance = exports.SyncMapPermissionInstance = exports.SyncMapPermissionContextImpl = void 0; 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 SyncMapPermissionContextImpl { constructor(_version, serviceSid, mapSid, identity) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(mapSid)) { throw new Error("Parameter 'mapSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } this._solution = { serviceSid, mapSid, identity }; this._uri = `/Services/${serviceSid}/Maps/${mapSid}/Permissions/${identity}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncMapPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid, instance._solution.identity)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["read"] === null || params["read"] === undefined) { throw new Error("Required parameter \"params['read']\" missing."); } if (params["write"] === null || params["write"] === undefined) { throw new Error("Required parameter \"params['write']\" missing."); } if (params["manage"] === null || params["manage"] === undefined) { throw new Error("Required parameter \"params['manage']\" missing."); } let data = {}; data["Read"] = serialize.bool(params["read"]); data["Write"] = serialize.bool(params["write"]); data["Manage"] = serialize.bool(params["manage"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid, instance._solution.identity)); 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.SyncMapPermissionContextImpl = SyncMapPermissionContextImpl; class SyncMapPermissionInstance { constructor(_version, payload, serviceSid, mapSid, identity) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.mapSid = payload.map_sid; this.identity = payload.identity; this.read = payload.read; this.write = payload.write; this.manage = payload.manage; this.url = payload.url; this._solution = { serviceSid, mapSid, identity: identity || this.identity, }; } get _proxy() { this._context = this._context || new SyncMapPermissionContextImpl(this._version, this._solution.serviceSid, this._solution.mapSid, this._solution.identity); return this._context; } /** * Remove a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, mapSid: this.mapSid, identity: this.identity, read: this.read, write: this.write, manage: this.manage, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapPermissionInstance = SyncMapPermissionInstance; function SyncMapPermissionListInstance(version, serviceSid, mapSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(mapSid)) { throw new Error("Parameter 'mapSid' is not valid."); } const instance = ((identity) => instance.get(identity)); instance.get = function get(identity) { return new SyncMapPermissionContextImpl(version, serviceSid, mapSid, identity); }; instance._version = version; instance._solution = { serviceSid, mapSid }; instance._uri = `/Services/${serviceSid}/Maps/${mapSid}/Permissions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapPermissionPage(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 SyncMapPermissionPage(instance._version, payload, 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; } exports.SyncMapPermissionListInstance = SyncMapPermissionListInstance; class SyncMapPermissionPage extends Page_1.default { /** * Initialize the SyncMapPermissionPage * * @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 SyncMapPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncMapPermissionInstance(this._version, payload, this._solution.serviceSid, this._solution.mapSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapPermissionPage = SyncMapPermissionPage; rest/preview/sync/service/syncMap/syncMapItem.js000064400000026064151677225100016035 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SyncMapItemPage = exports.SyncMapItemListInstance = exports.SyncMapItemInstance = exports.SyncMapItemContextImpl = void 0; 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 SyncMapItemContextImpl { constructor(_version, serviceSid, mapSid, key) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(mapSid)) { throw new Error("Parameter 'mapSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(key)) { throw new Error("Parameter 'key' is not valid."); } this._solution = { serviceSid, mapSid, key }; this._uri = `/Services/${serviceSid}/Maps/${mapSid}/Items/${key}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncMapItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid, instance._solution.key)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["data"] === null || params["data"] === undefined) { throw new Error("Required parameter \"params['data']\" missing."); } let data = {}; data["Data"] = serialize.object(params["data"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid, instance._solution.key)); 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.SyncMapItemContextImpl = SyncMapItemContextImpl; class SyncMapItemInstance { constructor(_version, payload, serviceSid, mapSid, key) { this._version = _version; this.key = payload.key; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.mapSid = payload.map_sid; this.url = payload.url; this.revision = payload.revision; this.data = payload.data; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, mapSid, key: key || this.key }; } get _proxy() { this._context = this._context || new SyncMapItemContextImpl(this._version, this._solution.serviceSid, this._solution.mapSid, this._solution.key); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { key: this.key, accountSid: this.accountSid, serviceSid: this.serviceSid, mapSid: this.mapSid, url: this.url, revision: this.revision, data: this.data, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapItemInstance = SyncMapItemInstance; function SyncMapItemListInstance(version, serviceSid, mapSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(mapSid)) { throw new Error("Parameter 'mapSid' is not valid."); } const instance = ((key) => instance.get(key)); instance.get = function get(key) { return new SyncMapItemContextImpl(version, serviceSid, mapSid, key); }; instance._version = version; instance._solution = { serviceSid, mapSid }; instance._uri = `/Services/${serviceSid}/Maps/${mapSid}/Items`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["key"] === null || params["key"] === undefined) { throw new Error("Required parameter \"params['key']\" missing."); } if (params["data"] === null || params["data"] === undefined) { throw new Error("Required parameter \"params['data']\" missing."); } let data = {}; data["Key"] = params["key"]; data["Data"] = serialize.object(params["data"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid)); 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["order"] !== undefined) data["Order"] = params["order"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["bounds"] !== undefined) data["Bounds"] = params["bounds"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapItemPage(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 SyncMapItemPage(instance._version, payload, 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; } exports.SyncMapItemListInstance = SyncMapItemListInstance; class SyncMapItemPage extends Page_1.default { /** * Initialize the SyncMapItemPage * * @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 SyncMapItemInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncMapItemInstance(this._version, payload, this._solution.serviceSid, this._solution.mapSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapItemPage = SyncMapItemPage; rest/preview/sync/service/syncMap/syncMapItem.d.ts000064400000027266151677225100016276 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import Sync from "../../../Sync"; export type SyncMapItemQueryFromBoundType = "inclusive" | "exclusive"; export type SyncMapItemQueryResultOrder = "asc" | "desc"; /** * Options to pass to remove a SyncMapItemInstance */ export interface SyncMapItemContextRemoveOptions { /** The If-Match HTTP request header */ ifMatch?: string; } /** * Options to pass to update a SyncMapItemInstance */ export interface SyncMapItemContextUpdateOptions { /** */ data: any; /** The If-Match HTTP request header */ ifMatch?: string; } /** * Options to pass to create a SyncMapItemInstance */ export interface SyncMapItemListInstanceCreateOptions { /** */ key: string; /** */ data: any; } /** * Options to pass to each */ export interface SyncMapItemListInstanceEachOptions { /** */ order?: SyncMapItemQueryResultOrder; /** */ from?: string; /** */ bounds?: SyncMapItemQueryFromBoundType; /** 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: SyncMapItemInstance, 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 SyncMapItemListInstanceOptions { /** */ order?: SyncMapItemQueryResultOrder; /** */ from?: string; /** */ bounds?: SyncMapItemQueryFromBoundType; /** 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 SyncMapItemListInstancePageOptions { /** */ order?: SyncMapItemQueryResultOrder; /** */ from?: string; /** */ bounds?: SyncMapItemQueryFromBoundType; /** 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 SyncMapItemContext { /** * Remove a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ remove(params: SyncMapItemContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ fetch(callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Update a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ update(params: SyncMapItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncMapItemContextSolution { serviceSid: string; mapSid: string; key: string; } export declare class SyncMapItemContextImpl implements SyncMapItemContext { protected _version: Sync; protected _solution: SyncMapItemContextSolution; protected _uri: string; constructor(_version: Sync, serviceSid: string, mapSid: string, key: string); remove(params?: SyncMapItemContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; update(params: SyncMapItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncMapItemContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncMapItemPayload extends TwilioResponsePayload { items: SyncMapItemResource[]; } interface SyncMapItemResource { key: string; account_sid: string; service_sid: string; map_sid: string; url: string; revision: string; data: any; date_created: Date; date_updated: Date; created_by: string; } export declare class SyncMapItemInstance { protected _version: Sync; protected _solution: SyncMapItemContextSolution; protected _context?: SyncMapItemContext; constructor(_version: Sync, payload: SyncMapItemResource, serviceSid: string, mapSid: string, key?: string); key: string; accountSid: string; serviceSid: string; mapSid: string; url: string; revision: string; data: any; dateCreated: Date; dateUpdated: Date; createdBy: string; private get _proxy(); /** * Remove a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ remove(params: SyncMapItemContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ fetch(callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Update a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ update(params: SyncMapItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { key: string; accountSid: string; serviceSid: string; mapSid: string; url: string; revision: string; data: any; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncMapItemSolution { serviceSid: string; mapSid: string; } export interface SyncMapItemListInstance { _version: Sync; _solution: SyncMapItemSolution; _uri: string; (key: string): SyncMapItemContext; get(key: string): SyncMapItemContext; /** * Create a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ create(params: SyncMapItemListInstanceCreateOptions, callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Streams SyncMapItemInstance 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 { SyncMapItemListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncMapItemInstance, done: (err?: Error) => void) => void): void; each(params: SyncMapItemListInstanceEachOptions, callback?: (item: SyncMapItemInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncMapItemInstance 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: SyncMapItemPage) => any): Promise<SyncMapItemPage>; /** * Lists SyncMapItemInstance 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 { SyncMapItemListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncMapItemInstance[]) => any): Promise<SyncMapItemInstance[]>; list(params: SyncMapItemListInstanceOptions, callback?: (error: Error | null, items: SyncMapItemInstance[]) => any): Promise<SyncMapItemInstance[]>; /** * Retrieve a single page of SyncMapItemInstance 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 { SyncMapItemListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncMapItemPage) => any): Promise<SyncMapItemPage>; page(params: SyncMapItemListInstancePageOptions, callback?: (error: Error | null, items: SyncMapItemPage) => any): Promise<SyncMapItemPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncMapItemListInstance(version: Sync, serviceSid: string, mapSid: string): SyncMapItemListInstance; export declare class SyncMapItemPage extends Page<Sync, SyncMapItemPayload, SyncMapItemResource, SyncMapItemInstance> { /** * Initialize the SyncMapItemPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Sync, response: Response<string>, solution: SyncMapItemSolution); /** * Build an instance of SyncMapItemInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncMapItemResource): SyncMapItemInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/sync/service/syncMap.js000064400000022713151677225100013601 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SyncMapPage = exports.SyncMapListInstance = exports.SyncMapInstance = exports.SyncMapContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const syncMapItem_1 = require("./syncMap/syncMapItem"); const syncMapPermission_1 = require("./syncMap/syncMapPermission"); class SyncMapContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Maps/${sid}`; } get syncMapItems() { this._syncMapItems = this._syncMapItems || (0, syncMapItem_1.SyncMapItemListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._syncMapItems; } get syncMapPermissions() { this._syncMapPermissions = this._syncMapPermissions || (0, syncMapPermission_1.SyncMapPermissionListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._syncMapPermissions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncMapInstance(operationVersion, payload, instance._solution.serviceSid, 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.SyncMapContextImpl = SyncMapContextImpl; class SyncMapInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.url = payload.url; this.links = payload.links; this.revision = payload.revision; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SyncMapContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the syncMapItems. */ syncMapItems() { return this._proxy.syncMapItems; } /** * Access the syncMapPermissions. */ syncMapPermissions() { return this._proxy.syncMapPermissions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, serviceSid: this.serviceSid, url: this.url, links: this.links, revision: this.revision, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapInstance = SyncMapInstance; function SyncMapListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SyncMapContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Maps`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapPage(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 SyncMapPage(instance._version, payload, 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; } exports.SyncMapListInstance = SyncMapListInstance; class SyncMapPage extends Page_1.default { /** * Initialize the SyncMapPage * * @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 SyncMapInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncMapInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapPage = SyncMapPage; rest/preview/sync/service/document.js000064400000024710151677225100014004 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DocumentPage = exports.DocumentListInstance = exports.DocumentInstance = exports.DocumentContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const documentPermission_1 = require("./document/documentPermission"); class DocumentContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Documents/${sid}`; } get documentPermissions() { this._documentPermissions = this._documentPermissions || (0, documentPermission_1.DocumentPermissionListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._documentPermissions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DocumentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["data"] === null || params["data"] === undefined) { throw new Error("Required parameter \"params['data']\" missing."); } let data = {}; data["Data"] = serialize.object(params["data"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentInstance(operationVersion, payload, instance._solution.serviceSid, 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.DocumentContextImpl = DocumentContextImpl; class DocumentInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.url = payload.url; this.links = payload.links; this.revision = payload.revision; this.data = payload.data; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new DocumentContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the documentPermissions. */ documentPermissions() { return this._proxy.documentPermissions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, serviceSid: this.serviceSid, url: this.url, links: this.links, revision: this.revision, data: this.data, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DocumentInstance = DocumentInstance; function DocumentListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new DocumentContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Documents`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["data"] !== undefined) data["Data"] = serialize.object(params["data"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentPage(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 DocumentPage(instance._version, payload, 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; } exports.DocumentListInstance = DocumentListInstance; class DocumentPage extends Page_1.default { /** * Initialize the DocumentPage * * @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 DocumentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DocumentInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DocumentPage = DocumentPage; rest/preview/Marketplace.d.ts000064400000001721151677225100012233 0ustar00import PreviewBase from "../PreviewBase"; import Version from "../../base/Version"; import { AvailableAddOnListInstance } from "./marketplace/availableAddOn"; import { InstalledAddOnListInstance } from "./marketplace/installedAddOn"; export default class Marketplace extends Version { /** * Initialize the Marketplace version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain: PreviewBase); /** availableAddOns - { Twilio.Preview.Marketplace.AvailableAddOnListInstance } resource */ protected _availableAddOns?: AvailableAddOnListInstance; /** installedAddOns - { Twilio.Preview.Marketplace.InstalledAddOnListInstance } resource */ protected _installedAddOns?: InstalledAddOnListInstance; /** Getter for availableAddOns resource */ get availableAddOns(): AvailableAddOnListInstance; /** Getter for installedAddOns resource */ get installedAddOns(): InstalledAddOnListInstance; } rest/preview/HostedNumbers.d.ts000064400000002071151677225100012564 0ustar00import PreviewBase from "../PreviewBase"; import Version from "../../base/Version"; import { AuthorizationDocumentListInstance } from "./hosted_numbers/authorizationDocument"; import { HostedNumberOrderListInstance } from "./hosted_numbers/hostedNumberOrder"; export default class HostedNumbers extends Version { /** * Initialize the HostedNumbers version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain: PreviewBase); /** authorizationDocuments - { Twilio.Preview.HostedNumbers.AuthorizationDocumentListInstance } resource */ protected _authorizationDocuments?: AuthorizationDocumentListInstance; /** hostedNumberOrders - { Twilio.Preview.HostedNumbers.HostedNumberOrderListInstance } resource */ protected _hostedNumberOrders?: HostedNumberOrderListInstance; /** Getter for authorizationDocuments resource */ get authorizationDocuments(): AuthorizationDocumentListInstance; /** Getter for hostedNumberOrders resource */ get hostedNumberOrders(): HostedNumberOrderListInstance; } rest/preview/DeployedDevices.js000064400000002421151677225100012615 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const fleet_1 = require("./deployed_devices/fleet"); class DeployedDevices extends Version_1.default { /** * Initialize the DeployedDevices version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain) { super(domain, "DeployedDevices"); } /** Getter for fleets resource */ get fleets() { this._fleets = this._fleets || (0, fleet_1.FleetListInstance)(this); return this._fleets; } } exports.default = DeployedDevices; rest/preview/deployed_devices/fleet.js000064400000024710151677225100014160 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.FleetPage = exports.FleetListInstance = exports.FleetInstance = exports.FleetContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const certificate_1 = require("./fleet/certificate"); const deployment_1 = require("./fleet/deployment"); const device_1 = require("./fleet/device"); const key_1 = require("./fleet/key"); class FleetContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/Fleets/${sid}`; } get certificates() { this._certificates = this._certificates || (0, certificate_1.CertificateListInstance)(this._version, this._solution.sid); return this._certificates; } get deployments() { this._deployments = this._deployments || (0, deployment_1.DeploymentListInstance)(this._version, this._solution.sid); return this._deployments; } get devices() { this._devices = this._devices || (0, device_1.DeviceListInstance)(this._version, this._solution.sid); return this._devices; } get keys() { this._keys = this._keys || (0, key_1.KeyListInstance)(this._version, this._solution.sid); return this._keys; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FleetInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["defaultDeploymentSid"] !== undefined) data["DefaultDeploymentSid"] = params["defaultDeploymentSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FleetInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FleetContextImpl = FleetContextImpl; class FleetInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.url = payload.url; this.uniqueName = payload.unique_name; this.friendlyName = payload.friendly_name; this.accountSid = payload.account_sid; this.defaultDeploymentSid = payload.default_deployment_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new FleetContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the certificates. */ certificates() { return this._proxy.certificates; } /** * Access the deployments. */ deployments() { return this._proxy.deployments; } /** * Access the devices. */ devices() { return this._proxy.devices; } /** * Access the keys. */ keys() { return this._proxy.keys; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, url: this.url, uniqueName: this.uniqueName, friendlyName: this.friendlyName, accountSid: this.accountSid, defaultDeploymentSid: this.defaultDeploymentSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FleetInstance = FleetInstance; function FleetListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new FleetContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Fleets`; instance.create = function create(params, callback) { if (params 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"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FleetInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new FleetPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new FleetPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.FleetListInstance = FleetListInstance; class FleetPage extends Page_1.default { /** * Initialize the FleetPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of FleetInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new FleetInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FleetPage = FleetPage; rest/preview/deployed_devices/fleet/key.js000064400000023245151677225100014752 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.KeyPage = exports.KeyListInstance = exports.KeyInstance = exports.KeyContextImpl = void 0; 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 KeyContextImpl { constructor(_version, fleetSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(fleetSid)) { throw new Error("Parameter 'fleetSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { fleetSid, sid }; this._uri = `/Fleets/${fleetSid}/Keys/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new KeyInstance(operationVersion, payload, instance._solution.fleetSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["deviceSid"] !== undefined) data["DeviceSid"] = params["deviceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new KeyInstance(operationVersion, payload, instance._solution.fleetSid, 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.KeyContextImpl = KeyContextImpl; class KeyInstance { constructor(_version, payload, fleetSid, sid) { this._version = _version; this.sid = payload.sid; this.url = payload.url; this.friendlyName = payload.friendly_name; this.fleetSid = payload.fleet_sid; this.accountSid = payload.account_sid; this.deviceSid = payload.device_sid; this.secret = payload.secret; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { fleetSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new KeyContextImpl(this._version, this._solution.fleetSid, this._solution.sid); return this._context; } /** * Remove a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, url: this.url, friendlyName: this.friendlyName, fleetSid: this.fleetSid, accountSid: this.accountSid, deviceSid: this.deviceSid, secret: this.secret, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.KeyInstance = KeyInstance; function KeyListInstance(version, fleetSid) { if (!(0, utility_1.isValidPathParam)(fleetSid)) { throw new Error("Parameter 'fleetSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new KeyContextImpl(version, fleetSid, sid); }; instance._version = version; instance._solution = { fleetSid }; instance._uri = `/Fleets/${fleetSid}/Keys`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["deviceSid"] !== undefined) data["DeviceSid"] = params["deviceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new KeyInstance(operationVersion, payload, instance._solution.fleetSid)); 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["deviceSid"] !== undefined) data["DeviceSid"] = params["deviceSid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new KeyPage(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 KeyPage(instance._version, payload, 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; } exports.KeyListInstance = KeyListInstance; class KeyPage extends Page_1.default { /** * Initialize the KeyPage * * @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 KeyInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new KeyInstance(this._version, payload, this._solution.fleetSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.KeyPage = KeyPage; rest/preview/deployed_devices/fleet/certificate.d.ts000064400000031432151677225100016675 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import DeployedDevices from "../../DeployedDevices"; /** * Options to pass to update a CertificateInstance */ export interface CertificateContextUpdateOptions { /** Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. */ friendlyName?: string; /** Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. */ deviceSid?: string; } /** * Options to pass to create a CertificateInstance */ export interface CertificateListInstanceCreateOptions { /** Provides a URL encoded representation of the public certificate in PEM format. */ certificateData: string; /** Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. */ friendlyName?: string; /** Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. */ deviceSid?: string; } /** * Options to pass to each */ export interface CertificateListInstanceEachOptions { /** Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. */ deviceSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CertificateInstance, 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 CertificateListInstanceOptions { /** Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. */ deviceSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CertificateListInstancePageOptions { /** Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. */ deviceSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CertificateContext { /** * Remove a CertificateInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CertificateInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CertificateInstance */ fetch(callback?: (error: Error | null, item?: CertificateInstance) => any): Promise<CertificateInstance>; /** * Update a CertificateInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CertificateInstance */ update(callback?: (error: Error | null, item?: CertificateInstance) => any): Promise<CertificateInstance>; /** * Update a CertificateInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CertificateInstance */ update(params: CertificateContextUpdateOptions, callback?: (error: Error | null, item?: CertificateInstance) => any): Promise<CertificateInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CertificateContextSolution { fleetSid: string; sid: string; } export declare class CertificateContextImpl implements CertificateContext { protected _version: DeployedDevices; protected _solution: CertificateContextSolution; protected _uri: string; constructor(_version: DeployedDevices, fleetSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CertificateInstance) => any): Promise<CertificateInstance>; update(params?: CertificateContextUpdateOptions | ((error: Error | null, item?: CertificateInstance) => any), callback?: (error: Error | null, item?: CertificateInstance) => any): Promise<CertificateInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CertificateContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CertificatePayload extends TwilioResponsePayload { certificates: CertificateResource[]; } interface CertificateResource { sid: string; url: string; friendly_name: string; fleet_sid: string; account_sid: string; device_sid: string; thumbprint: string; date_created: Date; date_updated: Date; } export declare class CertificateInstance { protected _version: DeployedDevices; protected _solution: CertificateContextSolution; protected _context?: CertificateContext; constructor(_version: DeployedDevices, payload: CertificateResource, fleetSid: string, sid?: string); /** * Contains a 34 character string that uniquely identifies this Certificate credential resource. */ sid: string; /** * Contains an absolute URL for this Certificate credential resource. */ url: string; /** * Contains a human readable descriptive text for this Certificate credential, up to 256 characters long. */ friendlyName: string; /** * Specifies the unique string identifier of the Fleet that the given Certificate credential belongs to. */ fleetSid: string; /** * Specifies the unique string identifier of the Account responsible for this Certificate credential. */ accountSid: string; /** * Specifies the unique string identifier of a Device authenticated with this Certificate credential. */ deviceSid: string; /** * Contains a unique hash of the payload of this Certificate credential, used to authenticate the Device. */ thumbprint: string; /** * Specifies the date this Certificate credential was created, given in UTC ISO 8601 format. */ dateCreated: Date; /** * Specifies the date this Certificate credential was last updated, given in UTC ISO 8601 format. */ dateUpdated: Date; private get _proxy(); /** * Remove a CertificateInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CertificateInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CertificateInstance */ fetch(callback?: (error: Error | null, item?: CertificateInstance) => any): Promise<CertificateInstance>; /** * Update a CertificateInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CertificateInstance */ update(callback?: (error: Error | null, item?: CertificateInstance) => any): Promise<CertificateInstance>; /** * Update a CertificateInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CertificateInstance */ update(params: CertificateContextUpdateOptions, callback?: (error: Error | null, item?: CertificateInstance) => any): Promise<CertificateInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; url: string; friendlyName: string; fleetSid: string; accountSid: string; deviceSid: string; thumbprint: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CertificateSolution { fleetSid: string; } export interface CertificateListInstance { _version: DeployedDevices; _solution: CertificateSolution; _uri: string; (sid: string): CertificateContext; get(sid: string): CertificateContext; /** * Create a CertificateInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CertificateInstance */ create(params: CertificateListInstanceCreateOptions, callback?: (error: Error | null, item?: CertificateInstance) => any): Promise<CertificateInstance>; /** * Streams CertificateInstance 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 { CertificateListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CertificateInstance, done: (err?: Error) => void) => void): void; each(params: CertificateListInstanceEachOptions, callback?: (item: CertificateInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CertificateInstance 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: CertificatePage) => any): Promise<CertificatePage>; /** * Lists CertificateInstance 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 { CertificateListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CertificateInstance[]) => any): Promise<CertificateInstance[]>; list(params: CertificateListInstanceOptions, callback?: (error: Error | null, items: CertificateInstance[]) => any): Promise<CertificateInstance[]>; /** * Retrieve a single page of CertificateInstance 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 { CertificateListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CertificatePage) => any): Promise<CertificatePage>; page(params: CertificateListInstancePageOptions, callback?: (error: Error | null, items: CertificatePage) => any): Promise<CertificatePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CertificateListInstance(version: DeployedDevices, fleetSid: string): CertificateListInstance; export declare class CertificatePage extends Page<DeployedDevices, CertificatePayload, CertificateResource, CertificateInstance> { /** * Initialize the CertificatePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: DeployedDevices, response: Response<string>, solution: CertificateSolution); /** * Build an instance of CertificateInstance * * @param payload - Payload response from the API */ getInstance(payload: CertificateResource): CertificateInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/deployed_devices/fleet/device.d.ts000064400000033112151677225100015647 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import DeployedDevices from "../../DeployedDevices"; /** * Options to pass to update a DeviceInstance */ export interface DeviceContextUpdateOptions { /** Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. */ friendlyName?: string; /** Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. */ identity?: string; /** Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. */ deploymentSid?: string; /** */ enabled?: boolean; } /** * Options to pass to create a DeviceInstance */ export interface DeviceListInstanceCreateOptions { /** Provides a unique and addressable name to be assigned to this Device, to be used in addition to SID, up to 128 characters long. */ uniqueName?: string; /** Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. */ friendlyName?: string; /** Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. */ identity?: string; /** Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. */ deploymentSid?: string; /** */ enabled?: boolean; } /** * Options to pass to each */ export interface DeviceListInstanceEachOptions { /** Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. */ deploymentSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: DeviceInstance, 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 DeviceListInstanceOptions { /** Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. */ deploymentSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface DeviceListInstancePageOptions { /** Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. */ deploymentSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface DeviceContext { /** * Remove a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ fetch(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Update a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ update(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Update a DeviceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ update(params: DeviceContextUpdateOptions, callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DeviceContextSolution { fleetSid: string; sid: string; } export declare class DeviceContextImpl implements DeviceContext { protected _version: DeployedDevices; protected _solution: DeviceContextSolution; protected _uri: string; constructor(_version: DeployedDevices, fleetSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; update(params?: DeviceContextUpdateOptions | ((error: Error | null, item?: DeviceInstance) => any), callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DeviceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DevicePayload extends TwilioResponsePayload { devices: DeviceResource[]; } interface DeviceResource { sid: string; url: string; unique_name: string; friendly_name: string; fleet_sid: string; enabled: boolean; account_sid: string; identity: string; deployment_sid: string; date_created: Date; date_updated: Date; date_authenticated: Date; } export declare class DeviceInstance { protected _version: DeployedDevices; protected _solution: DeviceContextSolution; protected _context?: DeviceContext; constructor(_version: DeployedDevices, payload: DeviceResource, fleetSid: string, sid?: string); /** * Contains a 34 character string that uniquely identifies this Device resource. */ sid: string; /** * Contains an absolute URL for this Device resource. */ url: string; /** * Contains a unique and addressable name of this Device, assigned by the developer, up to 128 characters long. */ uniqueName: string; /** * Contains a human readable descriptive text for this Device, up to 256 characters long */ friendlyName: string; /** * Specifies the unique string identifier of the Fleet that the given Device belongs to. */ fleetSid: string; /** * Contains a boolean flag indicating whether the device is enabled or not, blocks device connectivity if set to false. */ enabled: boolean; /** * Specifies the unique string identifier of the Account responsible for this Device. */ accountSid: string; /** * Contains an arbitrary string identifier representing a human user associated with this Device, assigned by the developer, up to 256 characters long. */ identity: string; /** * Specifies the unique string identifier of the Deployment group that this Device is associated with. */ deploymentSid: string; /** * Specifies the date this Device was created, given in UTC ISO 8601 format. */ dateCreated: Date; /** * Specifies the date this Device was last updated, given in UTC ISO 8601 format. */ dateUpdated: Date; /** * Specifies the date this Device was last authenticated, given in UTC ISO 8601 format. */ dateAuthenticated: Date; private get _proxy(); /** * Remove a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ fetch(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Update a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ update(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Update a DeviceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ update(params: DeviceContextUpdateOptions, callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; url: string; uniqueName: string; friendlyName: string; fleetSid: string; enabled: boolean; accountSid: string; identity: string; deploymentSid: string; dateCreated: Date; dateUpdated: Date; dateAuthenticated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DeviceSolution { fleetSid: string; } export interface DeviceListInstance { _version: DeployedDevices; _solution: DeviceSolution; _uri: string; (sid: string): DeviceContext; get(sid: string): DeviceContext; /** * Create a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ create(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Create a DeviceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ create(params: DeviceListInstanceCreateOptions, callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Streams DeviceInstance 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 { DeviceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DeviceInstance, done: (err?: Error) => void) => void): void; each(params: DeviceListInstanceEachOptions, callback?: (item: DeviceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DeviceInstance 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: DevicePage) => any): Promise<DevicePage>; /** * Lists DeviceInstance 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 { DeviceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DeviceInstance[]) => any): Promise<DeviceInstance[]>; list(params: DeviceListInstanceOptions, callback?: (error: Error | null, items: DeviceInstance[]) => any): Promise<DeviceInstance[]>; /** * Retrieve a single page of DeviceInstance 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 { DeviceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DevicePage) => any): Promise<DevicePage>; page(params: DeviceListInstancePageOptions, callback?: (error: Error | null, items: DevicePage) => any): Promise<DevicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DeviceListInstance(version: DeployedDevices, fleetSid: string): DeviceListInstance; export declare class DevicePage extends Page<DeployedDevices, DevicePayload, DeviceResource, DeviceInstance> { /** * Initialize the DevicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: DeployedDevices, response: Response<string>, solution: DeviceSolution); /** * Build an instance of DeviceInstance * * @param payload - Payload response from the API */ getInstance(payload: DeviceResource): DeviceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/deployed_devices/fleet/certificate.js000064400000024225151677225100016443 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CertificatePage = exports.CertificateListInstance = exports.CertificateInstance = exports.CertificateContextImpl = void 0; 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 CertificateContextImpl { constructor(_version, fleetSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(fleetSid)) { throw new Error("Parameter 'fleetSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { fleetSid, sid }; this._uri = `/Fleets/${fleetSid}/Certificates/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CertificateInstance(operationVersion, payload, instance._solution.fleetSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["deviceSid"] !== undefined) data["DeviceSid"] = params["deviceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CertificateInstance(operationVersion, payload, instance._solution.fleetSid, 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.CertificateContextImpl = CertificateContextImpl; class CertificateInstance { constructor(_version, payload, fleetSid, sid) { this._version = _version; this.sid = payload.sid; this.url = payload.url; this.friendlyName = payload.friendly_name; this.fleetSid = payload.fleet_sid; this.accountSid = payload.account_sid; this.deviceSid = payload.device_sid; this.thumbprint = payload.thumbprint; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { fleetSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CertificateContextImpl(this._version, this._solution.fleetSid, this._solution.sid); return this._context; } /** * Remove a CertificateInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CertificateInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CertificateInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, url: this.url, friendlyName: this.friendlyName, fleetSid: this.fleetSid, accountSid: this.accountSid, deviceSid: this.deviceSid, thumbprint: this.thumbprint, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CertificateInstance = CertificateInstance; function CertificateListInstance(version, fleetSid) { if (!(0, utility_1.isValidPathParam)(fleetSid)) { throw new Error("Parameter 'fleetSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CertificateContextImpl(version, fleetSid, sid); }; instance._version = version; instance._solution = { fleetSid }; instance._uri = `/Fleets/${fleetSid}/Certificates`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["certificateData"] === null || params["certificateData"] === undefined) { throw new Error("Required parameter \"params['certificateData']\" missing."); } let data = {}; data["CertificateData"] = params["certificateData"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["deviceSid"] !== undefined) data["DeviceSid"] = params["deviceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CertificateInstance(operationVersion, payload, instance._solution.fleetSid)); 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["deviceSid"] !== undefined) data["DeviceSid"] = params["deviceSid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CertificatePage(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 CertificatePage(instance._version, payload, 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; } exports.CertificateListInstance = CertificateListInstance; class CertificatePage extends Page_1.default { /** * Initialize the CertificatePage * * @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 CertificateInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CertificateInstance(this._version, payload, this._solution.fleetSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CertificatePage = CertificatePage; rest/preview/deployed_devices/fleet/key.d.ts000064400000030027151677225100015202 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import DeployedDevices from "../../DeployedDevices"; /** * Options to pass to update a KeyInstance */ export interface KeyContextUpdateOptions { /** Provides a human readable descriptive text for this Key credential, up to 256 characters long. */ friendlyName?: string; /** Provides the unique string identifier of an existing Device to become authenticated with this Key credential. */ deviceSid?: string; } /** * Options to pass to create a KeyInstance */ export interface KeyListInstanceCreateOptions { /** Provides a human readable descriptive text for this Key credential, up to 256 characters long. */ friendlyName?: string; /** Provides the unique string identifier of an existing Device to become authenticated with this Key credential. */ deviceSid?: string; } /** * Options to pass to each */ export interface KeyListInstanceEachOptions { /** Filters the resulting list of Keys by a unique string identifier of an authenticated Device. */ deviceSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: KeyInstance, 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 KeyListInstanceOptions { /** Filters the resulting list of Keys by a unique string identifier of an authenticated Device. */ deviceSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface KeyListInstancePageOptions { /** Filters the resulting list of Keys by a unique string identifier of an authenticated Device. */ deviceSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface KeyContext { /** * Remove a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ fetch(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Update a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ update(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Update a KeyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ update(params: KeyContextUpdateOptions, callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface KeyContextSolution { fleetSid: string; sid: string; } export declare class KeyContextImpl implements KeyContext { protected _version: DeployedDevices; protected _solution: KeyContextSolution; protected _uri: string; constructor(_version: DeployedDevices, fleetSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; update(params?: KeyContextUpdateOptions | ((error: Error | null, item?: KeyInstance) => any), callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): KeyContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface KeyPayload extends TwilioResponsePayload { keys: KeyResource[]; } interface KeyResource { sid: string; url: string; friendly_name: string; fleet_sid: string; account_sid: string; device_sid: string; secret: string; date_created: Date; date_updated: Date; } export declare class KeyInstance { protected _version: DeployedDevices; protected _solution: KeyContextSolution; protected _context?: KeyContext; constructor(_version: DeployedDevices, payload: KeyResource, fleetSid: string, sid?: string); /** * Contains a 34 character string that uniquely identifies this Key credential resource. */ sid: string; /** * Contains an absolute URL for this Key credential resource. */ url: string; /** * Contains a human readable descriptive text for this Key credential, up to 256 characters long. */ friendlyName: string; /** * Specifies the unique string identifier of the Fleet that the given Key credential belongs to. */ fleetSid: string; /** * Specifies the unique string identifier of the Account responsible for this Key credential. */ accountSid: string; /** * Specifies the unique string identifier of a Device authenticated with this Key credential. */ deviceSid: string; /** * Contains the automatically generated secret belonging to this Key credential, used to authenticate the Device. */ secret: string; /** * Specifies the date this Key credential was created, given in UTC ISO 8601 format. */ dateCreated: Date; /** * Specifies the date this Key credential was last updated, given in UTC ISO 8601 format. */ dateUpdated: Date; private get _proxy(); /** * Remove a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ fetch(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Update a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ update(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Update a KeyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ update(params: KeyContextUpdateOptions, callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; url: string; friendlyName: string; fleetSid: string; accountSid: string; deviceSid: string; secret: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface KeySolution { fleetSid: string; } export interface KeyListInstance { _version: DeployedDevices; _solution: KeySolution; _uri: string; (sid: string): KeyContext; get(sid: string): KeyContext; /** * Create a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ create(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Create a KeyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ create(params: KeyListInstanceCreateOptions, callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Streams KeyInstance 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 { KeyListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: KeyInstance, done: (err?: Error) => void) => void): void; each(params: KeyListInstanceEachOptions, callback?: (item: KeyInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of KeyInstance 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: KeyPage) => any): Promise<KeyPage>; /** * Lists KeyInstance 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 { KeyListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: KeyInstance[]) => any): Promise<KeyInstance[]>; list(params: KeyListInstanceOptions, callback?: (error: Error | null, items: KeyInstance[]) => any): Promise<KeyInstance[]>; /** * Retrieve a single page of KeyInstance 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 { KeyListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: KeyPage) => any): Promise<KeyPage>; page(params: KeyListInstancePageOptions, callback?: (error: Error | null, items: KeyPage) => any): Promise<KeyPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function KeyListInstance(version: DeployedDevices, fleetSid: string): KeyListInstance; export declare class KeyPage extends Page<DeployedDevices, KeyPayload, KeyResource, KeyInstance> { /** * Initialize the KeyPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: DeployedDevices, response: Response<string>, solution: KeySolution); /** * Build an instance of KeyInstance * * @param payload - Payload response from the API */ getInstance(payload: KeyResource): KeyInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/deployed_devices/fleet/device.js000064400000025167151677225100015426 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DevicePage = exports.DeviceListInstance = exports.DeviceInstance = exports.DeviceContextImpl = void 0; 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 DeviceContextImpl { constructor(_version, fleetSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(fleetSid)) { throw new Error("Parameter 'fleetSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { fleetSid, sid }; this._uri = `/Fleets/${fleetSid}/Devices/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DeviceInstance(operationVersion, payload, instance._solution.fleetSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["identity"] !== undefined) data["Identity"] = params["identity"]; if (params["deploymentSid"] !== undefined) data["DeploymentSid"] = params["deploymentSid"]; if (params["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeviceInstance(operationVersion, payload, instance._solution.fleetSid, 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.DeviceContextImpl = DeviceContextImpl; class DeviceInstance { constructor(_version, payload, fleetSid, sid) { this._version = _version; this.sid = payload.sid; this.url = payload.url; this.uniqueName = payload.unique_name; this.friendlyName = payload.friendly_name; this.fleetSid = payload.fleet_sid; this.enabled = payload.enabled; this.accountSid = payload.account_sid; this.identity = payload.identity; this.deploymentSid = payload.deployment_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.dateAuthenticated = deserialize.iso8601DateTime(payload.date_authenticated); this._solution = { fleetSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new DeviceContextImpl(this._version, this._solution.fleetSid, this._solution.sid); return this._context; } /** * Remove a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, url: this.url, uniqueName: this.uniqueName, friendlyName: this.friendlyName, fleetSid: this.fleetSid, enabled: this.enabled, accountSid: this.accountSid, identity: this.identity, deploymentSid: this.deploymentSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, dateAuthenticated: this.dateAuthenticated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeviceInstance = DeviceInstance; function DeviceListInstance(version, fleetSid) { if (!(0, utility_1.isValidPathParam)(fleetSid)) { throw new Error("Parameter 'fleetSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new DeviceContextImpl(version, fleetSid, sid); }; instance._version = version; instance._solution = { fleetSid }; instance._uri = `/Fleets/${fleetSid}/Devices`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["identity"] !== undefined) data["Identity"] = params["identity"]; if (params["deploymentSid"] !== undefined) data["DeploymentSid"] = params["deploymentSid"]; if (params["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeviceInstance(operationVersion, payload, instance._solution.fleetSid)); 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["deploymentSid"] !== undefined) data["DeploymentSid"] = params["deploymentSid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DevicePage(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 DevicePage(instance._version, payload, 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; } exports.DeviceListInstance = DeviceListInstance; class DevicePage extends Page_1.default { /** * Initialize the DevicePage * * @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 DeviceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DeviceInstance(this._version, payload, this._solution.fleetSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DevicePage = DevicePage; rest/preview/deployed_devices/fleet/deployment.js000064400000023406151677225100016341 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeploymentPage = exports.DeploymentListInstance = exports.DeploymentInstance = exports.DeploymentContextImpl = void 0; 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 DeploymentContextImpl { constructor(_version, fleetSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(fleetSid)) { throw new Error("Parameter 'fleetSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { fleetSid, sid }; this._uri = `/Fleets/${fleetSid}/Deployments/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DeploymentInstance(operationVersion, payload, instance._solution.fleetSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["syncServiceSid"] !== undefined) data["SyncServiceSid"] = params["syncServiceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeploymentInstance(operationVersion, payload, instance._solution.fleetSid, 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.DeploymentContextImpl = DeploymentContextImpl; class DeploymentInstance { constructor(_version, payload, fleetSid, sid) { this._version = _version; this.sid = payload.sid; this.url = payload.url; this.friendlyName = payload.friendly_name; this.fleetSid = payload.fleet_sid; this.accountSid = payload.account_sid; this.syncServiceSid = payload.sync_service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { fleetSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new DeploymentContextImpl(this._version, this._solution.fleetSid, this._solution.sid); return this._context; } /** * Remove a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, url: this.url, friendlyName: this.friendlyName, fleetSid: this.fleetSid, accountSid: this.accountSid, syncServiceSid: this.syncServiceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeploymentInstance = DeploymentInstance; function DeploymentListInstance(version, fleetSid) { if (!(0, utility_1.isValidPathParam)(fleetSid)) { throw new Error("Parameter 'fleetSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new DeploymentContextImpl(version, fleetSid, sid); }; instance._version = version; instance._solution = { fleetSid }; instance._uri = `/Fleets/${fleetSid}/Deployments`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["syncServiceSid"] !== undefined) data["SyncServiceSid"] = params["syncServiceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeploymentInstance(operationVersion, payload, instance._solution.fleetSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DeploymentPage(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 DeploymentPage(instance._version, payload, 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; } exports.DeploymentListInstance = DeploymentListInstance; class DeploymentPage extends Page_1.default { /** * Initialize the DeploymentPage * * @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 DeploymentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DeploymentInstance(this._version, payload, this._solution.fleetSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeploymentPage = DeploymentPage; rest/preview/deployed_devices/fleet/deployment.d.ts000064400000030335151677225100016574 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import DeployedDevices from "../../DeployedDevices"; /** * Options to pass to update a DeploymentInstance */ export interface DeploymentContextUpdateOptions { /** Provides a human readable descriptive text for this Deployment, up to 64 characters long */ friendlyName?: string; /** Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. */ syncServiceSid?: string; } /** * Options to pass to create a DeploymentInstance */ export interface DeploymentListInstanceCreateOptions { /** Provides a human readable descriptive text for this Deployment, up to 256 characters long. */ friendlyName?: string; /** Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. */ syncServiceSid?: string; } /** * Options to pass to each */ export interface DeploymentListInstanceEachOptions { /** 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: DeploymentInstance, 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 DeploymentListInstanceOptions { /** 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 DeploymentListInstancePageOptions { /** 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 DeploymentContext { /** * Remove a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ fetch(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Update a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ update(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Update a DeploymentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ update(params: DeploymentContextUpdateOptions, callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DeploymentContextSolution { fleetSid: string; sid: string; } export declare class DeploymentContextImpl implements DeploymentContext { protected _version: DeployedDevices; protected _solution: DeploymentContextSolution; protected _uri: string; constructor(_version: DeployedDevices, fleetSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; update(params?: DeploymentContextUpdateOptions | ((error: Error | null, item?: DeploymentInstance) => any), callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DeploymentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DeploymentPayload extends TwilioResponsePayload { deployments: DeploymentResource[]; } interface DeploymentResource { sid: string; url: string; friendly_name: string; fleet_sid: string; account_sid: string; sync_service_sid: string; date_created: Date; date_updated: Date; } export declare class DeploymentInstance { protected _version: DeployedDevices; protected _solution: DeploymentContextSolution; protected _context?: DeploymentContext; constructor(_version: DeployedDevices, payload: DeploymentResource, fleetSid: string, sid?: string); /** * Contains a 34 character string that uniquely identifies this Deployment resource. */ sid: string; /** * Contains an absolute URL for this Deployment resource. */ url: string; /** * Contains a human readable descriptive text for this Deployment, up to 64 characters long */ friendlyName: string; /** * Specifies the unique string identifier of the Fleet that the given Deployment belongs to. */ fleetSid: string; /** * Specifies the unique string identifier of the Account responsible for this Deployment. */ accountSid: string; /** * Specifies the unique string identifier of the Twilio Sync service instance linked to and accessible by this Deployment. */ syncServiceSid: string; /** * Specifies the date this Deployment was created, given in UTC ISO 8601 format. */ dateCreated: Date; /** * Specifies the date this Deployment was last updated, given in UTC ISO 8601 format. */ dateUpdated: Date; private get _proxy(); /** * Remove a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ fetch(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Update a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ update(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Update a DeploymentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ update(params: DeploymentContextUpdateOptions, callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; url: string; friendlyName: string; fleetSid: string; accountSid: string; syncServiceSid: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DeploymentSolution { fleetSid: string; } export interface DeploymentListInstance { _version: DeployedDevices; _solution: DeploymentSolution; _uri: string; (sid: string): DeploymentContext; get(sid: string): DeploymentContext; /** * Create a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ create(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Create a DeploymentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ create(params: DeploymentListInstanceCreateOptions, callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Streams DeploymentInstance 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 { DeploymentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void): void; each(params: DeploymentListInstanceEachOptions, callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DeploymentInstance 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: DeploymentPage) => any): Promise<DeploymentPage>; /** * Lists DeploymentInstance 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 { DeploymentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DeploymentInstance[]) => any): Promise<DeploymentInstance[]>; list(params: DeploymentListInstanceOptions, callback?: (error: Error | null, items: DeploymentInstance[]) => any): Promise<DeploymentInstance[]>; /** * Retrieve a single page of DeploymentInstance 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 { DeploymentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DeploymentPage) => any): Promise<DeploymentPage>; page(params: DeploymentListInstancePageOptions, callback?: (error: Error | null, items: DeploymentPage) => any): Promise<DeploymentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DeploymentListInstance(version: DeployedDevices, fleetSid: string): DeploymentListInstance; export declare class DeploymentPage extends Page<DeployedDevices, DeploymentPayload, DeploymentResource, DeploymentInstance> { /** * Initialize the DeploymentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: DeployedDevices, response: Response<string>, solution: DeploymentSolution); /** * Build an instance of DeploymentInstance * * @param payload - Payload response from the API */ getInstance(payload: DeploymentResource): DeploymentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/deployed_devices/fleet.d.ts000064400000031200151677225100014404 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import DeployedDevices from "../DeployedDevices"; import { CertificateListInstance } from "./fleet/certificate"; import { DeploymentListInstance } from "./fleet/deployment"; import { DeviceListInstance } from "./fleet/device"; import { KeyListInstance } from "./fleet/key"; /** * Options to pass to update a FleetInstance */ export interface FleetContextUpdateOptions { /** Provides a human readable descriptive text for this Fleet, up to 256 characters long. */ friendlyName?: string; /** Provides a string identifier of a Deployment that is going to be used as a default one for this Fleet. */ defaultDeploymentSid?: string; } /** * Options to pass to create a FleetInstance */ export interface FleetListInstanceCreateOptions { /** Provides a human readable descriptive text for this Fleet, up to 256 characters long. */ friendlyName?: string; } /** * Options to pass to each */ export interface FleetListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: FleetInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface FleetListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface FleetListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface FleetContext { certificates: CertificateListInstance; deployments: DeploymentListInstance; devices: DeviceListInstance; keys: KeyListInstance; /** * Remove a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ fetch(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Update a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ update(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Update a FleetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ update(params: FleetContextUpdateOptions, callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FleetContextSolution { sid: string; } export declare class FleetContextImpl implements FleetContext { protected _version: DeployedDevices; protected _solution: FleetContextSolution; protected _uri: string; protected _certificates?: CertificateListInstance; protected _deployments?: DeploymentListInstance; protected _devices?: DeviceListInstance; protected _keys?: KeyListInstance; constructor(_version: DeployedDevices, sid: string); get certificates(): CertificateListInstance; get deployments(): DeploymentListInstance; get devices(): DeviceListInstance; get keys(): KeyListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; update(params?: FleetContextUpdateOptions | ((error: Error | null, item?: FleetInstance) => any), callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FleetContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FleetPayload extends TwilioResponsePayload { fleets: FleetResource[]; } interface FleetResource { sid: string; url: string; unique_name: string; friendly_name: string; account_sid: string; default_deployment_sid: string; date_created: Date; date_updated: Date; links: Record<string, string>; } export declare class FleetInstance { protected _version: DeployedDevices; protected _solution: FleetContextSolution; protected _context?: FleetContext; constructor(_version: DeployedDevices, payload: FleetResource, sid?: string); /** * Contains a 34 character string that uniquely identifies this Fleet resource. */ sid: string; /** * Contains an absolute URL for this Fleet resource. */ url: string; /** * Contains a unique and addressable name of this Fleet, e.g. \'default\', up to 128 characters long. */ uniqueName: string; /** * Contains a human readable descriptive text for this Fleet, up to 256 characters long. */ friendlyName: string; /** * Speicifies the unique string identifier of the Account responsible for this Fleet. */ accountSid: string; /** * Contains the string identifier of the automatically provisioned default Deployment of this Fleet. */ defaultDeploymentSid: string; /** * Specifies the date this Fleet was created, given in UTC ISO 8601 format. */ dateCreated: Date; /** * Specifies the date this Fleet was last updated, given in UTC ISO 8601 format. */ dateUpdated: Date; /** * Contains a dictionary of URL links to nested resources of this Fleet. */ links: Record<string, string>; private get _proxy(); /** * Remove a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ fetch(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Update a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ update(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Update a FleetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ update(params: FleetContextUpdateOptions, callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Access the certificates. */ certificates(): CertificateListInstance; /** * Access the deployments. */ deployments(): DeploymentListInstance; /** * Access the devices. */ devices(): DeviceListInstance; /** * Access the keys. */ keys(): KeyListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; url: string; uniqueName: string; friendlyName: string; accountSid: string; defaultDeploymentSid: string; dateCreated: Date; dateUpdated: Date; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FleetSolution { } export interface FleetListInstance { _version: DeployedDevices; _solution: FleetSolution; _uri: string; (sid: string): FleetContext; get(sid: string): FleetContext; /** * Create a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ create(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Create a FleetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ create(params: FleetListInstanceCreateOptions, callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Streams FleetInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { FleetListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: FleetInstance, done: (err?: Error) => void) => void): void; each(params: FleetListInstanceEachOptions, callback?: (item: FleetInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of FleetInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: FleetPage) => any): Promise<FleetPage>; /** * Lists FleetInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { FleetListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: FleetInstance[]) => any): Promise<FleetInstance[]>; list(params: FleetListInstanceOptions, callback?: (error: Error | null, items: FleetInstance[]) => any): Promise<FleetInstance[]>; /** * Retrieve a single page of FleetInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { FleetListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: FleetPage) => any): Promise<FleetPage>; page(params: FleetListInstancePageOptions, callback?: (error: Error | null, items: FleetPage) => any): Promise<FleetPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FleetListInstance(version: DeployedDevices): FleetListInstance; export declare class FleetPage extends Page<DeployedDevices, FleetPayload, FleetResource, FleetInstance> { /** * Initialize the FleetPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: DeployedDevices, response: Response<string>, solution: FleetSolution); /** * Build an instance of FleetInstance * * @param payload - Payload response from the API */ getInstance(payload: FleetResource): FleetInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/Wireless.d.ts000064400000002057151677225100011603 0ustar00import PreviewBase from "../PreviewBase"; import Version from "../../base/Version"; import { CommandListInstance } from "./wireless/command"; import { RatePlanListInstance } from "./wireless/ratePlan"; import { SimListInstance } from "./wireless/sim"; export default class Wireless extends Version { /** * Initialize the Wireless version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain: PreviewBase); /** commands - { Twilio.Preview.Wireless.CommandListInstance } resource */ protected _commands?: CommandListInstance; /** ratePlans - { Twilio.Preview.Wireless.RatePlanListInstance } resource */ protected _ratePlans?: RatePlanListInstance; /** sims - { Twilio.Preview.Wireless.SimListInstance } resource */ protected _sims?: SimListInstance; /** Getter for commands resource */ get commands(): CommandListInstance; /** Getter for ratePlans resource */ get ratePlans(): RatePlanListInstance; /** Getter for sims resource */ get sims(): SimListInstance; } rest/preview/DeployedDevices.d.ts000064400000001103151677225100013045 0ustar00import PreviewBase from "../PreviewBase"; import Version from "../../base/Version"; import { FleetListInstance } from "./deployed_devices/fleet"; export default class DeployedDevices extends Version { /** * Initialize the DeployedDevices version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain: PreviewBase); /** fleets - { Twilio.Preview.DeployedDevices.FleetListInstance } resource */ protected _fleets?: FleetListInstance; /** Getter for fleets resource */ get fleets(): FleetListInstance; } rest/preview/Sync.d.ts000064400000001050151677225100010712 0ustar00import PreviewBase from "../PreviewBase"; import Version from "../../base/Version"; import { ServiceListInstance } from "./sync/service"; export default class Sync extends Version { /** * Initialize the Sync version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain: PreviewBase); /** services - { Twilio.Preview.Sync.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** Getter for services resource */ get services(): ServiceListInstance; } rest/preview/HostedNumbers.js000064400000003367151677225100012341 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const authorizationDocument_1 = require("./hosted_numbers/authorizationDocument"); const hostedNumberOrder_1 = require("./hosted_numbers/hostedNumberOrder"); class HostedNumbers extends Version_1.default { /** * Initialize the HostedNumbers version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain) { super(domain, "HostedNumbers"); } /** Getter for authorizationDocuments resource */ get authorizationDocuments() { this._authorizationDocuments = this._authorizationDocuments || (0, authorizationDocument_1.AuthorizationDocumentListInstance)(this); return this._authorizationDocuments; } /** Getter for hostedNumberOrders resource */ get hostedNumberOrders() { this._hostedNumberOrders = this._hostedNumberOrders || (0, hostedNumberOrder_1.HostedNumberOrderListInstance)(this); return this._hostedNumberOrders; } } exports.default = HostedNumbers; rest/preview/Marketplace.js000064400000003217151677225100012001 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const availableAddOn_1 = require("./marketplace/availableAddOn"); const installedAddOn_1 = require("./marketplace/installedAddOn"); class Marketplace extends Version_1.default { /** * Initialize the Marketplace version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain) { super(domain, "marketplace"); } /** Getter for availableAddOns resource */ get availableAddOns() { this._availableAddOns = this._availableAddOns || (0, availableAddOn_1.AvailableAddOnListInstance)(this); return this._availableAddOns; } /** Getter for installedAddOns resource */ get installedAddOns() { this._installedAddOns = this._installedAddOns || (0, installedAddOn_1.InstalledAddOnListInstance)(this); return this._installedAddOns; } } exports.default = Marketplace; rest/preview/Sync.js000064400000002353151677225100010465 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const service_1 = require("./sync/service"); class Sync extends Version_1.default { /** * Initialize the Sync version of Preview * * @param domain - The Twilio (Twilio.Preview) domain */ constructor(domain) { super(domain, "Sync"); } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } } exports.default = Sync; rest/preview/wireless/sim.js000064400000026034151677225100012200 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimPage = exports.SimListInstance = exports.SimInstance = exports.SimContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const usage_1 = require("./sim/usage"); class SimContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/Sims/${sid}`; } get usage() { this._usage = this._usage || (0, usage_1.UsageListInstance)(this._version, this._solution.sid); return this._usage; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SimInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["ratePlan"] !== undefined) data["RatePlan"] = params["ratePlan"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["commandsCallbackMethod"] !== undefined) data["CommandsCallbackMethod"] = params["commandsCallbackMethod"]; if (params["commandsCallbackUrl"] !== undefined) data["CommandsCallbackUrl"] = params["commandsCallbackUrl"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SimInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimContextImpl = SimContextImpl; class SimInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.ratePlanSid = payload.rate_plan_sid; this.friendlyName = payload.friendly_name; this.iccid = payload.iccid; this.eId = payload.e_id; this.status = payload.status; this.commandsCallbackUrl = payload.commands_callback_url; this.commandsCallbackMethod = payload.commands_callback_method; this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsUrl = payload.sms_url; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceMethod = payload.voice_method; this.voiceUrl = payload.voice_url; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SimContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the usage. */ usage() { return this._proxy.usage; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, ratePlanSid: this.ratePlanSid, friendlyName: this.friendlyName, iccid: this.iccid, eId: this.eId, status: this.status, commandsCallbackUrl: this.commandsCallbackUrl, commandsCallbackMethod: this.commandsCallbackMethod, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsUrl: this.smsUrl, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceMethod: this.voiceMethod, voiceUrl: this.voiceUrl, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimInstance = SimInstance; function SimListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SimContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Sims`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["iccid"] !== undefined) data["Iccid"] = params["iccid"]; if (params["ratePlan"] !== undefined) data["RatePlan"] = params["ratePlan"]; if (params["eId"] !== undefined) data["EId"] = params["eId"]; if (params["simRegistrationCode"] !== undefined) data["SimRegistrationCode"] = params["simRegistrationCode"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SimPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new SimPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.SimListInstance = SimListInstance; class SimPage extends Page_1.default { /** * Initialize the SimPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of SimInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SimInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimPage = SimPage; rest/preview/wireless/command.js000064400000021074151677225100013025 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CommandPage = exports.CommandListInstance = exports.CommandInstance = exports.CommandContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class CommandContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/Commands/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CommandInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CommandContextImpl = CommandContextImpl; class CommandInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.deviceSid = payload.device_sid; this.simSid = payload.sim_sid; this.command = payload.command; this.commandMode = payload.command_mode; this.status = payload.status; this.direction = payload.direction; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CommandContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a CommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CommandInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, deviceSid: this.deviceSid, simSid: this.simSid, command: this.command, commandMode: this.commandMode, status: this.status, direction: this.direction, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CommandInstance = CommandInstance; function CommandListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CommandContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Commands`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["command"] === null || params["command"] === undefined) { throw new Error("Required parameter \"params['command']\" missing."); } let data = {}; data["Command"] = params["command"]; if (params["device"] !== undefined) data["Device"] = params["device"]; if (params["sim"] !== undefined) data["Sim"] = params["sim"]; if (params["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["commandMode"] !== undefined) data["CommandMode"] = params["commandMode"]; if (params["includeSid"] !== undefined) data["IncludeSid"] = params["includeSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CommandInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["device"] !== undefined) data["Device"] = params["device"]; if (params["sim"] !== undefined) data["Sim"] = params["sim"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["direction"] !== undefined) data["Direction"] = params["direction"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CommandPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new CommandPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.CommandListInstance = CommandListInstance; class CommandPage extends Page_1.default { /** * Initialize the CommandPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of CommandInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CommandInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CommandPage = CommandPage; rest/preview/wireless/ratePlan.d.ts000064400000026730151677225100013415 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import Wireless from "../Wireless"; /** * Options to pass to update a RatePlanInstance */ export interface RatePlanContextUpdateOptions { /** */ uniqueName?: string; /** */ friendlyName?: string; } /** * Options to pass to create a RatePlanInstance */ export interface RatePlanListInstanceCreateOptions { /** */ uniqueName?: string; /** */ friendlyName?: string; /** */ dataEnabled?: boolean; /** */ dataLimit?: number; /** */ dataMetering?: string; /** */ messagingEnabled?: boolean; /** */ voiceEnabled?: boolean; /** */ commandsEnabled?: boolean; /** */ nationalRoamingEnabled?: boolean; /** */ internationalRoaming?: Array<string>; } /** * Options to pass to each */ export interface RatePlanListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface RatePlanListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface RatePlanListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface RatePlanContext { /** * Remove a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Update a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ update(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Update a RatePlanInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ update(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RatePlanContextSolution { sid: string; } export declare class RatePlanContextImpl implements RatePlanContext { protected _version: Wireless; protected _solution: RatePlanContextSolution; protected _uri: string; constructor(_version: Wireless, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; update(params?: RatePlanContextUpdateOptions | ((error: Error | null, item?: RatePlanInstance) => any), callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RatePlanContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RatePlanPayload extends TwilioResponsePayload { rate_plans: RatePlanResource[]; } interface RatePlanResource { sid: string; unique_name: string; account_sid: string; friendly_name: string; data_enabled: boolean; data_metering: string; data_limit: number; messaging_enabled: boolean; voice_enabled: boolean; national_roaming_enabled: boolean; international_roaming: Array<string>; date_created: Date; date_updated: Date; url: string; } export declare class RatePlanInstance { protected _version: Wireless; protected _solution: RatePlanContextSolution; protected _context?: RatePlanContext; constructor(_version: Wireless, payload: RatePlanResource, sid?: string); sid: string; uniqueName: string; accountSid: string; friendlyName: string; dataEnabled: boolean; dataMetering: string; dataLimit: number; messagingEnabled: boolean; voiceEnabled: boolean; nationalRoamingEnabled: boolean; internationalRoaming: Array<string>; dateCreated: Date; dateUpdated: Date; url: string; private get _proxy(); /** * Remove a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Update a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ update(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Update a RatePlanInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ update(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; friendlyName: string; dataEnabled: boolean; dataMetering: string; dataLimit: number; messagingEnabled: boolean; voiceEnabled: boolean; nationalRoamingEnabled: boolean; internationalRoaming: string[]; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RatePlanSolution { } export interface RatePlanListInstance { _version: Wireless; _solution: RatePlanSolution; _uri: string; (sid: string): RatePlanContext; get(sid: string): RatePlanContext; /** * Create a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ create(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Create a RatePlanInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ create(params: RatePlanListInstanceCreateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Streams RatePlanInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { RatePlanListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void; each(params: RatePlanListInstanceEachOptions, callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RatePlanInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>; /** * Lists RatePlanInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { RatePlanListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RatePlanInstance[]) => any): Promise<RatePlanInstance[]>; list(params: RatePlanListInstanceOptions, callback?: (error: Error | null, items: RatePlanInstance[]) => any): Promise<RatePlanInstance[]>; /** * Retrieve a single page of RatePlanInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { RatePlanListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>; page(params: RatePlanListInstancePageOptions, callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RatePlanListInstance(version: Wireless): RatePlanListInstance; export declare class RatePlanPage extends Page<Wireless, RatePlanPayload, RatePlanResource, RatePlanInstance> { /** * Initialize the RatePlanPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Wireless, response: Response<string>, solution: RatePlanSolution); /** * Build an instance of RatePlanInstance * * @param payload - Payload response from the API */ getInstance(payload: RatePlanResource): RatePlanInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/wireless/sim/usage.js000064400000010751151677225100013303 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.UsageListInstance = exports.UsageInstance = exports.UsageContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class UsageContextImpl { constructor(_version, simSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(simSid)) { throw new Error("Parameter 'simSid' is not valid."); } this._solution = { simSid }; this._uri = `/Sims/${simSid}/Usage`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["end"] !== undefined) data["End"] = params["end"]; if (params["start"] !== undefined) data["Start"] = params["start"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UsageInstance(operationVersion, payload, instance._solution.simSid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsageContextImpl = UsageContextImpl; class UsageInstance { constructor(_version, payload, simSid) { this._version = _version; this.simSid = payload.sim_sid; this.simUniqueName = payload.sim_unique_name; this.accountSid = payload.account_sid; this.period = payload.period; this.commandsUsage = payload.commands_usage; this.commandsCosts = payload.commands_costs; this.dataUsage = payload.data_usage; this.dataCosts = payload.data_costs; this.url = payload.url; this._solution = { simSid }; } get _proxy() { this._context = this._context || new UsageContextImpl(this._version, this._solution.simSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { simSid: this.simSid, simUniqueName: this.simUniqueName, accountSid: this.accountSid, period: this.period, commandsUsage: this.commandsUsage, commandsCosts: this.commandsCosts, dataUsage: this.dataUsage, dataCosts: this.dataCosts, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsageInstance = UsageInstance; function UsageListInstance(version, simSid) { if (!(0, utility_1.isValidPathParam)(simSid)) { throw new Error("Parameter 'simSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new UsageContextImpl(version, simSid); }; instance._version = version; instance._solution = { simSid }; instance._uri = ``; instance.toJSON = function toJSON() { return instance._solution; }; instance[util_1.inspect.custom] = function inspectImpl(_depth, options) { return (0, util_1.inspect)(instance.toJSON(), options); }; return instance; } exports.UsageListInstance = UsageListInstance; rest/preview/wireless/sim/usage.d.ts000064400000007535151677225100013545 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Wireless from "../../Wireless"; /** * Options to pass to fetch a UsageInstance */ export interface UsageContextFetchOptions { /** */ end?: string; /** */ start?: string; } export interface UsageContext { /** * Fetch a UsageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UsageInstance */ fetch(callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>; /** * Fetch a UsageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UsageInstance */ fetch(params: UsageContextFetchOptions, callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UsageContextSolution { simSid: string; } export declare class UsageContextImpl implements UsageContext { protected _version: Wireless; protected _solution: UsageContextSolution; protected _uri: string; constructor(_version: Wireless, simSid: string); fetch(params?: UsageContextFetchOptions | ((error: Error | null, item?: UsageInstance) => any), callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UsageContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UsageResource { sim_sid: string; sim_unique_name: string; account_sid: string; period: any; commands_usage: any; commands_costs: any; data_usage: any; data_costs: any; url: string; } export declare class UsageInstance { protected _version: Wireless; protected _solution: UsageContextSolution; protected _context?: UsageContext; constructor(_version: Wireless, payload: UsageResource, simSid: string); simSid: string; simUniqueName: string; accountSid: string; period: any; commandsUsage: any; commandsCosts: any; dataUsage: any; dataCosts: any; url: string; private get _proxy(); /** * Fetch a UsageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UsageInstance */ fetch(callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>; /** * Fetch a UsageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UsageInstance */ fetch(params: UsageContextFetchOptions, callback?: (error: Error | null, item?: UsageInstance) => any): Promise<UsageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { simSid: string; simUniqueName: string; accountSid: string; period: any; commandsUsage: any; commandsCosts: any; dataUsage: any; dataCosts: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UsageSolution { simSid: string; } export interface UsageListInstance { _version: Wireless; _solution: UsageSolution; _uri: string; (): UsageContext; get(): UsageContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UsageListInstance(version: Wireless, simSid: string): UsageListInstance; export {}; rest/preview/wireless/ratePlan.js000064400000025532151677225100013160 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RatePlanPage = exports.RatePlanListInstance = exports.RatePlanInstance = exports.RatePlanContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class RatePlanContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/RatePlans/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RatePlanInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RatePlanInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RatePlanContextImpl = RatePlanContextImpl; class RatePlanInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.dataEnabled = payload.data_enabled; this.dataMetering = payload.data_metering; this.dataLimit = deserialize.integer(payload.data_limit); this.messagingEnabled = payload.messaging_enabled; this.voiceEnabled = payload.voice_enabled; this.nationalRoamingEnabled = payload.national_roaming_enabled; this.internationalRoaming = payload.international_roaming; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RatePlanContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, friendlyName: this.friendlyName, dataEnabled: this.dataEnabled, dataMetering: this.dataMetering, dataLimit: this.dataLimit, messagingEnabled: this.messagingEnabled, voiceEnabled: this.voiceEnabled, nationalRoamingEnabled: this.nationalRoamingEnabled, internationalRoaming: this.internationalRoaming, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RatePlanInstance = RatePlanInstance; function RatePlanListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RatePlanContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/RatePlans`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["dataEnabled"] !== undefined) data["DataEnabled"] = serialize.bool(params["dataEnabled"]); if (params["dataLimit"] !== undefined) data["DataLimit"] = params["dataLimit"]; if (params["dataMetering"] !== undefined) data["DataMetering"] = params["dataMetering"]; if (params["messagingEnabled"] !== undefined) data["MessagingEnabled"] = serialize.bool(params["messagingEnabled"]); if (params["voiceEnabled"] !== undefined) data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]); if (params["commandsEnabled"] !== undefined) data["CommandsEnabled"] = serialize.bool(params["commandsEnabled"]); if (params["nationalRoamingEnabled"] !== undefined) data["NationalRoamingEnabled"] = serialize.bool(params["nationalRoamingEnabled"]); if (params["internationalRoaming"] !== undefined) data["InternationalRoaming"] = serialize.map(params["internationalRoaming"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RatePlanInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RatePlanPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new RatePlanPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.RatePlanListInstance = RatePlanListInstance; class RatePlanPage extends Page_1.default { /** * Initialize the RatePlanPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of RatePlanInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RatePlanInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RatePlanPage = RatePlanPage; rest/preview/wireless/sim.d.ts000064400000026232151677225100012434 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import Wireless from "../Wireless"; import { UsageListInstance } from "./sim/usage"; /** * Options to pass to update a SimInstance */ export interface SimContextUpdateOptions { /** */ uniqueName?: string; /** */ callbackMethod?: string; /** */ callbackUrl?: string; /** */ friendlyName?: string; /** */ ratePlan?: string; /** */ status?: string; /** */ commandsCallbackMethod?: string; /** */ commandsCallbackUrl?: string; /** */ smsFallbackMethod?: string; /** */ smsFallbackUrl?: string; /** */ smsMethod?: string; /** */ smsUrl?: string; /** */ voiceFallbackMethod?: string; /** */ voiceFallbackUrl?: string; /** */ voiceMethod?: string; /** */ voiceUrl?: string; } /** * Options to pass to each */ export interface SimListInstanceEachOptions { /** */ status?: string; /** */ iccid?: string; /** */ ratePlan?: string; /** */ eId?: string; /** */ simRegistrationCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: SimInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface SimListInstanceOptions { /** */ status?: string; /** */ iccid?: string; /** */ ratePlan?: string; /** */ eId?: string; /** */ simRegistrationCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface SimListInstancePageOptions { /** */ status?: string; /** */ iccid?: string; /** */ ratePlan?: string; /** */ eId?: string; /** */ simRegistrationCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface SimContext { usage: UsageListInstance; /** * Fetch a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SimContextSolution { sid: string; } export declare class SimContextImpl implements SimContext { protected _version: Wireless; protected _solution: SimContextSolution; protected _uri: string; protected _usage?: UsageListInstance; constructor(_version: Wireless, sid: string); get usage(): UsageListInstance; fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; update(params?: SimContextUpdateOptions | ((error: Error | null, item?: SimInstance) => any), callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SimContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SimPayload extends TwilioResponsePayload { sims: SimResource[]; } interface SimResource { sid: string; unique_name: string; account_sid: string; rate_plan_sid: string; friendly_name: string; iccid: string; e_id: string; status: string; commands_callback_url: string; commands_callback_method: string; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_url: string; voice_fallback_method: string; voice_fallback_url: string; voice_method: string; voice_url: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class SimInstance { protected _version: Wireless; protected _solution: SimContextSolution; protected _context?: SimContext; constructor(_version: Wireless, payload: SimResource, sid?: string); sid: string; uniqueName: string; accountSid: string; ratePlanSid: string; friendlyName: string; iccid: string; eId: string; status: string; commandsCallbackUrl: string; commandsCallbackMethod: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceUrl: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Access the usage. */ usage(): UsageListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; ratePlanSid: string; friendlyName: string; iccid: string; eId: string; status: string; commandsCallbackUrl: string; commandsCallbackMethod: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceUrl: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SimSolution { } export interface SimListInstance { _version: Wireless; _solution: SimSolution; _uri: string; (sid: string): SimContext; get(sid: string): SimContext; /** * Streams SimInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SimInstance, done: (err?: Error) => void) => void): void; each(params: SimListInstanceEachOptions, callback?: (item: SimInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SimInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>; /** * Lists SimInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SimInstance[]) => any): Promise<SimInstance[]>; list(params: SimListInstanceOptions, callback?: (error: Error | null, items: SimInstance[]) => any): Promise<SimInstance[]>; /** * Retrieve a single page of SimInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>; page(params: SimListInstancePageOptions, callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SimListInstance(version: Wireless): SimListInstance; export declare class SimPage extends Page<Wireless, SimPayload, SimResource, SimInstance> { /** * Initialize the SimPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Wireless, response: Response<string>, solution: SimSolution); /** * Build an instance of SimInstance * * @param payload - Payload response from the API */ getInstance(payload: SimResource): SimInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/preview/wireless/command.d.ts000064400000021323151677225100013256 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import Wireless from "../Wireless"; /** * Options to pass to create a CommandInstance */ export interface CommandListInstanceCreateOptions { /** */ command: string; /** */ device?: string; /** */ sim?: string; /** */ callbackMethod?: string; /** */ callbackUrl?: string; /** */ commandMode?: string; /** */ includeSid?: string; } /** * Options to pass to each */ export interface CommandListInstanceEachOptions { /** */ device?: string; /** */ sim?: string; /** */ status?: string; /** */ direction?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CommandInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface CommandListInstanceOptions { /** */ device?: string; /** */ sim?: string; /** */ status?: string; /** */ direction?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CommandListInstancePageOptions { /** */ device?: string; /** */ sim?: string; /** */ status?: string; /** */ direction?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CommandContext { /** * Fetch a CommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CommandInstance */ fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CommandContextSolution { sid: string; } export declare class CommandContextImpl implements CommandContext { protected _version: Wireless; protected _solution: CommandContextSolution; protected _uri: string; constructor(_version: Wireless, sid: string); fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CommandContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CommandPayload extends TwilioResponsePayload { commands: CommandResource[]; } interface CommandResource { sid: string; account_sid: string; device_sid: string; sim_sid: string; command: string; command_mode: string; status: string; direction: string; date_created: Date; date_updated: Date; url: string; } export declare class CommandInstance { protected _version: Wireless; protected _solution: CommandContextSolution; protected _context?: CommandContext; constructor(_version: Wireless, payload: CommandResource, sid?: string); sid: string; accountSid: string; deviceSid: string; simSid: string; command: string; commandMode: string; status: string; direction: string; dateCreated: Date; dateUpdated: Date; url: string; private get _proxy(); /** * Fetch a CommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CommandInstance */ fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; deviceSid: string; simSid: string; command: string; commandMode: string; status: string; direction: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CommandSolution { } export interface CommandListInstance { _version: Wireless; _solution: CommandSolution; _uri: string; (sid: string): CommandContext; get(sid: string): CommandContext; /** * Create a CommandInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CommandInstance */ create(params: CommandListInstanceCreateOptions, callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>; /** * Streams CommandInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { CommandListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void; each(params: CommandListInstanceEachOptions, callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CommandInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>; /** * Lists CommandInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { CommandListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CommandInstance[]) => any): Promise<CommandInstance[]>; list(params: CommandListInstanceOptions, callback?: (error: Error | null, items: CommandInstance[]) => any): Promise<CommandInstance[]>; /** * Retrieve a single page of CommandInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { CommandListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>; page(params: CommandListInstancePageOptions, callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CommandListInstance(version: Wireless): CommandListInstance; export declare class CommandPage extends Page<Wireless, CommandPayload, CommandResource, CommandInstance> { /** * Initialize the CommandPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: Wireless, response: Response<string>, solution: CommandSolution); /** * Build an instance of CommandInstance * * @param payload - Payload response from the API */ getInstance(payload: CommandResource): CommandInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/NotifyBase.js000064400000002040151677225100010124 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./notify/V1")); class NotifyBase extends Domain_1.default { /** * Initialize notify domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://notify.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = NotifyBase; rest/insights/V1.d.ts000064400000003065151677225100010443 0ustar00import InsightsBase from "../InsightsBase"; import Version from "../../base/Version"; import { CallListInstance } from "./v1/call"; import { CallSummariesListInstance } from "./v1/callSummaries"; import { ConferenceListInstance } from "./v1/conference"; import { RoomListInstance } from "./v1/room"; import { SettingListInstance } from "./v1/setting"; export default class V1 extends Version { /** * Initialize the V1 version of Insights * * @param domain - The Twilio (Twilio.Insights) domain */ constructor(domain: InsightsBase); /** calls - { Twilio.Insights.V1.CallListInstance } resource */ protected _calls?: CallListInstance; /** callSummaries - { Twilio.Insights.V1.CallSummariesListInstance } resource */ protected _callSummaries?: CallSummariesListInstance; /** conferences - { Twilio.Insights.V1.ConferenceListInstance } resource */ protected _conferences?: ConferenceListInstance; /** rooms - { Twilio.Insights.V1.RoomListInstance } resource */ protected _rooms?: RoomListInstance; /** settings - { Twilio.Insights.V1.SettingListInstance } resource */ protected _settings?: SettingListInstance; /** Getter for calls resource */ get calls(): CallListInstance; /** Getter for callSummaries resource */ get callSummaries(): CallSummariesListInstance; /** Getter for conferences resource */ get conferences(): ConferenceListInstance; /** Getter for rooms resource */ get rooms(): RoomListInstance; /** Getter for settings resource */ get settings(): SettingListInstance; } rest/insights/v1/setting.d.ts000064400000013154151677225100012160 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to fetch a SettingInstance */ export interface SettingContextFetchOptions { /** The unique SID identifier of the Subaccount. */ subaccountSid?: string; } /** * Options to pass to update a SettingInstance */ export interface SettingContextUpdateOptions { /** A boolean flag to enable Advanced Features for Voice Insights. */ advancedFeatures?: boolean; /** A boolean flag to enable Voice Trace. */ voiceTrace?: boolean; /** The unique SID identifier of the Subaccount. */ subaccountSid?: string; } export interface SettingContext { /** * Fetch a SettingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingInstance */ fetch(callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; /** * Fetch a SettingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingInstance */ fetch(params: SettingContextFetchOptions, callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; /** * Update a SettingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingInstance */ update(callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; /** * Update a SettingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingInstance */ update(params: SettingContextUpdateOptions, callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SettingContextSolution { } export declare class SettingContextImpl implements SettingContext { protected _version: V1; protected _solution: SettingContextSolution; protected _uri: string; constructor(_version: V1); fetch(params?: SettingContextFetchOptions | ((error: Error | null, item?: SettingInstance) => any), callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; update(params?: SettingContextUpdateOptions | ((error: Error | null, item?: SettingInstance) => any), callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SettingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SettingResource { account_sid: string; advanced_features: boolean; voice_trace: boolean; url: string; } export declare class SettingInstance { protected _version: V1; protected _solution: SettingContextSolution; protected _context?: SettingContext; constructor(_version: V1, payload: SettingResource); /** * The unique SID identifier of the Account. */ accountSid: string; /** * A boolean flag indicating whether Advanced Features for Voice Insights are enabled. */ advancedFeatures: boolean; /** * A boolean flag indicating whether Voice Trace is enabled. */ voiceTrace: boolean; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a SettingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingInstance */ fetch(callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; /** * Fetch a SettingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingInstance */ fetch(params: SettingContextFetchOptions, callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; /** * Update a SettingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingInstance */ update(callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; /** * Update a SettingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SettingInstance */ update(params: SettingContextUpdateOptions, callback?: (error: Error | null, item?: SettingInstance) => any): Promise<SettingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; advancedFeatures: boolean; voiceTrace: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SettingSolution { } export interface SettingListInstance { _version: V1; _solution: SettingSolution; _uri: string; (): SettingContext; get(): SettingContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SettingListInstance(version: V1): SettingListInstance; export {}; rest/insights/v1/callSummaries.d.ts000064400000046016151677225100013307 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type CallSummariesAnsweredBy = "unknown" | "machine_start" | "machine_end_beep" | "machine_end_silence" | "machine_end_other" | "human" | "fax"; export type CallSummariesCallState = "ringing" | "completed" | "busy" | "fail" | "noanswer" | "canceled" | "answered" | "undialed"; export type CallSummariesCallType = "carrier" | "sip" | "trunking" | "client"; export type CallSummariesProcessingState = "complete" | "partial"; export type CallSummariesProcessingStateRequest = "completed" | "started" | "partial" | "all"; export type CallSummariesSortBy = "start_time" | "end_time"; /** * Options to pass to each */ export interface CallSummariesListInstanceEachOptions { /** A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */ from?: string; /** A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */ to?: string; /** An origination carrier. */ fromCarrier?: string; /** A destination carrier. */ toCarrier?: string; /** A source country code based on phone number in From. */ fromCountryCode?: string; /** A destination country code. Based on phone number in To. */ toCountryCode?: string; /** A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. */ branded?: boolean; /** A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. */ verifiedCaller?: boolean; /** A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). */ hasTag?: boolean; /** A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. */ startTime?: string; /** An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. */ endTime?: string; /** A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`. */ callType?: string; /** A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`. */ callState?: string; /** A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`. */ direction?: string; /** A Processing State of the Call Summaries. One of `completed`, `partial` or `all`. */ processingState?: CallSummariesProcessingStateRequest; /** A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`. */ sortBy?: CallSummariesSortBy; /** A unique SID identifier of a Subaccount. */ subaccount?: string; /** A boolean flag indicating an abnormal session where the last SIP response was not 200 OK. */ abnormalSession?: boolean; /** An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`. */ answeredBy?: CallSummariesAnsweredBy; /** Either machine or human. */ answeredByAnnotation?: string; /** A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`. */ connectivityIssueAnnotation?: string; /** A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. */ qualityIssueAnnotation?: string; /** A boolean flag indicating spam calls. */ spamAnnotation?: boolean; /** A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */ callScoreAnnotation?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CallSummariesInstance, 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 CallSummariesListInstanceOptions { /** A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */ from?: string; /** A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */ to?: string; /** An origination carrier. */ fromCarrier?: string; /** A destination carrier. */ toCarrier?: string; /** A source country code based on phone number in From. */ fromCountryCode?: string; /** A destination country code. Based on phone number in To. */ toCountryCode?: string; /** A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. */ branded?: boolean; /** A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. */ verifiedCaller?: boolean; /** A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). */ hasTag?: boolean; /** A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. */ startTime?: string; /** An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. */ endTime?: string; /** A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`. */ callType?: string; /** A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`. */ callState?: string; /** A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`. */ direction?: string; /** A Processing State of the Call Summaries. One of `completed`, `partial` or `all`. */ processingState?: CallSummariesProcessingStateRequest; /** A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`. */ sortBy?: CallSummariesSortBy; /** A unique SID identifier of a Subaccount. */ subaccount?: string; /** A boolean flag indicating an abnormal session where the last SIP response was not 200 OK. */ abnormalSession?: boolean; /** An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`. */ answeredBy?: CallSummariesAnsweredBy; /** Either machine or human. */ answeredByAnnotation?: string; /** A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`. */ connectivityIssueAnnotation?: string; /** A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. */ qualityIssueAnnotation?: string; /** A boolean flag indicating spam calls. */ spamAnnotation?: boolean; /** A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */ callScoreAnnotation?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CallSummariesListInstancePageOptions { /** A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */ from?: string; /** A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. */ to?: string; /** An origination carrier. */ fromCarrier?: string; /** A destination carrier. */ toCarrier?: string; /** A source country code based on phone number in From. */ fromCountryCode?: string; /** A destination country code. Based on phone number in To. */ toCountryCode?: string; /** A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. */ branded?: boolean; /** A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. */ verifiedCaller?: boolean; /** A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). */ hasTag?: boolean; /** A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. */ startTime?: string; /** An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. */ endTime?: string; /** A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`. */ callType?: string; /** A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`. */ callState?: string; /** A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`. */ direction?: string; /** A Processing State of the Call Summaries. One of `completed`, `partial` or `all`. */ processingState?: CallSummariesProcessingStateRequest; /** A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`. */ sortBy?: CallSummariesSortBy; /** A unique SID identifier of a Subaccount. */ subaccount?: string; /** A boolean flag indicating an abnormal session where the last SIP response was not 200 OK. */ abnormalSession?: boolean; /** An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`. */ answeredBy?: CallSummariesAnsweredBy; /** Either machine or human. */ answeredByAnnotation?: string; /** A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`. */ connectivityIssueAnnotation?: string; /** A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. */ qualityIssueAnnotation?: string; /** A boolean flag indicating spam calls. */ spamAnnotation?: boolean; /** A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */ callScoreAnnotation?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CallSummariesSolution { } export interface CallSummariesListInstance { _version: V1; _solution: CallSummariesSolution; _uri: string; /** * Streams CallSummariesInstance 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 { CallSummariesListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CallSummariesInstance, done: (err?: Error) => void) => void): void; each(params: CallSummariesListInstanceEachOptions, callback?: (item: CallSummariesInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CallSummariesInstance 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: CallSummariesPage) => any): Promise<CallSummariesPage>; /** * Lists CallSummariesInstance 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 { CallSummariesListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CallSummariesInstance[]) => any): Promise<CallSummariesInstance[]>; list(params: CallSummariesListInstanceOptions, callback?: (error: Error | null, items: CallSummariesInstance[]) => any): Promise<CallSummariesInstance[]>; /** * Retrieve a single page of CallSummariesInstance 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 { CallSummariesListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CallSummariesPage) => any): Promise<CallSummariesPage>; page(params: CallSummariesListInstancePageOptions, callback?: (error: Error | null, items: CallSummariesPage) => any): Promise<CallSummariesPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CallSummariesListInstance(version: V1): CallSummariesListInstance; interface CallSummariesPayload extends TwilioResponsePayload { call_summaries: CallSummariesResource[]; } interface CallSummariesResource { account_sid: string; call_sid: string; answered_by: CallSummariesAnsweredBy; call_type: CallSummariesCallType; call_state: CallSummariesCallState; processing_state: CallSummariesProcessingState; created_time: Date; start_time: Date; end_time: Date; duration: number; connect_duration: number; from: any; to: any; carrier_edge: any; client_edge: any; sdk_edge: any; sip_edge: any; tags: Array<string>; url: string; attributes: any; properties: any; trust: any; annotation: any; } export declare class CallSummariesInstance { protected _version: V1; constructor(_version: V1, payload: CallSummariesResource); /** * The unique SID identifier of the Account. */ accountSid: string; /** * The unique SID identifier of the Call. */ callSid: string; answeredBy: CallSummariesAnsweredBy; callType: CallSummariesCallType; callState: CallSummariesCallState; processingState: CallSummariesProcessingState; /** * The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS */ createdTime: Date; /** * The time at which the Call was started, given in ISO 8601 format. */ startTime: Date; /** * The time at which the Call was ended, given in ISO 8601 format. */ endTime: Date; /** * Duration between when the call was initiated and the call was ended */ duration: number; /** * Duration between when the call was answered and when it ended */ connectDuration: number; /** * The calling party. */ from: any; /** * The called party. */ to: any; /** * Contains metrics and properties for the Twilio media gateway of a PSTN call. */ carrierEdge: any; /** * Contains metrics and properties for the Twilio media gateway of a Client call. */ clientEdge: any; /** * Contains metrics and properties for the SDK sensor library for Client calls. */ sdkEdge: any; /** * Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call. */ sipEdge: any; /** * Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality. */ tags: Array<string>; /** * The URL of this resource. */ url: string; /** * Attributes capturing call-flow-specific details. */ attributes: any; /** * Contains edge-agnostic call-level details. */ properties: any; /** * Contains trusted communications details including Branded Call and verified caller ID. */ trust: any; annotation: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; callSid: string; answeredBy: CallSummariesAnsweredBy; callType: CallSummariesCallType; callState: CallSummariesCallState; processingState: CallSummariesProcessingState; createdTime: Date; startTime: Date; endTime: Date; duration: number; connectDuration: number; from: any; to: any; carrierEdge: any; clientEdge: any; sdkEdge: any; sipEdge: any; tags: string[]; url: string; attributes: any; properties: any; trust: any; annotation: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class CallSummariesPage extends Page<V1, CallSummariesPayload, CallSummariesResource, CallSummariesInstance> { /** * Initialize the CallSummariesPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CallSummariesSolution); /** * Build an instance of CallSummariesInstance * * @param payload - Payload response from the API */ getInstance(payload: CallSummariesResource): CallSummariesInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/insights/v1/call.js000064400000011450151677225100011157 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.CallListInstance = exports.CallInstance = exports.CallContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const annotation_1 = require("./call/annotation"); const callSummary_1 = require("./call/callSummary"); const event_1 = require("./call/event"); const metric_1 = require("./call/metric"); class CallContextImpl { 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 = `/Voice/${sid}`; } get annotation() { this._annotation = this._annotation || (0, annotation_1.AnnotationListInstance)(this._version, this._solution.sid); return this._annotation; } get summary() { this._summary = this._summary || (0, callSummary_1.CallSummaryListInstance)(this._version, this._solution.sid); return this._summary; } get events() { this._events = this._events || (0, event_1.EventListInstance)(this._version, this._solution.sid); return this._events; } get metrics() { this._metrics = this._metrics || (0, metric_1.MetricListInstance)(this._version, this._solution.sid); return this._metrics; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CallInstance(operationVersion, payload, 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.CallContextImpl = CallContextImpl; class CallInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CallContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the annotation. */ annotation() { return this._proxy.annotation; } /** * Access the summary. */ summary() { return this._proxy.summary; } /** * Access the events. */ events() { return this._proxy.events; } /** * Access the metrics. */ metrics() { return this._proxy.metrics; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CallInstance = CallInstance; function CallListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CallContextImpl(version, sid); }; 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; } exports.CallListInstance = CallListInstance; rest/insights/v1/room.js000064400000023000151677225100011212 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.RoomPage = exports.RoomListInstance = exports.RoomInstance = exports.RoomContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const participant_1 = require("./room/participant"); class RoomContextImpl { constructor(_version, roomSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } this._solution = { roomSid }; this._uri = `/Video/Rooms/${roomSid}`; } get participants() { this._participants = this._participants || (0, participant_1.ParticipantListInstance)(this._version, this._solution.roomSid); return this._participants; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RoomInstance(operationVersion, payload, instance._solution.roomSid)); 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.RoomContextImpl = RoomContextImpl; class RoomInstance { constructor(_version, payload, roomSid) { this._version = _version; this.accountSid = payload.account_sid; this.roomSid = payload.room_sid; this.roomName = payload.room_name; this.createTime = deserialize.iso8601DateTime(payload.create_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.roomType = payload.room_type; this.roomStatus = payload.room_status; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.createdMethod = payload.created_method; this.endReason = payload.end_reason; this.maxParticipants = deserialize.integer(payload.max_participants); this.uniqueParticipants = deserialize.integer(payload.unique_participants); this.uniqueParticipantIdentities = deserialize.integer(payload.unique_participant_identities); this.concurrentParticipants = deserialize.integer(payload.concurrent_participants); this.maxConcurrentParticipants = deserialize.integer(payload.max_concurrent_participants); this.codecs = payload.codecs; this.mediaRegion = payload.media_region; this.durationSec = payload.duration_sec; this.totalParticipantDurationSec = payload.total_participant_duration_sec; this.totalRecordingDurationSec = payload.total_recording_duration_sec; this.processingState = payload.processing_state; this.recordingEnabled = payload.recording_enabled; this.edgeLocation = payload.edge_location; this.url = payload.url; this.links = payload.links; this._solution = { roomSid: roomSid || this.roomSid }; } get _proxy() { this._context = this._context || new RoomContextImpl(this._version, this._solution.roomSid); return this._context; } /** * Fetch a RoomInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the participants. */ participants() { return this._proxy.participants; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, roomSid: this.roomSid, roomName: this.roomName, createTime: this.createTime, endTime: this.endTime, roomType: this.roomType, roomStatus: this.roomStatus, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, createdMethod: this.createdMethod, endReason: this.endReason, maxParticipants: this.maxParticipants, uniqueParticipants: this.uniqueParticipants, uniqueParticipantIdentities: this.uniqueParticipantIdentities, concurrentParticipants: this.concurrentParticipants, maxConcurrentParticipants: this.maxConcurrentParticipants, codecs: this.codecs, mediaRegion: this.mediaRegion, durationSec: this.durationSec, totalParticipantDurationSec: this.totalParticipantDurationSec, totalRecordingDurationSec: this.totalRecordingDurationSec, processingState: this.processingState, recordingEnabled: this.recordingEnabled, edgeLocation: this.edgeLocation, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoomInstance = RoomInstance; function RoomListInstance(version) { const instance = ((roomSid) => instance.get(roomSid)); instance.get = function get(roomSid) { return new RoomContextImpl(version, roomSid); }; instance._version = version; instance._solution = {}; instance._uri = `/Video/Rooms`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["roomType"] !== undefined) data["RoomType"] = serialize.map(params["roomType"], (e) => e); if (params["codec"] !== undefined) data["Codec"] = serialize.map(params["codec"], (e) => e); if (params["roomName"] !== undefined) data["RoomName"] = params["roomName"]; if (params["createdAfter"] !== undefined) data["CreatedAfter"] = serialize.iso8601DateTime(params["createdAfter"]); if (params["createdBefore"] !== undefined) data["CreatedBefore"] = serialize.iso8601DateTime(params["createdBefore"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RoomPage(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 RoomPage(instance._version, payload, 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; } exports.RoomListInstance = RoomListInstance; class RoomPage extends Page_1.default { /** * Initialize the RoomPage * * @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 RoomInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RoomInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoomPage = RoomPage; rest/insights/v1/conference.d.ts000064400000035577151677225100012627 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { ConferenceParticipantListInstance } from "./conference/conferenceParticipant"; export type ConferenceConferenceEndReason = "last_participant_left" | "conference_ended_via_api" | "participant_with_end_conference_on_exit_left" | "last_participant_kicked" | "participant_with_end_conference_on_exit_kicked"; export type ConferenceConferenceStatus = "in_progress" | "not_started" | "completed" | "summary_timeout"; export type ConferenceProcessingState = "complete" | "in_progress" | "timeout"; export type ConferenceRegion = "us1" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "de1"; export type ConferenceTag = "invalid_requested_region" | "duplicate_identity" | "start_failure" | "region_configuration_issues" | "quality_warnings" | "participant_behavior_issues" | "high_packet_loss" | "high_jitter" | "high_latency" | "low_mos" | "detected_silence"; /** * Options to pass to each */ export interface ConferenceListInstanceEachOptions { /** The SID of the conference. */ conferenceSid?: string; /** Custom label for the conference resource, up to 64 characters. */ friendlyName?: string; /** Conference status. */ status?: string; /** Conferences created after the provided timestamp specified in ISO 8601 format */ createdAfter?: string; /** Conferences created before the provided timestamp specified in ISO 8601 format. */ createdBefore?: string; /** Twilio region where the conference media was mixed. */ mixerRegion?: string; /** Tags applied by Twilio for common potential configuration, quality, or performance issues. */ tags?: string; /** Account SID for the subaccount whose resources you wish to retrieve. */ subaccount?: string; /** Potential configuration, behavior, or performance issues detected during the conference. */ detectedIssues?: string; /** Conference end reason; e.g. last participant left, modified by API, etc. */ endReason?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ConferenceInstance, 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 ConferenceListInstanceOptions { /** The SID of the conference. */ conferenceSid?: string; /** Custom label for the conference resource, up to 64 characters. */ friendlyName?: string; /** Conference status. */ status?: string; /** Conferences created after the provided timestamp specified in ISO 8601 format */ createdAfter?: string; /** Conferences created before the provided timestamp specified in ISO 8601 format. */ createdBefore?: string; /** Twilio region where the conference media was mixed. */ mixerRegion?: string; /** Tags applied by Twilio for common potential configuration, quality, or performance issues. */ tags?: string; /** Account SID for the subaccount whose resources you wish to retrieve. */ subaccount?: string; /** Potential configuration, behavior, or performance issues detected during the conference. */ detectedIssues?: string; /** Conference end reason; e.g. last participant left, modified by API, etc. */ endReason?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ConferenceListInstancePageOptions { /** The SID of the conference. */ conferenceSid?: string; /** Custom label for the conference resource, up to 64 characters. */ friendlyName?: string; /** Conference status. */ status?: string; /** Conferences created after the provided timestamp specified in ISO 8601 format */ createdAfter?: string; /** Conferences created before the provided timestamp specified in ISO 8601 format. */ createdBefore?: string; /** Twilio region where the conference media was mixed. */ mixerRegion?: string; /** Tags applied by Twilio for common potential configuration, quality, or performance issues. */ tags?: string; /** Account SID for the subaccount whose resources you wish to retrieve. */ subaccount?: string; /** Potential configuration, behavior, or performance issues detected during the conference. */ detectedIssues?: string; /** Conference end reason; e.g. last participant left, modified by API, etc. */ endReason?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ConferenceContext { conferenceParticipants: ConferenceParticipantListInstance; /** * Fetch a ConferenceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ fetch(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConferenceContextSolution { conferenceSid: string; } export declare class ConferenceContextImpl implements ConferenceContext { protected _version: V1; protected _solution: ConferenceContextSolution; protected _uri: string; protected _conferenceParticipants?: ConferenceParticipantListInstance; constructor(_version: V1, conferenceSid: string); get conferenceParticipants(): ConferenceParticipantListInstance; fetch(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConferenceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConferencePayload extends TwilioResponsePayload { conferences: ConferenceResource[]; } interface ConferenceResource { conference_sid: string; account_sid: string; friendly_name: string; create_time: Date; start_time: Date; end_time: Date; duration_seconds: number; connect_duration_seconds: number; status: ConferenceConferenceStatus; max_participants: number; max_concurrent_participants: number; unique_participants: number; end_reason: ConferenceConferenceEndReason; ended_by: string; mixer_region: ConferenceRegion; mixer_region_requested: ConferenceRegion; recording_enabled: boolean; detected_issues: any; tags: Array<ConferenceTag>; tag_info: any; processing_state: ConferenceProcessingState; url: string; links: Record<string, string>; } export declare class ConferenceInstance { protected _version: V1; protected _solution: ConferenceContextSolution; protected _context?: ConferenceContext; constructor(_version: V1, payload: ConferenceResource, conferenceSid?: string); /** * The unique SID identifier of the Conference. */ conferenceSid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * Custom label for the conference resource, up to 64 characters. */ friendlyName: string; /** * Conference creation date and time in ISO 8601 format. */ createTime: Date; /** * Timestamp in ISO 8601 format when the conference started. Conferences do not start until at least two participants join, at least one of whom has startConferenceOnEnter=true. */ startTime: Date; /** * Conference end date and time in ISO 8601 format. */ endTime: Date; /** * Conference duration in seconds. */ durationSeconds: number; /** * Duration of the between conference start event and conference end event in seconds. */ connectDurationSeconds: number; status: ConferenceConferenceStatus; /** * Maximum number of concurrent participants as specified by the configuration. */ maxParticipants: number; /** * Actual maximum number of concurrent participants in the conference. */ maxConcurrentParticipants: number; /** * Unique conference participants based on caller ID. */ uniqueParticipants: number; endReason: ConferenceConferenceEndReason; /** * Call SID of the participant whose actions ended the conference. */ endedBy: string; mixerRegion: ConferenceRegion; mixerRegionRequested: ConferenceRegion; /** * Boolean. Indicates whether recording was enabled at the conference mixer. */ recordingEnabled: boolean; /** * Potential issues detected by Twilio during the conference. */ detectedIssues: any; /** * Tags for detected conference conditions and participant behaviors which may be of interest. */ tags: Array<ConferenceTag>; /** * Object. Contains details about conference tags including severity. */ tagInfo: any; processingState: ConferenceProcessingState; /** * The URL of this resource. */ url: string; /** * Contains a dictionary of URL links to nested resources of this Conference. */ links: Record<string, string>; private get _proxy(); /** * Fetch a ConferenceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ fetch(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Access the conferenceParticipants. */ conferenceParticipants(): ConferenceParticipantListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { conferenceSid: string; accountSid: string; friendlyName: string; createTime: Date; startTime: Date; endTime: Date; durationSeconds: number; connectDurationSeconds: number; status: ConferenceConferenceStatus; maxParticipants: number; maxConcurrentParticipants: number; uniqueParticipants: number; endReason: ConferenceConferenceEndReason; endedBy: string; mixerRegion: ConferenceRegion; mixerRegionRequested: ConferenceRegion; recordingEnabled: boolean; detectedIssues: any; tags: ConferenceTag[]; tagInfo: any; processingState: ConferenceProcessingState; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConferenceSolution { } export interface ConferenceListInstance { _version: V1; _solution: ConferenceSolution; _uri: string; (conferenceSid: string): ConferenceContext; get(conferenceSid: string): ConferenceContext; /** * Streams ConferenceInstance 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 { ConferenceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ConferenceInstance, done: (err?: Error) => void) => void): void; each(params: ConferenceListInstanceEachOptions, callback?: (item: ConferenceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ConferenceInstance 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: ConferencePage) => any): Promise<ConferencePage>; /** * Lists ConferenceInstance 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 { ConferenceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ConferenceInstance[]) => any): Promise<ConferenceInstance[]>; list(params: ConferenceListInstanceOptions, callback?: (error: Error | null, items: ConferenceInstance[]) => any): Promise<ConferenceInstance[]>; /** * Retrieve a single page of ConferenceInstance 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 { ConferenceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ConferencePage) => any): Promise<ConferencePage>; page(params: ConferenceListInstancePageOptions, callback?: (error: Error | null, items: ConferencePage) => any): Promise<ConferencePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConferenceListInstance(version: V1): ConferenceListInstance; export declare class ConferencePage extends Page<V1, ConferencePayload, ConferenceResource, ConferenceInstance> { /** * Initialize the ConferencePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ConferenceSolution); /** * Build an instance of ConferenceInstance * * @param payload - Payload response from the API */ getInstance(payload: ConferenceResource): ConferenceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/insights/v1/room.d.ts000064400000031417151677225100011461 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { ParticipantListInstance } from "./room/participant"; export type RoomCodec = "VP8" | "H264" | "VP9"; export type RoomCreatedMethod = "sdk" | "ad_hoc" | "api"; export type RoomEdgeLocation = "ashburn" | "dublin" | "frankfurt" | "singapore" | "sydney" | "sao_paulo" | "roaming" | "umatilla" | "tokyo"; export type RoomEndReason = "room_ended_via_api" | "timeout"; export type RoomProcessingState = "complete" | "in_progress"; export type RoomRoomStatus = "in_progress" | "completed"; export type RoomRoomType = "go" | "peer_to_peer" | "group" | "group_small"; export type RoomTwilioRealm = "us1" | "us2" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "in1" | "de1" | "gll"; /** * Options to pass to each */ export interface RoomListInstanceEachOptions { /** Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`. */ roomType?: Array<RoomRoomType>; /** Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. */ codec?: Array<RoomCodec>; /** Room friendly name. */ roomName?: string; /** Only read rooms that started on or after this ISO 8601 timestamp. */ createdAfter?: Date; /** Only read rooms that started before this ISO 8601 timestamp. */ createdBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: RoomInstance, 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 RoomListInstanceOptions { /** Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`. */ roomType?: Array<RoomRoomType>; /** Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. */ codec?: Array<RoomCodec>; /** Room friendly name. */ roomName?: string; /** Only read rooms that started on or after this ISO 8601 timestamp. */ createdAfter?: Date; /** Only read rooms that started before this ISO 8601 timestamp. */ createdBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface RoomListInstancePageOptions { /** Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`. */ roomType?: Array<RoomRoomType>; /** Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. */ codec?: Array<RoomCodec>; /** Room friendly name. */ roomName?: string; /** Only read rooms that started on or after this ISO 8601 timestamp. */ createdAfter?: Date; /** Only read rooms that started before this ISO 8601 timestamp. */ createdBefore?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface RoomContext { participants: ParticipantListInstance; /** * Fetch a RoomInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ fetch(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RoomContextSolution { roomSid: string; } export declare class RoomContextImpl implements RoomContext { protected _version: V1; protected _solution: RoomContextSolution; protected _uri: string; protected _participants?: ParticipantListInstance; constructor(_version: V1, roomSid: string); get participants(): ParticipantListInstance; fetch(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RoomContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RoomPayload extends TwilioResponsePayload { rooms: RoomResource[]; } interface RoomResource { account_sid: string; room_sid: string; room_name: string; create_time: Date; end_time: Date; room_type: RoomRoomType; room_status: RoomRoomStatus; status_callback: string; status_callback_method: string; created_method: RoomCreatedMethod; end_reason: RoomEndReason; max_participants: number; unique_participants: number; unique_participant_identities: number; concurrent_participants: number; max_concurrent_participants: number; codecs: Array<RoomCodec>; media_region: RoomTwilioRealm; duration_sec: number; total_participant_duration_sec: number; total_recording_duration_sec: number; processing_state: RoomProcessingState; recording_enabled: boolean; edge_location: RoomEdgeLocation; url: string; links: Record<string, string>; } export declare class RoomInstance { protected _version: V1; protected _solution: RoomContextSolution; protected _context?: RoomContext; constructor(_version: V1, payload: RoomResource, roomSid?: string); /** * Account SID associated with this room. */ accountSid: string; /** * Unique identifier for the room. */ roomSid: string; /** * Room friendly name. */ roomName: string; /** * Creation time of the room. */ createTime: Date; /** * End time for the room. */ endTime: Date; roomType: RoomRoomType; roomStatus: RoomRoomStatus; /** * Webhook provided for status callbacks. */ statusCallback: string; /** * HTTP method provided for status callback URL. */ statusCallbackMethod: string; createdMethod: RoomCreatedMethod; endReason: RoomEndReason; /** * Max number of total participants allowed by the application settings. */ maxParticipants: number; /** * Number of participants. May include duplicate identities for participants who left and rejoined. */ uniqueParticipants: number; /** * Unique number of participant identities. */ uniqueParticipantIdentities: number; /** * Actual number of concurrent participants. */ concurrentParticipants: number; /** * Maximum number of participants allowed in the room at the same time allowed by the application settings. */ maxConcurrentParticipants: number; /** * Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. */ codecs: Array<RoomCodec>; mediaRegion: RoomTwilioRealm; /** * Total room duration from create time to end time. */ durationSec: number; /** * Combined amount of participant time in the room. */ totalParticipantDurationSec: number; /** * Combined amount of recorded seconds for participants in the room. */ totalRecordingDurationSec: number; processingState: RoomProcessingState; /** * Boolean indicating if recording is enabled for the room. */ recordingEnabled: boolean; edgeLocation: RoomEdgeLocation; /** * URL for the room resource. */ url: string; /** * Room subresources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a RoomInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoomInstance */ fetch(callback?: (error: Error | null, item?: RoomInstance) => any): Promise<RoomInstance>; /** * Access the participants. */ participants(): ParticipantListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; roomSid: string; roomName: string; createTime: Date; endTime: Date; roomType: RoomRoomType; roomStatus: RoomRoomStatus; statusCallback: string; statusCallbackMethod: string; createdMethod: RoomCreatedMethod; endReason: RoomEndReason; maxParticipants: number; uniqueParticipants: number; uniqueParticipantIdentities: number; concurrentParticipants: number; maxConcurrentParticipants: number; codecs: RoomCodec[]; mediaRegion: RoomTwilioRealm; durationSec: number; totalParticipantDurationSec: number; totalRecordingDurationSec: number; processingState: RoomProcessingState; recordingEnabled: boolean; edgeLocation: RoomEdgeLocation; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RoomSolution { } export interface RoomListInstance { _version: V1; _solution: RoomSolution; _uri: string; (roomSid: string): RoomContext; get(roomSid: string): RoomContext; /** * Streams RoomInstance 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 { RoomListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void; each(params: RoomListInstanceEachOptions, callback?: (item: RoomInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RoomInstance 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: RoomPage) => any): Promise<RoomPage>; /** * Lists RoomInstance 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 { RoomListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoomInstance[]) => any): Promise<RoomInstance[]>; list(params: RoomListInstanceOptions, callback?: (error: Error | null, items: RoomInstance[]) => any): Promise<RoomInstance[]>; /** * Retrieve a single page of RoomInstance 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 { RoomListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>; page(params: RoomListInstancePageOptions, callback?: (error: Error | null, items: RoomPage) => any): Promise<RoomPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RoomListInstance(version: V1): RoomListInstance; export declare class RoomPage extends Page<V1, RoomPayload, RoomResource, RoomInstance> { /** * Initialize the RoomPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RoomSolution); /** * Build an instance of RoomInstance * * @param payload - Payload response from the API */ getInstance(payload: RoomResource): RoomInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/insights/v1/call.d.ts000064400000006706151677225100011423 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; import { AnnotationListInstance } from "./call/annotation"; import { CallSummaryListInstance } from "./call/callSummary"; import { EventListInstance } from "./call/event"; import { MetricListInstance } from "./call/metric"; export interface CallContext { annotation: AnnotationListInstance; summary: CallSummaryListInstance; events: EventListInstance; metrics: MetricListInstance; /** * Fetch a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ fetch(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CallContextSolution { sid: string; } export declare class CallContextImpl implements CallContext { protected _version: V1; protected _solution: CallContextSolution; protected _uri: string; protected _annotation?: AnnotationListInstance; protected _summary?: CallSummaryListInstance; protected _events?: EventListInstance; protected _metrics?: MetricListInstance; constructor(_version: V1, sid: string); get annotation(): AnnotationListInstance; get summary(): CallSummaryListInstance; get events(): EventListInstance; get metrics(): MetricListInstance; fetch(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CallContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CallResource { sid: string; url: string; links: Record<string, string>; } export declare class CallInstance { protected _version: V1; protected _solution: CallContextSolution; protected _context?: CallContext; constructor(_version: V1, payload: CallResource, sid?: string); sid: string; url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ fetch(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Access the annotation. */ annotation(): AnnotationListInstance; /** * Access the summary. */ summary(): CallSummaryListInstance; /** * Access the events. */ events(): EventListInstance; /** * Access the metrics. */ metrics(): MetricListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CallSolution { } export interface CallListInstance { _version: V1; _solution: CallSolution; _uri: string; (sid: string): CallContext; get(sid: string): CallContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CallListInstance(version: V1): CallListInstance; export {}; rest/insights/v1/conference/conferenceParticipant.js000064400000023701151677225100016663 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.ConferenceParticipantPage = exports.ConferenceParticipantListInstance = exports.ConferenceParticipantInstance = exports.ConferenceParticipantContextImpl = void 0; 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 ConferenceParticipantContextImpl { constructor(_version, conferenceSid, participantSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(conferenceSid)) { throw new Error("Parameter 'conferenceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(participantSid)) { throw new Error("Parameter 'participantSid' is not valid."); } this._solution = { conferenceSid, participantSid }; this._uri = `/Conferences/${conferenceSid}/Participants/${participantSid}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["events"] !== undefined) data["Events"] = params["events"]; if (params["metrics"] !== undefined) data["Metrics"] = params["metrics"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConferenceParticipantInstance(operationVersion, payload, instance._solution.conferenceSid, instance._solution.participantSid)); 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.ConferenceParticipantContextImpl = ConferenceParticipantContextImpl; class ConferenceParticipantInstance { constructor(_version, payload, conferenceSid, participantSid) { this._version = _version; this.participantSid = payload.participant_sid; this.label = payload.label; this.conferenceSid = payload.conference_sid; this.callSid = payload.call_sid; this.accountSid = payload.account_sid; this.callDirection = payload.call_direction; this.from = payload.from; this.to = payload.to; this.callStatus = payload.call_status; this.countryCode = payload.country_code; this.isModerator = payload.is_moderator; this.joinTime = deserialize.iso8601DateTime(payload.join_time); this.leaveTime = deserialize.iso8601DateTime(payload.leave_time); this.durationSeconds = deserialize.integer(payload.duration_seconds); this.outboundQueueLength = deserialize.integer(payload.outbound_queue_length); this.outboundTimeInQueue = deserialize.integer(payload.outbound_time_in_queue); this.jitterBufferSize = payload.jitter_buffer_size; this.isCoach = payload.is_coach; this.coachedParticipants = payload.coached_participants; this.participantRegion = payload.participant_region; this.conferenceRegion = payload.conference_region; this.callType = payload.call_type; this.processingState = payload.processing_state; this.properties = payload.properties; this.events = payload.events; this.metrics = payload.metrics; this.url = payload.url; this._solution = { conferenceSid, participantSid: participantSid || this.participantSid, }; } get _proxy() { this._context = this._context || new ConferenceParticipantContextImpl(this._version, this._solution.conferenceSid, this._solution.participantSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { participantSid: this.participantSid, label: this.label, conferenceSid: this.conferenceSid, callSid: this.callSid, accountSid: this.accountSid, callDirection: this.callDirection, from: this.from, to: this.to, callStatus: this.callStatus, countryCode: this.countryCode, isModerator: this.isModerator, joinTime: this.joinTime, leaveTime: this.leaveTime, durationSeconds: this.durationSeconds, outboundQueueLength: this.outboundQueueLength, outboundTimeInQueue: this.outboundTimeInQueue, jitterBufferSize: this.jitterBufferSize, isCoach: this.isCoach, coachedParticipants: this.coachedParticipants, participantRegion: this.participantRegion, conferenceRegion: this.conferenceRegion, callType: this.callType, processingState: this.processingState, properties: this.properties, events: this.events, metrics: this.metrics, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConferenceParticipantInstance = ConferenceParticipantInstance; function ConferenceParticipantListInstance(version, conferenceSid) { if (!(0, utility_1.isValidPathParam)(conferenceSid)) { throw new Error("Parameter 'conferenceSid' is not valid."); } const instance = ((participantSid) => instance.get(participantSid)); instance.get = function get(participantSid) { return new ConferenceParticipantContextImpl(version, conferenceSid, participantSid); }; instance._version = version; instance._solution = { conferenceSid }; instance._uri = `/Conferences/${conferenceSid}/Participants`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["participantSid"] !== undefined) data["ParticipantSid"] = params["participantSid"]; if (params["label"] !== undefined) data["Label"] = params["label"]; if (params["events"] !== undefined) data["Events"] = params["events"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConferenceParticipantPage(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 ConferenceParticipantPage(instance._version, payload, 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; } exports.ConferenceParticipantListInstance = ConferenceParticipantListInstance; class ConferenceParticipantPage extends Page_1.default { /** * Initialize the ConferenceParticipantPage * * @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 ConferenceParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ConferenceParticipantInstance(this._version, payload, this._solution.conferenceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConferenceParticipantPage = ConferenceParticipantPage; rest/insights/v1/conference/conferenceParticipant.d.ts000064400000035235151677225100017124 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type ConferenceParticipantCallDirection = "inbound" | "outbound"; export type ConferenceParticipantCallStatus = "answered" | "completed" | "busy" | "fail" | "noanswer" | "ringing" | "canceled"; export type ConferenceParticipantCallType = "carrier" | "client" | "sip"; export type ConferenceParticipantJitterBufferSize = "large" | "small" | "medium" | "off"; export type ConferenceParticipantProcessingState = "complete" | "in_progress" | "timeout"; export type ConferenceParticipantRegion = "us1" | "us2" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "de1"; /** * Options to pass to fetch a ConferenceParticipantInstance */ export interface ConferenceParticipantContextFetchOptions { /** Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. */ events?: string; /** Object. Contains participant call quality metrics. */ metrics?: string; } /** * Options to pass to each */ export interface ConferenceParticipantListInstanceEachOptions { /** The unique SID identifier of the Participant. */ participantSid?: string; /** User-specified label for a participant. */ label?: string; /** Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. */ events?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ConferenceParticipantInstance, 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 ConferenceParticipantListInstanceOptions { /** The unique SID identifier of the Participant. */ participantSid?: string; /** User-specified label for a participant. */ label?: string; /** Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. */ events?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ConferenceParticipantListInstancePageOptions { /** The unique SID identifier of the Participant. */ participantSid?: string; /** User-specified label for a participant. */ label?: string; /** Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. */ events?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ConferenceParticipantContext { /** * Fetch a ConferenceParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceParticipantInstance */ fetch(callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>; /** * Fetch a ConferenceParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceParticipantInstance */ fetch(params: ConferenceParticipantContextFetchOptions, callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConferenceParticipantContextSolution { conferenceSid: string; participantSid: string; } export declare class ConferenceParticipantContextImpl implements ConferenceParticipantContext { protected _version: V1; protected _solution: ConferenceParticipantContextSolution; protected _uri: string; constructor(_version: V1, conferenceSid: string, participantSid: string); fetch(params?: ConferenceParticipantContextFetchOptions | ((error: Error | null, item?: ConferenceParticipantInstance) => any), callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConferenceParticipantContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConferenceParticipantPayload extends TwilioResponsePayload { participants: ConferenceParticipantResource[]; } interface ConferenceParticipantResource { participant_sid: string; label: string; conference_sid: string; call_sid: string; account_sid: string; call_direction: ConferenceParticipantCallDirection; from: string; to: string; call_status: ConferenceParticipantCallStatus; country_code: string; is_moderator: boolean; join_time: Date; leave_time: Date; duration_seconds: number; outbound_queue_length: number; outbound_time_in_queue: number; jitter_buffer_size: ConferenceParticipantJitterBufferSize; is_coach: boolean; coached_participants: Array<string>; participant_region: ConferenceParticipantRegion; conference_region: ConferenceParticipantRegion; call_type: ConferenceParticipantCallType; processing_state: ConferenceParticipantProcessingState; properties: any; events: any; metrics: any; url: string; } export declare class ConferenceParticipantInstance { protected _version: V1; protected _solution: ConferenceParticipantContextSolution; protected _context?: ConferenceParticipantContext; constructor(_version: V1, payload: ConferenceParticipantResource, conferenceSid: string, participantSid?: string); /** * SID for this participant. */ participantSid: string; /** * The user-specified label of this participant. */ label: string; /** * The unique SID identifier of the Conference. */ conferenceSid: string; /** * Unique SID identifier of the call that generated the Participant resource. */ callSid: string; /** * The unique SID identifier of the Account. */ accountSid: string; callDirection: ConferenceParticipantCallDirection; /** * Caller ID of the calling party. */ from: string; /** * Called party. */ to: string; callStatus: ConferenceParticipantCallStatus; /** * ISO alpha-2 country code of the participant based on caller ID or called number. */ countryCode: string; /** * Boolean. Indicates whether participant had startConferenceOnEnter=true or endConferenceOnExit=true. */ isModerator: boolean; /** * ISO 8601 timestamp of participant join event. */ joinTime: Date; /** * ISO 8601 timestamp of participant leave event. */ leaveTime: Date; /** * Participant durations in seconds. */ durationSeconds: number; /** * Add Participant API only. Estimated time in queue at call creation. */ outboundQueueLength: number; /** * Add Participant API only. Actual time in queue in seconds. */ outboundTimeInQueue: number; jitterBufferSize: ConferenceParticipantJitterBufferSize; /** * Boolean. Indicated whether participant was a coach. */ isCoach: boolean; /** * Call SIDs coached by this participant. */ coachedParticipants: Array<string>; participantRegion: ConferenceParticipantRegion; conferenceRegion: ConferenceParticipantRegion; callType: ConferenceParticipantCallType; processingState: ConferenceParticipantProcessingState; /** * Participant properties and metadata. */ properties: any; /** * Object containing information of actions taken by participants. Contains a dictionary of URL links to nested resources of this Conference Participant. */ events: any; /** * Object. Contains participant call quality metrics. */ metrics: any; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a ConferenceParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceParticipantInstance */ fetch(callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>; /** * Fetch a ConferenceParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceParticipantInstance */ fetch(params: ConferenceParticipantContextFetchOptions, callback?: (error: Error | null, item?: ConferenceParticipantInstance) => any): Promise<ConferenceParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { participantSid: string; label: string; conferenceSid: string; callSid: string; accountSid: string; callDirection: ConferenceParticipantCallDirection; from: string; to: string; callStatus: ConferenceParticipantCallStatus; countryCode: string; isModerator: boolean; joinTime: Date; leaveTime: Date; durationSeconds: number; outboundQueueLength: number; outboundTimeInQueue: number; jitterBufferSize: ConferenceParticipantJitterBufferSize; isCoach: boolean; coachedParticipants: string[]; participantRegion: ConferenceParticipantRegion; conferenceRegion: ConferenceParticipantRegion; callType: ConferenceParticipantCallType; processingState: ConferenceParticipantProcessingState; properties: any; events: any; metrics: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConferenceParticipantSolution { conferenceSid: string; } export interface ConferenceParticipantListInstance { _version: V1; _solution: ConferenceParticipantSolution; _uri: string; (participantSid: string): ConferenceParticipantContext; get(participantSid: string): ConferenceParticipantContext; /** * Streams ConferenceParticipantInstance 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 { ConferenceParticipantListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ConferenceParticipantInstance, done: (err?: Error) => void) => void): void; each(params: ConferenceParticipantListInstanceEachOptions, callback?: (item: ConferenceParticipantInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ConferenceParticipantInstance 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: ConferenceParticipantPage) => any): Promise<ConferenceParticipantPage>; /** * Lists ConferenceParticipantInstance 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 { ConferenceParticipantListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ConferenceParticipantInstance[]) => any): Promise<ConferenceParticipantInstance[]>; list(params: ConferenceParticipantListInstanceOptions, callback?: (error: Error | null, items: ConferenceParticipantInstance[]) => any): Promise<ConferenceParticipantInstance[]>; /** * Retrieve a single page of ConferenceParticipantInstance 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 { ConferenceParticipantListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ConferenceParticipantPage) => any): Promise<ConferenceParticipantPage>; page(params: ConferenceParticipantListInstancePageOptions, callback?: (error: Error | null, items: ConferenceParticipantPage) => any): Promise<ConferenceParticipantPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConferenceParticipantListInstance(version: V1, conferenceSid: string): ConferenceParticipantListInstance; export declare class ConferenceParticipantPage extends Page<V1, ConferenceParticipantPayload, ConferenceParticipantResource, ConferenceParticipantInstance> { /** * Initialize the ConferenceParticipantPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ConferenceParticipantSolution); /** * Build an instance of ConferenceParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload: ConferenceParticipantResource): ConferenceParticipantInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/insights/v1/setting.js000064400000011532151677225100011722 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.SettingListInstance = exports.SettingInstance = exports.SettingContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class SettingContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/Voice/Settings`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["subaccountSid"] !== undefined) data["SubaccountSid"] = params["subaccountSid"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SettingInstance(operationVersion, payload)); 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["advancedFeatures"] !== undefined) data["AdvancedFeatures"] = serialize.bool(params["advancedFeatures"]); if (params["voiceTrace"] !== undefined) data["VoiceTrace"] = serialize.bool(params["voiceTrace"]); if (params["subaccountSid"] !== undefined) data["SubaccountSid"] = params["subaccountSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SettingInstance(operationVersion, payload)); 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.SettingContextImpl = SettingContextImpl; class SettingInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.advancedFeatures = payload.advanced_features; this.voiceTrace = payload.voice_trace; this.url = payload.url; this._solution = {}; } get _proxy() { this._context = this._context || new SettingContextImpl(this._version); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, advancedFeatures: this.advancedFeatures, voiceTrace: this.voiceTrace, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SettingInstance = SettingInstance; function SettingListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new SettingContextImpl(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; } exports.SettingListInstance = SettingListInstance; rest/insights/v1/room/participant.js000064400000020052151677225100013534 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.ParticipantPage = exports.ParticipantListInstance = exports.ParticipantInstance = exports.ParticipantContextImpl = void 0; 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 ParticipantContextImpl { constructor(_version, roomSid, participantSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(participantSid)) { throw new Error("Parameter 'participantSid' is not valid."); } this._solution = { roomSid, participantSid }; this._uri = `/Video/Rooms/${roomSid}/Participants/${participantSid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.roomSid, instance._solution.participantSid)); 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.ParticipantContextImpl = ParticipantContextImpl; class ParticipantInstance { constructor(_version, payload, roomSid, participantSid) { this._version = _version; this.participantSid = payload.participant_sid; this.participantIdentity = payload.participant_identity; this.joinTime = deserialize.iso8601DateTime(payload.join_time); this.leaveTime = deserialize.iso8601DateTime(payload.leave_time); this.durationSec = payload.duration_sec; this.accountSid = payload.account_sid; this.roomSid = payload.room_sid; this.status = payload.status; this.codecs = payload.codecs; this.endReason = payload.end_reason; this.errorCode = deserialize.integer(payload.error_code); this.errorCodeUrl = payload.error_code_url; this.mediaRegion = payload.media_region; this.properties = payload.properties; this.edgeLocation = payload.edge_location; this.publisherInfo = payload.publisher_info; this.url = payload.url; this._solution = { roomSid, participantSid: participantSid || this.participantSid, }; } get _proxy() { this._context = this._context || new ParticipantContextImpl(this._version, this._solution.roomSid, this._solution.participantSid); return this._context; } /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { participantSid: this.participantSid, participantIdentity: this.participantIdentity, joinTime: this.joinTime, leaveTime: this.leaveTime, durationSec: this.durationSec, accountSid: this.accountSid, roomSid: this.roomSid, status: this.status, codecs: this.codecs, endReason: this.endReason, errorCode: this.errorCode, errorCodeUrl: this.errorCodeUrl, mediaRegion: this.mediaRegion, properties: this.properties, edgeLocation: this.edgeLocation, publisherInfo: this.publisherInfo, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantInstance = ParticipantInstance; function ParticipantListInstance(version, roomSid) { if (!(0, utility_1.isValidPathParam)(roomSid)) { throw new Error("Parameter 'roomSid' is not valid."); } const instance = ((participantSid) => instance.get(participantSid)); instance.get = function get(participantSid) { return new ParticipantContextImpl(version, roomSid, participantSid); }; instance._version = version; instance._solution = { roomSid }; instance._uri = `/Video/Rooms/${roomSid}/Participants`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantPage(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 ParticipantPage(instance._version, payload, 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; } exports.ParticipantListInstance = ParticipantListInstance; class ParticipantPage extends Page_1.default { /** * Initialize the ParticipantPage * * @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 ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ParticipantInstance(this._version, payload, this._solution.roomSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantPage = ParticipantPage; rest/insights/v1/room/participant.d.ts000064400000024565151677225100014005 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type ParticipantCodec = "VP8" | "H264" | "VP9"; export type ParticipantEdgeLocation = "ashburn" | "dublin" | "frankfurt" | "singapore" | "sydney" | "sao_paulo" | "roaming" | "umatilla" | "tokyo"; export type ParticipantRoomStatus = "in_progress" | "completed"; export type ParticipantTwilioRealm = "us1" | "us2" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "in1" | "de1" | "gll"; /** * Options to pass to each */ export interface ParticipantListInstanceEachOptions { /** 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: ParticipantInstance, 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 ParticipantListInstanceOptions { /** 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 ParticipantListInstancePageOptions { /** 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 ParticipantContext { /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ParticipantContextSolution { roomSid: string; participantSid: string; } export declare class ParticipantContextImpl implements ParticipantContext { protected _version: V1; protected _solution: ParticipantContextSolution; protected _uri: string; constructor(_version: V1, roomSid: string, participantSid: string); fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ParticipantContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ParticipantPayload extends TwilioResponsePayload { participants: ParticipantResource[]; } interface ParticipantResource { participant_sid: string; participant_identity: string; join_time: Date; leave_time: Date; duration_sec: number; account_sid: string; room_sid: string; status: ParticipantRoomStatus; codecs: Array<ParticipantCodec>; end_reason: string; error_code: number; error_code_url: string; media_region: ParticipantTwilioRealm; properties: any; edge_location: ParticipantEdgeLocation; publisher_info: any; url: string; } export declare class ParticipantInstance { protected _version: V1; protected _solution: ParticipantContextSolution; protected _context?: ParticipantContext; constructor(_version: V1, payload: ParticipantResource, roomSid: string, participantSid?: string); /** * Unique identifier for the participant. */ participantSid: string; /** * The application-defined string that uniquely identifies the participant within a Room. */ participantIdentity: string; /** * When the participant joined the room. */ joinTime: Date; /** * When the participant left the room. */ leaveTime: Date; /** * Amount of time in seconds the participant was in the room. */ durationSec: number; /** * Account SID associated with the room. */ accountSid: string; /** * Unique identifier for the room. */ roomSid: string; status: ParticipantRoomStatus; /** * Codecs detected from the participant. Can be `VP8`, `H264`, or `VP9`. */ codecs: Array<ParticipantCodec>; /** * Reason the participant left the room. See [the list of possible values here](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#end_reason). */ endReason: string; /** * Errors encountered by the participant. */ errorCode: number; /** * Twilio error code dictionary link. */ errorCodeUrl: string; mediaRegion: ParticipantTwilioRealm; /** * Object containing information about the participant\'s data from the room. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#properties) for more information. */ properties: any; edgeLocation: ParticipantEdgeLocation; /** * Object containing information about the SDK name and version. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#publisher_info) for more information. */ publisherInfo: any; /** * URL of the participant resource. */ url: string; private get _proxy(); /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { participantSid: string; participantIdentity: string; joinTime: Date; leaveTime: Date; durationSec: number; accountSid: string; roomSid: string; status: ParticipantRoomStatus; codecs: ParticipantCodec[]; endReason: string; errorCode: number; errorCodeUrl: string; mediaRegion: ParticipantTwilioRealm; properties: any; edgeLocation: ParticipantEdgeLocation; publisherInfo: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ParticipantSolution { roomSid: string; } export interface ParticipantListInstance { _version: V1; _solution: ParticipantSolution; _uri: string; (participantSid: string): ParticipantContext; get(participantSid: string): ParticipantContext; /** * Streams ParticipantInstance 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 { ParticipantListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; each(params: ParticipantListInstanceEachOptions, callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ParticipantInstance 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: ParticipantPage) => any): Promise<ParticipantPage>; /** * Lists ParticipantInstance 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 { ParticipantListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; list(params: ParticipantListInstanceOptions, callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; /** * Retrieve a single page of ParticipantInstance 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 { ParticipantListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; page(params: ParticipantListInstancePageOptions, callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ParticipantListInstance(version: V1, roomSid: string): ParticipantListInstance; export declare class ParticipantPage extends Page<V1, ParticipantPayload, ParticipantResource, ParticipantInstance> { /** * Initialize the ParticipantPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ParticipantSolution); /** * Build an instance of ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload: ParticipantResource): ParticipantInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/insights/v1/callSummaries.js000064400000021320151677225100013042 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.CallSummariesPage = exports.CallSummariesInstance = exports.CallSummariesListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function CallSummariesListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Voice/Summaries`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["to"] !== undefined) data["To"] = params["to"]; if (params["fromCarrier"] !== undefined) data["FromCarrier"] = params["fromCarrier"]; if (params["toCarrier"] !== undefined) data["ToCarrier"] = params["toCarrier"]; if (params["fromCountryCode"] !== undefined) data["FromCountryCode"] = params["fromCountryCode"]; if (params["toCountryCode"] !== undefined) data["ToCountryCode"] = params["toCountryCode"]; if (params["branded"] !== undefined) data["Branded"] = serialize.bool(params["branded"]); if (params["verifiedCaller"] !== undefined) data["VerifiedCaller"] = serialize.bool(params["verifiedCaller"]); if (params["hasTag"] !== undefined) data["HasTag"] = serialize.bool(params["hasTag"]); if (params["startTime"] !== undefined) data["StartTime"] = params["startTime"]; if (params["endTime"] !== undefined) data["EndTime"] = params["endTime"]; if (params["callType"] !== undefined) data["CallType"] = params["callType"]; if (params["callState"] !== undefined) data["CallState"] = params["callState"]; if (params["direction"] !== undefined) data["Direction"] = params["direction"]; if (params["processingState"] !== undefined) data["ProcessingState"] = params["processingState"]; if (params["sortBy"] !== undefined) data["SortBy"] = params["sortBy"]; if (params["subaccount"] !== undefined) data["Subaccount"] = params["subaccount"]; if (params["abnormalSession"] !== undefined) data["AbnormalSession"] = serialize.bool(params["abnormalSession"]); if (params["answeredBy"] !== undefined) data["AnsweredBy"] = params["answeredBy"]; if (params["answeredByAnnotation"] !== undefined) data["AnsweredByAnnotation"] = params["answeredByAnnotation"]; if (params["connectivityIssueAnnotation"] !== undefined) data["ConnectivityIssueAnnotation"] = params["connectivityIssueAnnotation"]; if (params["qualityIssueAnnotation"] !== undefined) data["QualityIssueAnnotation"] = params["qualityIssueAnnotation"]; if (params["spamAnnotation"] !== undefined) data["SpamAnnotation"] = serialize.bool(params["spamAnnotation"]); if (params["callScoreAnnotation"] !== undefined) data["CallScoreAnnotation"] = params["callScoreAnnotation"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CallSummariesPage(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 CallSummariesPage(instance._version, payload, 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; } exports.CallSummariesListInstance = CallSummariesListInstance; class CallSummariesInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.callSid = payload.call_sid; this.answeredBy = payload.answered_by; this.callType = payload.call_type; this.callState = payload.call_state; this.processingState = payload.processing_state; this.createdTime = deserialize.iso8601DateTime(payload.created_time); this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.duration = deserialize.integer(payload.duration); this.connectDuration = deserialize.integer(payload.connect_duration); this.from = payload.from; this.to = payload.to; this.carrierEdge = payload.carrier_edge; this.clientEdge = payload.client_edge; this.sdkEdge = payload.sdk_edge; this.sipEdge = payload.sip_edge; this.tags = payload.tags; this.url = payload.url; this.attributes = payload.attributes; this.properties = payload.properties; this.trust = payload.trust; this.annotation = payload.annotation; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, callSid: this.callSid, answeredBy: this.answeredBy, callType: this.callType, callState: this.callState, processingState: this.processingState, createdTime: this.createdTime, startTime: this.startTime, endTime: this.endTime, duration: this.duration, connectDuration: this.connectDuration, from: this.from, to: this.to, carrierEdge: this.carrierEdge, clientEdge: this.clientEdge, sdkEdge: this.sdkEdge, sipEdge: this.sipEdge, tags: this.tags, url: this.url, attributes: this.attributes, properties: this.properties, trust: this.trust, annotation: this.annotation, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CallSummariesInstance = CallSummariesInstance; class CallSummariesPage extends Page_1.default { /** * Initialize the CallSummariesPage * * @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 CallSummariesInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CallSummariesInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CallSummariesPage = CallSummariesPage; rest/insights/v1/conference.js000064400000023547151677225100012365 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.ConferencePage = exports.ConferenceListInstance = exports.ConferenceInstance = exports.ConferenceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const conferenceParticipant_1 = require("./conference/conferenceParticipant"); class ConferenceContextImpl { constructor(_version, conferenceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(conferenceSid)) { throw new Error("Parameter 'conferenceSid' is not valid."); } this._solution = { conferenceSid }; this._uri = `/Conferences/${conferenceSid}`; } get conferenceParticipants() { this._conferenceParticipants = this._conferenceParticipants || (0, conferenceParticipant_1.ConferenceParticipantListInstance)(this._version, this._solution.conferenceSid); return this._conferenceParticipants; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ConferenceInstance(operationVersion, payload, instance._solution.conferenceSid)); 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.ConferenceContextImpl = ConferenceContextImpl; class ConferenceInstance { constructor(_version, payload, conferenceSid) { this._version = _version; this.conferenceSid = payload.conference_sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.createTime = deserialize.iso8601DateTime(payload.create_time); this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.durationSeconds = deserialize.integer(payload.duration_seconds); this.connectDurationSeconds = deserialize.integer(payload.connect_duration_seconds); this.status = payload.status; this.maxParticipants = deserialize.integer(payload.max_participants); this.maxConcurrentParticipants = deserialize.integer(payload.max_concurrent_participants); this.uniqueParticipants = deserialize.integer(payload.unique_participants); this.endReason = payload.end_reason; this.endedBy = payload.ended_by; this.mixerRegion = payload.mixer_region; this.mixerRegionRequested = payload.mixer_region_requested; this.recordingEnabled = payload.recording_enabled; this.detectedIssues = payload.detected_issues; this.tags = payload.tags; this.tagInfo = payload.tag_info; this.processingState = payload.processing_state; this.url = payload.url; this.links = payload.links; this._solution = { conferenceSid: conferenceSid || this.conferenceSid }; } get _proxy() { this._context = this._context || new ConferenceContextImpl(this._version, this._solution.conferenceSid); return this._context; } /** * Fetch a ConferenceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the conferenceParticipants. */ conferenceParticipants() { return this._proxy.conferenceParticipants; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { conferenceSid: this.conferenceSid, accountSid: this.accountSid, friendlyName: this.friendlyName, createTime: this.createTime, startTime: this.startTime, endTime: this.endTime, durationSeconds: this.durationSeconds, connectDurationSeconds: this.connectDurationSeconds, status: this.status, maxParticipants: this.maxParticipants, maxConcurrentParticipants: this.maxConcurrentParticipants, uniqueParticipants: this.uniqueParticipants, endReason: this.endReason, endedBy: this.endedBy, mixerRegion: this.mixerRegion, mixerRegionRequested: this.mixerRegionRequested, recordingEnabled: this.recordingEnabled, detectedIssues: this.detectedIssues, tags: this.tags, tagInfo: this.tagInfo, processingState: this.processingState, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConferenceInstance = ConferenceInstance; function ConferenceListInstance(version) { const instance = ((conferenceSid) => instance.get(conferenceSid)); instance.get = function get(conferenceSid) { return new ConferenceContextImpl(version, conferenceSid); }; instance._version = version; instance._solution = {}; instance._uri = `/Conferences`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["conferenceSid"] !== undefined) data["ConferenceSid"] = params["conferenceSid"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["createdAfter"] !== undefined) data["CreatedAfter"] = params["createdAfter"]; if (params["createdBefore"] !== undefined) data["CreatedBefore"] = params["createdBefore"]; if (params["mixerRegion"] !== undefined) data["MixerRegion"] = params["mixerRegion"]; if (params["tags"] !== undefined) data["Tags"] = params["tags"]; if (params["subaccount"] !== undefined) data["Subaccount"] = params["subaccount"]; if (params["detectedIssues"] !== undefined) data["DetectedIssues"] = params["detectedIssues"]; if (params["endReason"] !== undefined) data["EndReason"] = params["endReason"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConferencePage(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 ConferencePage(instance._version, payload, 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; } exports.ConferenceListInstance = ConferenceListInstance; class ConferencePage extends Page_1.default { /** * Initialize the ConferencePage * * @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 ConferenceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ConferenceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConferencePage = ConferencePage; rest/insights/v1/call/annotation.d.ts000064400000017423151677225100013573 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export type AnnotationAnsweredBy = "unknown_answered_by" | "human" | "machine"; export type AnnotationConnectivityIssue = "unknown_connectivity_issue" | "no_connectivity_issue" | "invalid_number" | "caller_id" | "dropped_call" | "number_reachability"; /** * Options to pass to update a AnnotationInstance */ export interface AnnotationContextUpdateOptions { /** */ answeredBy?: AnnotationAnsweredBy; /** */ connectivityIssue?: AnnotationConnectivityIssue; /** Specify if the call had any subjective quality issues. Possible values, one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. Use comma separated values to indicate multiple quality issues for the same call. */ qualityIssues?: string; /** A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use `true` if the call was a spam call. */ spam?: boolean; /** Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */ callScore?: number; /** Specify any comments pertaining to the call. `comment` has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the `comment`. */ comment?: string; /** Associate this call with an incident or support ticket. The `incident` parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`. */ incident?: string; } export interface AnnotationContext { /** * Fetch a AnnotationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AnnotationInstance */ fetch(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>; /** * Update a AnnotationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AnnotationInstance */ update(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>; /** * Update a AnnotationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AnnotationInstance */ update(params: AnnotationContextUpdateOptions, callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AnnotationContextSolution { callSid: string; } export declare class AnnotationContextImpl implements AnnotationContext { protected _version: V1; protected _solution: AnnotationContextSolution; protected _uri: string; constructor(_version: V1, callSid: string); fetch(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>; update(params?: AnnotationContextUpdateOptions | ((error: Error | null, item?: AnnotationInstance) => any), callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AnnotationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AnnotationResource { call_sid: string; account_sid: string; answered_by: AnnotationAnsweredBy; connectivity_issue: AnnotationConnectivityIssue; quality_issues: Array<string>; spam: boolean; call_score: number; comment: string; incident: string; url: string; } export declare class AnnotationInstance { protected _version: V1; protected _solution: AnnotationContextSolution; protected _context?: AnnotationContext; constructor(_version: V1, payload: AnnotationResource, callSid: string); /** * The unique SID identifier of the Call. */ callSid: string; /** * The unique SID identifier of the Account. */ accountSid: string; answeredBy: AnnotationAnsweredBy; connectivityIssue: AnnotationConnectivityIssue; /** * Specifies if the call had any subjective quality issues. Possible values are one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, or `static_noise`. */ qualityIssues: Array<string>; /** * Specifies if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call. */ spam: boolean; /** * Specifies the Call Score, if available. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. */ callScore: number; /** * Specifies any comments pertaining to the call. Twilio does not treat this field as PII, so no PII should be included in comments. */ comment: string; /** * Incident or support ticket associated with this call. The `incident` property is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`. */ incident: string; url: string; private get _proxy(); /** * Fetch a AnnotationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AnnotationInstance */ fetch(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>; /** * Update a AnnotationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AnnotationInstance */ update(callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>; /** * Update a AnnotationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AnnotationInstance */ update(params: AnnotationContextUpdateOptions, callback?: (error: Error | null, item?: AnnotationInstance) => any): Promise<AnnotationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { callSid: string; accountSid: string; answeredBy: AnnotationAnsweredBy; connectivityIssue: AnnotationConnectivityIssue; qualityIssues: string[]; spam: boolean; callScore: number; comment: string; incident: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AnnotationSolution { callSid: string; } export interface AnnotationListInstance { _version: V1; _solution: AnnotationSolution; _uri: string; (): AnnotationContext; get(): AnnotationContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AnnotationListInstance(version: V1, callSid: string): AnnotationListInstance; export {}; rest/insights/v1/call/annotation.js000064400000014002151677225100013325 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.AnnotationListInstance = exports.AnnotationInstance = exports.AnnotationContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class AnnotationContextImpl { constructor(_version, callSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } this._solution = { callSid }; this._uri = `/Voice/${callSid}/Annotation`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AnnotationInstance(operationVersion, payload, instance._solution.callSid)); 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["answeredBy"] !== undefined) data["AnsweredBy"] = params["answeredBy"]; if (params["connectivityIssue"] !== undefined) data["ConnectivityIssue"] = params["connectivityIssue"]; if (params["qualityIssues"] !== undefined) data["QualityIssues"] = params["qualityIssues"]; if (params["spam"] !== undefined) data["Spam"] = serialize.bool(params["spam"]); if (params["callScore"] !== undefined) data["CallScore"] = params["callScore"]; if (params["comment"] !== undefined) data["Comment"] = params["comment"]; if (params["incident"] !== undefined) data["Incident"] = params["incident"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AnnotationInstance(operationVersion, payload, instance._solution.callSid)); 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.AnnotationContextImpl = AnnotationContextImpl; class AnnotationInstance { constructor(_version, payload, callSid) { this._version = _version; this.callSid = payload.call_sid; this.accountSid = payload.account_sid; this.answeredBy = payload.answered_by; this.connectivityIssue = payload.connectivity_issue; this.qualityIssues = payload.quality_issues; this.spam = payload.spam; this.callScore = deserialize.integer(payload.call_score); this.comment = payload.comment; this.incident = payload.incident; this.url = payload.url; this._solution = { callSid }; } get _proxy() { this._context = this._context || new AnnotationContextImpl(this._version, this._solution.callSid); return this._context; } /** * Fetch a AnnotationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AnnotationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { callSid: this.callSid, accountSid: this.accountSid, answeredBy: this.answeredBy, connectivityIssue: this.connectivityIssue, qualityIssues: this.qualityIssues, spam: this.spam, callScore: this.callScore, comment: this.comment, incident: this.incident, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AnnotationInstance = AnnotationInstance; function AnnotationListInstance(version, callSid) { if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new AnnotationContextImpl(version, callSid); }; instance._version = version; instance._solution = { callSid }; 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; } exports.AnnotationListInstance = AnnotationListInstance; rest/insights/v1/call/metric.js000064400000012221151677225100012437 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.MetricPage = exports.MetricInstance = exports.MetricListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function MetricListInstance(version, callSid) { if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { callSid }; instance._uri = `/Voice/${callSid}/Metrics`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["edge"] !== undefined) data["Edge"] = params["edge"]; if (params["direction"] !== undefined) data["Direction"] = params["direction"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MetricPage(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 MetricPage(instance._version, payload, 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; } exports.MetricListInstance = MetricListInstance; class MetricInstance { constructor(_version, payload, callSid) { this._version = _version; this.timestamp = payload.timestamp; this.callSid = payload.call_sid; this.accountSid = payload.account_sid; this.edge = payload.edge; this.direction = payload.direction; this.carrierEdge = payload.carrier_edge; this.sipEdge = payload.sip_edge; this.sdkEdge = payload.sdk_edge; this.clientEdge = payload.client_edge; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { timestamp: this.timestamp, callSid: this.callSid, accountSid: this.accountSid, edge: this.edge, direction: this.direction, carrierEdge: this.carrierEdge, sipEdge: this.sipEdge, sdkEdge: this.sdkEdge, clientEdge: this.clientEdge, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MetricInstance = MetricInstance; class MetricPage extends Page_1.default { /** * Initialize the MetricPage * * @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 MetricInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MetricInstance(this._version, payload, this._solution.callSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MetricPage = MetricPage; rest/insights/v1/call/event.js000064400000012215151677225100012300 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.EventPage = exports.EventInstance = exports.EventListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function EventListInstance(version, callSid) { if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { callSid }; instance._uri = `/Voice/${callSid}/Events`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["edge"] !== undefined) data["Edge"] = params["edge"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EventPage(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 EventPage(instance._version, payload, 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; } exports.EventListInstance = EventListInstance; class EventInstance { constructor(_version, payload, callSid) { this._version = _version; this.timestamp = payload.timestamp; this.callSid = payload.call_sid; this.accountSid = payload.account_sid; this.edge = payload.edge; this.group = payload.group; this.level = payload.level; this.name = payload.name; this.carrierEdge = payload.carrier_edge; this.sipEdge = payload.sip_edge; this.sdkEdge = payload.sdk_edge; this.clientEdge = payload.client_edge; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { timestamp: this.timestamp, callSid: this.callSid, accountSid: this.accountSid, edge: this.edge, group: this.group, level: this.level, name: this.name, carrierEdge: this.carrierEdge, sipEdge: this.sipEdge, sdkEdge: this.sdkEdge, clientEdge: this.clientEdge, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventInstance = EventInstance; class EventPage extends Page_1.default { /** * Initialize the EventPage * * @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 EventInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EventInstance(this._version, payload, this._solution.callSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventPage = EventPage; rest/insights/v1/call/callSummary.js000064400000013362151677225100013454 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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.CallSummaryListInstance = exports.CallSummaryInstance = exports.CallSummaryContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class CallSummaryContextImpl { constructor(_version, callSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } this._solution = { callSid }; this._uri = `/Voice/${callSid}/Summary`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["processingState"] !== undefined) data["ProcessingState"] = params["processingState"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CallSummaryInstance(operationVersion, payload, instance._solution.callSid)); 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.CallSummaryContextImpl = CallSummaryContextImpl; class CallSummaryInstance { constructor(_version, payload, callSid) { this._version = _version; this.accountSid = payload.account_sid; this.callSid = payload.call_sid; this.callType = payload.call_type; this.callState = payload.call_state; this.answeredBy = payload.answered_by; this.processingState = payload.processing_state; this.createdTime = deserialize.iso8601DateTime(payload.created_time); this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.duration = deserialize.integer(payload.duration); this.connectDuration = deserialize.integer(payload.connect_duration); this.from = payload.from; this.to = payload.to; this.carrierEdge = payload.carrier_edge; this.clientEdge = payload.client_edge; this.sdkEdge = payload.sdk_edge; this.sipEdge = payload.sip_edge; this.tags = payload.tags; this.url = payload.url; this.attributes = payload.attributes; this.properties = payload.properties; this.trust = payload.trust; this.annotation = payload.annotation; this._solution = { callSid }; } get _proxy() { this._context = this._context || new CallSummaryContextImpl(this._version, this._solution.callSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, callSid: this.callSid, callType: this.callType, callState: this.callState, answeredBy: this.answeredBy, processingState: this.processingState, createdTime: this.createdTime, startTime: this.startTime, endTime: this.endTime, duration: this.duration, connectDuration: this.connectDuration, from: this.from, to: this.to, carrierEdge: this.carrierEdge, clientEdge: this.clientEdge, sdkEdge: this.sdkEdge, sipEdge: this.sipEdge, tags: this.tags, url: this.url, attributes: this.attributes, properties: this.properties, trust: this.trust, annotation: this.annotation, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CallSummaryInstance = CallSummaryInstance; function CallSummaryListInstance(version, callSid) { if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new CallSummaryContextImpl(version, callSid); }; instance._version = version; instance._solution = { callSid }; 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; } exports.CallSummaryListInstance = CallSummaryListInstance; rest/insights/v1/call/metric.d.ts000064400000017261151677225100012704 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type MetricStreamDirection = "unknown" | "inbound" | "outbound" | "both"; export type MetricTwilioEdge = "unknown_edge" | "carrier_edge" | "sip_edge" | "sdk_edge" | "client_edge"; /** * Options to pass to each */ export interface MetricListInstanceEachOptions { /** The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */ edge?: MetricTwilioEdge; /** The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. */ direction?: MetricStreamDirection; /** 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: MetricInstance, 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 MetricListInstanceOptions { /** The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */ edge?: MetricTwilioEdge; /** The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. */ direction?: MetricStreamDirection; /** 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 MetricListInstancePageOptions { /** The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */ edge?: MetricTwilioEdge; /** The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. */ direction?: MetricStreamDirection; /** 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 MetricSolution { callSid: string; } export interface MetricListInstance { _version: V1; _solution: MetricSolution; _uri: string; /** * Streams MetricInstance 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 { MetricListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MetricInstance, done: (err?: Error) => void) => void): void; each(params: MetricListInstanceEachOptions, callback?: (item: MetricInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MetricInstance 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: MetricPage) => any): Promise<MetricPage>; /** * Lists MetricInstance 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 { MetricListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MetricInstance[]) => any): Promise<MetricInstance[]>; list(params: MetricListInstanceOptions, callback?: (error: Error | null, items: MetricInstance[]) => any): Promise<MetricInstance[]>; /** * Retrieve a single page of MetricInstance 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 { MetricListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MetricPage) => any): Promise<MetricPage>; page(params: MetricListInstancePageOptions, callback?: (error: Error | null, items: MetricPage) => any): Promise<MetricPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MetricListInstance(version: V1, callSid: string): MetricListInstance; interface MetricPayload extends TwilioResponsePayload { metrics: MetricResource[]; } interface MetricResource { timestamp: string; call_sid: string; account_sid: string; edge: MetricTwilioEdge; direction: MetricStreamDirection; carrier_edge: any; sip_edge: any; sdk_edge: any; client_edge: any; } export declare class MetricInstance { protected _version: V1; constructor(_version: V1, payload: MetricResource, callSid: string); /** * Timestamp of metric sample. Samples are taken every 10 seconds and contain the metrics for the previous 10 seconds. */ timestamp: string; /** * The unique SID identifier of the Call. */ callSid: string; /** * The unique SID identifier of the Account. */ accountSid: string; edge: MetricTwilioEdge; direction: MetricStreamDirection; /** * Contains metrics and properties for the Twilio media gateway of a PSTN call. */ carrierEdge: any; /** * Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call. */ sipEdge: any; /** * Contains metrics and properties for the SDK sensor library for Client calls. */ sdkEdge: any; /** * Contains metrics and properties for the Twilio media gateway of a Client call. */ clientEdge: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { timestamp: string; callSid: string; accountSid: string; edge: MetricTwilioEdge; direction: MetricStreamDirection; carrierEdge: any; sipEdge: any; sdkEdge: any; clientEdge: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class MetricPage extends Page<V1, MetricPayload, MetricResource, MetricInstance> { /** * Initialize the MetricPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: MetricSolution); /** * Build an instance of MetricInstance * * @param payload - Payload response from the API */ getInstance(payload: MetricResource): MetricInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/insights/v1/call/event.d.ts000064400000017225151677225100012542 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type EventLevel = "UNKNOWN" | "DEBUG" | "INFO" | "WARNING" | "ERROR"; export type EventTwilioEdge = "unknown_edge" | "carrier_edge" | "sip_edge" | "sdk_edge" | "client_edge"; /** * Options to pass to each */ export interface EventListInstanceEachOptions { /** The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */ edge?: EventTwilioEdge; /** 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: EventInstance, 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 EventListInstanceOptions { /** The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */ edge?: EventTwilioEdge; /** 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 EventListInstancePageOptions { /** The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. */ edge?: EventTwilioEdge; /** 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 EventSolution { callSid: string; } export interface EventListInstance { _version: V1; _solution: EventSolution; _uri: string; /** * Streams EventInstance 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 { EventListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EventInstance, done: (err?: Error) => void) => void): void; each(params: EventListInstanceEachOptions, callback?: (item: EventInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EventInstance 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: EventPage) => any): Promise<EventPage>; /** * Lists EventInstance 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 { EventListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>; list(params: EventListInstanceOptions, callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>; /** * Retrieve a single page of EventInstance 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 { EventListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>; page(params: EventListInstancePageOptions, callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EventListInstance(version: V1, callSid: string): EventListInstance; interface EventPayload extends TwilioResponsePayload { events: EventResource[]; } interface EventResource { timestamp: string; call_sid: string; account_sid: string; edge: EventTwilioEdge; group: string; level: EventLevel; name: string; carrier_edge: any; sip_edge: any; sdk_edge: any; client_edge: any; } export declare class EventInstance { protected _version: V1; constructor(_version: V1, payload: EventResource, callSid: string); /** * Event time. */ timestamp: string; /** * The unique SID identifier of the Call. */ callSid: string; /** * The unique SID identifier of the Account. */ accountSid: string; edge: EventTwilioEdge; /** * Event group. */ group: string; level: EventLevel; /** * Event name. */ name: string; /** * Represents the connection between Twilio and our immediate carrier partners. The events here describe the call lifecycle as reported by Twilio\'s carrier media gateways. */ carrierEdge: any; /** * Represents the Twilio media gateway for SIP interface and SIP trunking calls. The events here describe the call lifecycle as reported by Twilio\'s public media gateways. */ sipEdge: any; /** * Represents the Voice SDK running locally in the browser or in the Android/iOS application. The events here are emitted by the Voice SDK in response to certain call progress events, network changes, or call quality conditions. */ sdkEdge: any; /** * Represents the Twilio media gateway for Client calls. The events here describe the call lifecycle as reported by Twilio\'s Voice SDK media gateways. */ clientEdge: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { timestamp: string; callSid: string; accountSid: string; edge: EventTwilioEdge; group: string; level: EventLevel; name: string; carrierEdge: any; sipEdge: any; sdkEdge: any; clientEdge: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class EventPage extends Page<V1, EventPayload, EventResource, EventInstance> { /** * Initialize the EventPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: EventSolution); /** * Build an instance of EventInstance * * @param payload - Payload response from the API */ getInstance(payload: EventResource): EventInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/insights/v1/call/callSummary.d.ts000064400000016701151677225100013710 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export type CallSummaryAnsweredBy = "unknown" | "machine_start" | "machine_end_beep" | "machine_end_silence" | "machine_end_other" | "human" | "fax"; export type CallSummaryCallState = "ringing" | "completed" | "busy" | "fail" | "noanswer" | "canceled" | "answered" | "undialed"; export type CallSummaryCallType = "carrier" | "sip" | "trunking" | "client"; export type CallSummaryProcessingState = "complete" | "partial"; /** * Options to pass to fetch a CallSummaryInstance */ export interface CallSummaryContextFetchOptions { /** The Processing State of this Call Summary. One of `complete`, `partial` or `all`. */ processingState?: CallSummaryProcessingState; } export interface CallSummaryContext { /** * Fetch a CallSummaryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallSummaryInstance */ fetch(callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>; /** * Fetch a CallSummaryInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CallSummaryInstance */ fetch(params: CallSummaryContextFetchOptions, callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CallSummaryContextSolution { callSid: string; } export declare class CallSummaryContextImpl implements CallSummaryContext { protected _version: V1; protected _solution: CallSummaryContextSolution; protected _uri: string; constructor(_version: V1, callSid: string); fetch(params?: CallSummaryContextFetchOptions | ((error: Error | null, item?: CallSummaryInstance) => any), callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CallSummaryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CallSummaryResource { account_sid: string; call_sid: string; call_type: CallSummaryCallType; call_state: CallSummaryCallState; answered_by: CallSummaryAnsweredBy; processing_state: CallSummaryProcessingState; created_time: Date; start_time: Date; end_time: Date; duration: number; connect_duration: number; from: any; to: any; carrier_edge: any; client_edge: any; sdk_edge: any; sip_edge: any; tags: Array<string>; url: string; attributes: any; properties: any; trust: any; annotation: any; } export declare class CallSummaryInstance { protected _version: V1; protected _solution: CallSummaryContextSolution; protected _context?: CallSummaryContext; constructor(_version: V1, payload: CallSummaryResource, callSid: string); /** * The unique SID identifier of the Account. */ accountSid: string; /** * The unique SID identifier of the Call. */ callSid: string; callType: CallSummaryCallType; callState: CallSummaryCallState; answeredBy: CallSummaryAnsweredBy; processingState: CallSummaryProcessingState; /** * The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS */ createdTime: Date; /** * The time at which the Call was started, given in ISO 8601 format. */ startTime: Date; /** * The time at which the Call was ended, given in ISO 8601 format. */ endTime: Date; /** * Duration between when the call was initiated and the call was ended */ duration: number; /** * Duration between when the call was answered and when it ended */ connectDuration: number; /** * The calling party. */ from: any; /** * The called party. */ to: any; /** * Contains metrics and properties for the Twilio media gateway of a PSTN call. */ carrierEdge: any; /** * Contains metrics and properties for the Twilio media gateway of a Client call. */ clientEdge: any; /** * Contains metrics and properties for the SDK sensor library for Client calls. */ sdkEdge: any; /** * Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call. */ sipEdge: any; /** * Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality. */ tags: Array<string>; /** * The URL of this resource. */ url: string; /** * Attributes capturing call-flow-specific details. */ attributes: any; /** * Contains edge-agnostic call-level details. */ properties: any; /** * Contains trusted communications details including Branded Call and verified caller ID. */ trust: any; /** * Programmatically labeled annotations for the Call. Developers can update the Call Summary records with Annotation during or after a Call. Annotations can be updated as long as the Call Summary record is addressable via the API. */ annotation: any; private get _proxy(); /** * Fetch a CallSummaryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallSummaryInstance */ fetch(callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>; /** * Fetch a CallSummaryInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CallSummaryInstance */ fetch(params: CallSummaryContextFetchOptions, callback?: (error: Error | null, item?: CallSummaryInstance) => any): Promise<CallSummaryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; callSid: string; callType: CallSummaryCallType; callState: CallSummaryCallState; answeredBy: CallSummaryAnsweredBy; processingState: CallSummaryProcessingState; createdTime: Date; startTime: Date; endTime: Date; duration: number; connectDuration: number; from: any; to: any; carrierEdge: any; clientEdge: any; sdkEdge: any; sipEdge: any; tags: string[]; url: string; attributes: any; properties: any; trust: any; annotation: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CallSummarySolution { callSid: string; } export interface CallSummaryListInstance { _version: V1; _solution: CallSummarySolution; _uri: string; (): CallSummaryContext; get(): CallSummaryContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CallSummaryListInstance(version: V1, callSid: string): CallSummaryListInstance; export {}; rest/insights/V1.js000064400000004216151677225100010206 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Insights * 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 call_1 = require("./v1/call"); const callSummaries_1 = require("./v1/callSummaries"); const conference_1 = require("./v1/conference"); const room_1 = require("./v1/room"); const setting_1 = require("./v1/setting"); class V1 extends Version_1.default { /** * Initialize the V1 version of Insights * * @param domain - The Twilio (Twilio.Insights) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for calls resource */ get calls() { this._calls = this._calls || (0, call_1.CallListInstance)(this); return this._calls; } /** Getter for callSummaries resource */ get callSummaries() { this._callSummaries = this._callSummaries || (0, callSummaries_1.CallSummariesListInstance)(this); return this._callSummaries; } /** Getter for conferences resource */ get conferences() { this._conferences = this._conferences || (0, conference_1.ConferenceListInstance)(this); return this._conferences; } /** Getter for rooms resource */ get rooms() { this._rooms = this._rooms || (0, room_1.RoomListInstance)(this); return this._rooms; } /** Getter for settings resource */ get settings() { this._settings = this._settings || (0, setting_1.SettingListInstance)(this); return this._settings; } } exports.default = V1; rest/frontlineApi/V1.d.ts000064400000001043151677225100011237 0ustar00import FrontlineApiBase from "../FrontlineApiBase"; import Version from "../../base/Version"; import { UserListInstance } from "./v1/user"; export default class V1 extends Version { /** * Initialize the V1 version of FrontlineApi * * @param domain - The Twilio (Twilio.FrontlineApi) domain */ constructor(domain: FrontlineApiBase); /** users - { Twilio.FrontlineApi.V1.UserListInstance } resource */ protected _users?: UserListInstance; /** Getter for users resource */ get users(): UserListInstance; } rest/frontlineApi/v1/user.js000064400000012117151677225100012025 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Frontline * 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.UserListInstance = exports.UserInstance = exports.UserContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class UserContextImpl { 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 = `/Users/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["avatar"] !== undefined) data["Avatar"] = params["avatar"]; if (params["state"] !== undefined) data["State"] = params["state"]; if (params["isAvailable"] !== undefined) data["IsAvailable"] = serialize.bool(params["isAvailable"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, 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.UserContextImpl = UserContextImpl; class UserInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.identity = payload.identity; this.friendlyName = payload.friendly_name; this.avatar = payload.avatar; this.state = payload.state; this.isAvailable = payload.is_available; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, identity: this.identity, friendlyName: this.friendlyName, avatar: this.avatar, state: this.state, isAvailable: this.isAvailable, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserInstance = UserInstance; function UserListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserContextImpl(version, sid); }; 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; } exports.UserListInstance = UserListInstance; rest/frontlineApi/v1/user.d.ts000064400000012456151677225100012267 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export type UserStateType = "active" | "deactivated"; /** * Options to pass to update a UserInstance */ export interface UserContextUpdateOptions { /** The string that you assigned to describe the User. */ friendlyName?: string; /** The avatar URL which will be shown in Frontline application. */ avatar?: string; /** */ state?: UserStateType; /** Whether the User is available for new conversations. Set to `false` to prevent User from receiving new inbound conversations if you are using [Pool Routing](https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing). */ isAvailable?: boolean; } export interface UserContext { /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserContextSolution { sid: string; } export declare class UserContextImpl implements UserContext { protected _version: V1; protected _solution: UserContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; update(params?: UserContextUpdateOptions | ((error: Error | null, item?: UserInstance) => any), callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserResource { sid: string; identity: string; friendly_name: string; avatar: string; state: UserStateType; is_available: boolean; url: string; } export declare class UserInstance { protected _version: V1; protected _solution: UserContextSolution; protected _context?: UserContext; constructor(_version: V1, payload: UserResource, sid?: string); /** * The unique string that we created to identify the User resource. */ sid: string; /** * The application-defined string that uniquely identifies the resource\'s User. This value is often a username or an email address, and is case-sensitive. */ identity: string; /** * The string that you assigned to describe the User. */ friendlyName: string; /** * The avatar URL which will be shown in Frontline application. */ avatar: string; state: UserStateType; /** * Whether the User is available for new conversations. Defaults to `false` for new users. */ isAvailable: boolean; /** * An absolute API resource URL for this user. */ url: string; private get _proxy(); /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; identity: string; friendlyName: string; avatar: string; state: UserStateType; isAvailable: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserSolution { } export interface UserListInstance { _version: V1; _solution: UserSolution; _uri: string; (sid: string): UserContext; get(sid: string): UserContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserListInstance(version: V1): UserListInstance; export {}; rest/frontlineApi/V1.js000064400000002322151677225100011004 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Frontline * 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 user_1 = require("./v1/user"); class V1 extends Version_1.default { /** * Initialize the V1 version of FrontlineApi * * @param domain - The Twilio (Twilio.FrontlineApi) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for users resource */ get users() { this._users = this._users || (0, user_1.UserListInstance)(this); return this._users; } } exports.default = V1; rest/Pricing.js000064400000002375151677225100007467 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const PricingBase_1 = __importDefault(require("./PricingBase")); class Pricing extends PricingBase_1.default { /** * @deprecated - Use v1.messaging instead */ get messaging() { console.warn("messaging is deprecated. Use v1.messaging instead."); return this.v1.messaging; } /** * @deprecated - Use v1.phoneNumbers instead */ get phoneNumbers() { console.warn("phoneNumbers is deprecated. Use v1.phoneNumbers instead."); return this.v1.phoneNumbers; } /** * @deprecated - Use v2.voice instead */ get voice() { console.warn("voice is deprecated. Use v2.voice instead."); return this.v2.voice; } /** * @deprecated - Use v2.countries instead */ get countries() { console.warn("countries is deprecated. Use v2.countries instead."); return this.v2.countries; } /** * @deprecated - Use v2.numbers instead */ get numbers() { console.warn("numbers is deprecated. Use v2.numbers instead."); return this.v2.numbers; } } module.exports = Pricing; rest/VoiceBase.d.ts000064400000000436151677225100010164 0ustar00import Domain from "../base/Domain"; import V1 from "./voice/V1"; declare class VoiceBase extends Domain { _v1?: V1; /** * Initialize voice domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = VoiceBase; rest/Studio.js000064400000001252151677225100007334 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const StudioBase_1 = __importDefault(require("./StudioBase")); class Studio extends StudioBase_1.default { /** * @deprecated - Use v2.flows instead */ get flows() { console.warn("flows is deprecated. Use v2.flows instead."); return this.v2.flows; } /** * @deprecated - Use v2.flowValidate instead */ get flowValidate() { console.warn("flowValidate is deprecated. Use v2.flowValidate instead."); return this.v2.flowValidate; } } module.exports = Studio; rest/Twilio.js000064400000030124151677225100007334 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ const BaseTwilio_1 = require("../base/BaseTwilio"); /* jshint ignore:start */ /** * Twilio Client to interact with the Rest API */ /* jshint ignore:end */ class Twilio extends BaseTwilio_1.Client { /* jshint ignore:start */ /** * Creates a new instance of Twilio Client * * @param username - * The username used for authentication. This is normally account sid, but if using key/secret auth will be the api key sid. * @param password - * The password used for authentication. This is normally auth token, but if using key/secret auth will be the secret. * @param opts - The options argument * * @returns A new instance of Twilio client */ /* jshint ignore:end */ constructor(username, password, opts) { super(username, password, opts); if (this.opts?.lazyLoading === false) { this.accounts; this.api; this.bulkexports; this.chat; this.content; this.conversations; this.events; this.flexApi; this.frontlineApi; this.insights; this.intelligence; this.ipMessaging; this.lookups; this.marketplace; this.messaging; this.microvisor; this.monitor; this.notify; this.numbers; this.oauth; this.preview; this.pricing; this.proxy; this.routes; this.serverless; this.studio; this.supersim; this.sync; this.taskrouter; this.trunking; this.trusthub; this.verify; this.video; this.voice; this.wireless; } } //Domains /** Getter for (Twilio.Accounts) domain */ get accounts() { return (this._accounts ?? (this._accounts = new (require("./Accounts"))(this))); } /** Getter for (Twilio.Api) domain */ get api() { return this._api ?? (this._api = new (require("./Api"))(this)); } /** Getter for (Twilio.Bulkexports) domain */ get bulkexports() { return (this._bulkexports ?? (this._bulkexports = new (require("./Bulkexports"))(this))); } /** Getter for (Twilio.Chat) domain */ get chat() { return this._chat ?? (this._chat = new (require("./Chat"))(this)); } /** Getter for (Twilio.Content) domain */ get content() { return this._content ?? (this._content = new (require("./Content"))(this)); } /** Getter for (Twilio.Conversations) domain */ get conversations() { return (this._conversations ?? (this._conversations = new (require("./Conversations"))(this))); } /** Getter for (Twilio.Events) domain */ get events() { return this._events ?? (this._events = new (require("./Events"))(this)); } /** Getter for (Twilio.FlexApi) domain */ get flexApi() { return this._flexApi ?? (this._flexApi = new (require("./FlexApi"))(this)); } /** Getter for (Twilio.FrontlineApi) domain */ get frontlineApi() { return (this._frontlineApi ?? (this._frontlineApi = new (require("./FrontlineApi"))(this))); } /** Getter for (Twilio.Insights) domain */ get insights() { return (this._insights ?? (this._insights = new (require("./Insights"))(this))); } /** Getter for (Twilio.Intelligence) domain */ get intelligence() { return (this._intelligence ?? (this._intelligence = new (require("./Intelligence"))(this))); } /** Getter for (Twilio.IpMessaging) domain */ get ipMessaging() { return (this._ipMessaging ?? (this._ipMessaging = new (require("./IpMessaging"))(this))); } /** Getter for (Twilio.Lookups) domain */ get lookups() { return this._lookups ?? (this._lookups = new (require("./Lookups"))(this)); } /** Getter for (Twilio.Marketplace) domain */ get marketplace() { return (this._marketplace ?? (this._marketplace = new (require("./Marketplace"))(this))); } /** Getter for (Twilio.Messaging) domain */ get messaging() { return (this._messaging ?? (this._messaging = new (require("./Messaging"))(this))); } /** Getter for (Twilio.Microvisor) domain */ get microvisor() { return (this._microvisor ?? (this._microvisor = new (require("./Microvisor"))(this))); } /** Getter for (Twilio.Monitor) domain */ get monitor() { return this._monitor ?? (this._monitor = new (require("./Monitor"))(this)); } /** Getter for (Twilio.Notify) domain */ get notify() { return this._notify ?? (this._notify = new (require("./Notify"))(this)); } /** Getter for (Twilio.Numbers) domain */ get numbers() { return this._numbers ?? (this._numbers = new (require("./Numbers"))(this)); } /** Getter for (Twilio.Oauth) domain */ get oauth() { return this._oauth ?? (this._oauth = new (require("./Oauth"))(this)); } /** Getter for (Twilio.Preview) domain */ get preview() { return this._preview ?? (this._preview = new (require("./Preview"))(this)); } /** Getter for (Twilio.Pricing) domain */ get pricing() { return this._pricing ?? (this._pricing = new (require("./Pricing"))(this)); } /** Getter for (Twilio.Proxy) domain */ get proxy() { return this._proxy ?? (this._proxy = new (require("./Proxy"))(this)); } /** Getter for (Twilio.Routes) domain */ get routes() { return this._routes ?? (this._routes = new (require("./Routes"))(this)); } /** Getter for (Twilio.Serverless) domain */ get serverless() { return (this._serverless ?? (this._serverless = new (require("./Serverless"))(this))); } /** Getter for (Twilio.Studio) domain */ get studio() { return this._studio ?? (this._studio = new (require("./Studio"))(this)); } /** Getter for (Twilio.Supersim) domain */ get supersim() { return (this._supersim ?? (this._supersim = new (require("./Supersim"))(this))); } /** Getter for (Twilio.Sync) domain */ get sync() { return this._sync ?? (this._sync = new (require("./Sync"))(this)); } /** Getter for (Twilio.Taskrouter) domain */ get taskrouter() { return (this._taskrouter ?? (this._taskrouter = new (require("./Taskrouter"))(this))); } /** Getter for (Twilio.Trunking) domain */ get trunking() { return (this._trunking ?? (this._trunking = new (require("./Trunking"))(this))); } /** Getter for (Twilio.Trusthub) domain */ get trusthub() { return (this._trusthub ?? (this._trusthub = new (require("./Trusthub"))(this))); } /** Getter for (Twilio.Verify) domain */ get verify() { return this._verify ?? (this._verify = new (require("./Verify"))(this)); } /** Getter for (Twilio.Video) domain */ get video() { return this._video ?? (this._video = new (require("./Video"))(this)); } /** Getter for (Twilio.Voice) domain */ get voice() { return this._voice ?? (this._voice = new (require("./Voice"))(this)); } /** Getter for (Twilio.Wireless) domain */ get wireless() { return (this._wireless ?? (this._wireless = new (require("./Wireless"))(this))); } /** Getter for (Twilio.Api.V2010.AccountContext.AddressListInstance) addresses resource */ get addresses() { return this.api.v2010.account.addresses; } /** Getter for (Twilio.Api.V2010.AccountContext.ApplicationListInstance) applications resource */ get applications() { return this.api.v2010.account.applications; } /** Getter for (Twilio.Api.V2010.AccountContext.AuthorizedConnectAppListInstance) authorizedConnectApps resource */ get authorizedConnectApps() { return this.api.v2010.account.authorizedConnectApps; } /** Getter for (Twilio.Api.V2010.AccountContext.AvailablePhoneNumberCountryListInstance) availablePhoneNumbers resource */ get availablePhoneNumbers() { return this.api.v2010.account.availablePhoneNumbers; } /** Getter for (Twilio.Api.V2010.AccountContext.BalanceListInstance) balance resource */ get balance() { return this.api.v2010.account.balance; } /** Getter for (Twilio.Api.V2010.AccountContext.CallListInstance) calls resource */ get calls() { return this.api.v2010.account.calls; } /** Getter for (Twilio.Api.V2010.AccountContext.ConferenceListInstance) conferences resource */ get conferences() { return this.api.v2010.account.conferences; } /** Getter for (Twilio.Api.V2010.AccountContext.ConnectAppListInstance) connectApps resource */ get connectApps() { return this.api.v2010.account.connectApps; } /** Getter for (Twilio.Api.V2010.AccountContext.IncomingPhoneNumberListInstance) incomingPhoneNumbers resource */ get incomingPhoneNumbers() { return this.api.v2010.account.incomingPhoneNumbers; } /** Getter for (Twilio.Api.V2010.AccountContext.KeyListInstance) keys resource */ get keys() { return this.api.v2010.account.keys; } /** Getter for (Twilio.Api.V2010.AccountContext.MessageListInstance) messages resource */ get messages() { return this.api.v2010.account.messages; } /** Getter for (Twilio.Api.V2010.AccountContext.NewKeyListInstance) newKeys resource */ get newKeys() { return this.api.v2010.account.newKeys; } /** Getter for (Twilio.Api.V2010.AccountContext.NewSigningKeyListInstance) newSigningKeys resource */ get newSigningKeys() { return this.api.v2010.account.newSigningKeys; } /** Getter for (Twilio.Api.V2010.AccountContext.NotificationListInstance) notifications resource */ get notifications() { return this.api.v2010.account.notifications; } /** Getter for (Twilio.Api.V2010.AccountContext.OutgoingCallerIdListInstance) outgoingCallerIds resource */ get outgoingCallerIds() { return this.api.v2010.account.outgoingCallerIds; } /** Getter for (Twilio.Api.V2010.AccountContext.QueueListInstance) queues resource */ get queues() { return this.api.v2010.account.queues; } /** Getter for (Twilio.Api.V2010.AccountContext.RecordingListInstance) recordings resource */ get recordings() { return this.api.v2010.account.recordings; } /** Getter for (Twilio.Api.V2010.AccountContext.ShortCodeListInstance) shortCodes resource */ get shortCodes() { return this.api.v2010.account.shortCodes; } /** Getter for (Twilio.Api.V2010.AccountContext.SigningKeyListInstance) signingKeys resource */ get signingKeys() { return this.api.v2010.account.signingKeys; } /** Getter for (Twilio.Api.V2010.AccountContext.SipListInstance) sip resource */ get sip() { return this.api.v2010.account.sip; } /** Getter for (Twilio.Api.V2010.AccountContext.TokenListInstance) tokens resource */ get tokens() { return this.api.v2010.account.tokens; } /** Getter for (Twilio.Api.V2010.AccountContext.TranscriptionListInstance) transcriptions resource */ get transcriptions() { return this.api.v2010.account.transcriptions; } /** Getter for (Twilio.Api.V2010.AccountContext.UsageListInstance) usage resource */ get usage() { return this.api.v2010.account.usage; } /** Getter for (Twilio.Api.V2010.AccountContext.ValidationRequestListInstance) validationRequests resource */ get validationRequests() { return this.api.v2010.account.validationRequests; } } module.exports = Twilio; rest/Verify.js000064400000002577151677225100007344 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const VerifyBase_1 = __importDefault(require("./VerifyBase")); class Verify extends VerifyBase_1.default { /** * @deprecated - Use v2.forms instead */ get forms() { console.warn("forms is deprecated. Use v2.forms instead."); return this.v2.forms; } /** * @deprecated - Use v2.services instead */ get services() { console.warn("services is deprecated. Use v2.services instead."); return this.v2.services; } /** * @deprecated - Use v2.verificationAttempts instead */ get verificationAttempts() { console.warn("verificationAttempts is deprecated. Use v2.verificationAttempts instead."); return this.v2.verificationAttempts; } /** * @deprecated - Use v2.verificationAttemptsSummary instead */ get verificationAttemptsSummary() { console.warn("verificationAttemptsSummary is deprecated. Use v2.verificationAttemptsSummary instead."); return this.v2.verificationAttemptsSummary; } /** * @deprecated - Use v2.templates instead */ get templates() { console.warn("templates is deprecated. Use v2.templates instead."); return this.v2.templates; } } module.exports = Verify; rest/sync/V1.d.ts000064400000001016151677225100007561 0ustar00import SyncBase from "../SyncBase"; import Version from "../../base/Version"; import { ServiceListInstance } from "./v1/service"; export default class V1 extends Version { /** * Initialize the V1 version of Sync * * @param domain - The Twilio (Twilio.Sync) domain */ constructor(domain: SyncBase); /** services - { Twilio.Sync.V1.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** Getter for services resource */ get services(): ServiceListInstance; } rest/sync/v1/service.d.ts000064400000042560151677225100011272 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { DocumentListInstance } from "./service/document"; import { SyncListListInstance } from "./service/syncList"; import { SyncMapListInstance } from "./service/syncMap"; import { SyncStreamListInstance } from "./service/syncStream"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** The URL we should call when Sync objects are manipulated. */ webhookUrl?: string; /** A string that you assign to describe the resource. */ friendlyName?: string; /** Whether the service instance should call `webhook_url` when client endpoints connect to Sync. The default is `false`. */ reachabilityWebhooksEnabled?: boolean; /** Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. */ aclEnabled?: boolean; /** Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. */ reachabilityDebouncingEnabled?: boolean; /** The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the webhook is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the webhook from being called. */ reachabilityDebouncingWindow?: number; /** Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. */ webhooksFromRestEnabled?: boolean; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** A string that you assign to describe the resource. */ friendlyName?: string; /** The URL we should call when Sync objects are manipulated. */ webhookUrl?: string; /** Whether the service instance should call `webhook_url` when client endpoints connect to Sync. The default is `false`. */ reachabilityWebhooksEnabled?: boolean; /** Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. */ aclEnabled?: boolean; /** Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. */ reachabilityDebouncingEnabled?: boolean; /** The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the `webhook_url` is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the call to `webhook_url`. */ reachabilityDebouncingWindow?: number; /** Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. */ webhooksFromRestEnabled?: boolean; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { documents: DocumentListInstance; syncLists: SyncListListInstance; syncMaps: SyncMapListInstance; syncStreams: SyncStreamListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V1; protected _solution: ServiceContextSolution; protected _uri: string; protected _documents?: DocumentListInstance; protected _syncLists?: SyncListListInstance; protected _syncMaps?: SyncMapListInstance; protected _syncStreams?: SyncStreamListInstance; constructor(_version: V1, sid: string); get documents(): DocumentListInstance; get syncLists(): SyncListListInstance; get syncMaps(): SyncMapListInstance; get syncStreams(): SyncStreamListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; unique_name: string; account_sid: string; friendly_name: string; date_created: Date; date_updated: Date; url: string; webhook_url: string; webhooks_from_rest_enabled: boolean; reachability_webhooks_enabled: boolean; acl_enabled: boolean; reachability_debouncing_enabled: boolean; reachability_debouncing_window: number; links: Record<string, string>; } export declare class ServiceInstance { protected _version: V1; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V1, payload: ServiceResource, sid?: string); /** * The unique string that we created to identify the Service resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. It is a read-only property, it cannot be assigned using REST API. */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service 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 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Service resource. */ url: string; /** * The URL we call when Sync objects are manipulated. */ webhookUrl: string; /** * Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. */ webhooksFromRestEnabled: boolean; /** * Whether the service instance calls `webhook_url` when client endpoints connect to Sync. The default is `false`. */ reachabilityWebhooksEnabled: boolean; /** * Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. It is disabled (false) by default. */ aclEnabled: boolean; /** * Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. */ reachabilityDebouncingEnabled: boolean; /** * The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before `webhook_url` is called, if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the reachability event from occurring. */ reachabilityDebouncingWindow: number; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the documents. */ documents(): DocumentListInstance; /** * Access the syncLists. */ syncLists(): SyncListListInstance; /** * Access the syncMaps. */ syncMaps(): SyncMapListInstance; /** * Access the syncStreams. */ syncStreams(): SyncStreamListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; url: string; webhookUrl: string; webhooksFromRestEnabled: boolean; reachabilityWebhooksEnabled: boolean; aclEnabled: boolean; reachabilityDebouncingEnabled: boolean; reachabilityDebouncingWindow: number; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V1; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V1): ServiceListInstance; export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service.js000064400000031616151677225100011036 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const document_1 = require("./service/document"); const syncList_1 = require("./service/syncList"); const syncMap_1 = require("./service/syncMap"); const syncStream_1 = require("./service/syncStream"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get documents() { this._documents = this._documents || (0, document_1.DocumentListInstance)(this._version, this._solution.sid); return this._documents; } get syncLists() { this._syncLists = this._syncLists || (0, syncList_1.SyncListListInstance)(this._version, this._solution.sid); return this._syncLists; } get syncMaps() { this._syncMaps = this._syncMaps || (0, syncMap_1.SyncMapListInstance)(this._version, this._solution.sid); return this._syncMaps; } get syncStreams() { this._syncStreams = this._syncStreams || (0, syncStream_1.SyncStreamListInstance)(this._version, this._solution.sid); return this._syncStreams; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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["webhookUrl"] !== undefined) data["WebhookUrl"] = params["webhookUrl"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["reachabilityWebhooksEnabled"] !== undefined) data["ReachabilityWebhooksEnabled"] = serialize.bool(params["reachabilityWebhooksEnabled"]); if (params["aclEnabled"] !== undefined) data["AclEnabled"] = serialize.bool(params["aclEnabled"]); if (params["reachabilityDebouncingEnabled"] !== undefined) data["ReachabilityDebouncingEnabled"] = serialize.bool(params["reachabilityDebouncingEnabled"]); if (params["reachabilityDebouncingWindow"] !== undefined) data["ReachabilityDebouncingWindow"] = params["reachabilityDebouncingWindow"]; if (params["webhooksFromRestEnabled"] !== undefined) data["WebhooksFromRestEnabled"] = serialize.bool(params["webhooksFromRestEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.webhookUrl = payload.webhook_url; this.webhooksFromRestEnabled = payload.webhooks_from_rest_enabled; this.reachabilityWebhooksEnabled = payload.reachability_webhooks_enabled; this.aclEnabled = payload.acl_enabled; this.reachabilityDebouncingEnabled = payload.reachability_debouncing_enabled; this.reachabilityDebouncingWindow = deserialize.integer(payload.reachability_debouncing_window); this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the documents. */ documents() { return this._proxy.documents; } /** * Access the syncLists. */ syncLists() { return this._proxy.syncLists; } /** * Access the syncMaps. */ syncMaps() { return this._proxy.syncMaps; } /** * Access the syncStreams. */ syncStreams() { return this._proxy.syncStreams; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, webhookUrl: this.webhookUrl, webhooksFromRestEnabled: this.webhooksFromRestEnabled, reachabilityWebhooksEnabled: this.reachabilityWebhooksEnabled, aclEnabled: this.aclEnabled, reachabilityDebouncingEnabled: this.reachabilityDebouncingEnabled, reachabilityDebouncingWindow: this.reachabilityDebouncingWindow, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["webhookUrl"] !== undefined) data["WebhookUrl"] = params["webhookUrl"]; if (params["reachabilityWebhooksEnabled"] !== undefined) data["ReachabilityWebhooksEnabled"] = serialize.bool(params["reachabilityWebhooksEnabled"]); if (params["aclEnabled"] !== undefined) data["AclEnabled"] = serialize.bool(params["aclEnabled"]); if (params["reachabilityDebouncingEnabled"] !== undefined) data["ReachabilityDebouncingEnabled"] = serialize.bool(params["reachabilityDebouncingEnabled"]); if (params["reachabilityDebouncingWindow"] !== undefined) data["ReachabilityDebouncingWindow"] = params["reachabilityDebouncingWindow"]; if (params["webhooksFromRestEnabled"] !== undefined) data["WebhooksFromRestEnabled"] = serialize.bool(params["webhooksFromRestEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/sync/v1/service/syncStream.d.ts000064400000032375151677225100013425 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { StreamMessageListInstance } from "./syncStream/streamMessage"; /** * Options to pass to update a SyncStreamInstance */ export interface SyncStreamContextUpdateOptions { /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Stream expires and is deleted (time-to-live). */ ttl?: number; } /** * Options to pass to create a SyncStreamInstance */ export interface SyncStreamListInstanceCreateOptions { /** An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The `unique_name` value can be used as an alternative to the `sid` in the URL path to address the resource. */ uniqueName?: string; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Stream expires and is deleted (time-to-live). */ ttl?: number; } /** * Options to pass to each */ export interface SyncStreamListInstanceEachOptions { /** 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: SyncStreamInstance, 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 SyncStreamListInstanceOptions { /** 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 SyncStreamListInstancePageOptions { /** 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 SyncStreamContext { streamMessages: StreamMessageListInstance; /** * Remove a SyncStreamInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncStreamInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncStreamInstance */ fetch(callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; /** * Update a SyncStreamInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncStreamInstance */ update(callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; /** * Update a SyncStreamInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncStreamInstance */ update(params: SyncStreamContextUpdateOptions, callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncStreamContextSolution { serviceSid: string; sid: string; } export declare class SyncStreamContextImpl implements SyncStreamContext { protected _version: V1; protected _solution: SyncStreamContextSolution; protected _uri: string; protected _streamMessages?: StreamMessageListInstance; constructor(_version: V1, serviceSid: string, sid: string); get streamMessages(): StreamMessageListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; update(params?: SyncStreamContextUpdateOptions | ((error: Error | null, item?: SyncStreamInstance) => any), callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncStreamContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncStreamPayload extends TwilioResponsePayload { streams: SyncStreamResource[]; } interface SyncStreamResource { sid: string; unique_name: string; account_sid: string; service_sid: string; url: string; links: Record<string, string>; date_expires: Date; date_created: Date; date_updated: Date; created_by: string; } export declare class SyncStreamInstance { protected _version: V1; protected _solution: SyncStreamContextSolution; protected _context?: SyncStreamContext; constructor(_version: V1, payload: SyncStreamResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Sync Stream resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Stream resource. */ accountSid: string; /** * The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. */ serviceSid: string; /** * The absolute URL of the Message Stream resource. */ url: string; /** * The URLs of the Stream\'s nested resources. */ links: Record<string, string>; /** * The date and time in GMT when the Message Stream expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Message Stream does not expire, this value is `null`. The Stream might not be deleted immediately after it expires. */ dateExpires: Date; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The identity of the Stream\'s creator. If the Stream is created from the client SDK, the value matches the Access Token\'s `identity` field. If the Stream was created from the REST API, the value is \'system\'. */ createdBy: string; private get _proxy(); /** * Remove a SyncStreamInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncStreamInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncStreamInstance */ fetch(callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; /** * Update a SyncStreamInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncStreamInstance */ update(callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; /** * Update a SyncStreamInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncStreamInstance */ update(params: SyncStreamContextUpdateOptions, callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; /** * Access the streamMessages. */ streamMessages(): StreamMessageListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; dateExpires: Date; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncStreamSolution { serviceSid: string; } export interface SyncStreamListInstance { _version: V1; _solution: SyncStreamSolution; _uri: string; (sid: string): SyncStreamContext; get(sid: string): SyncStreamContext; /** * Create a SyncStreamInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncStreamInstance */ create(callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; /** * Create a SyncStreamInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncStreamInstance */ create(params: SyncStreamListInstanceCreateOptions, callback?: (error: Error | null, item?: SyncStreamInstance) => any): Promise<SyncStreamInstance>; /** * Streams SyncStreamInstance 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 { SyncStreamListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncStreamInstance, done: (err?: Error) => void) => void): void; each(params: SyncStreamListInstanceEachOptions, callback?: (item: SyncStreamInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncStreamInstance 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: SyncStreamPage) => any): Promise<SyncStreamPage>; /** * Lists SyncStreamInstance 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 { SyncStreamListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncStreamInstance[]) => any): Promise<SyncStreamInstance[]>; list(params: SyncStreamListInstanceOptions, callback?: (error: Error | null, items: SyncStreamInstance[]) => any): Promise<SyncStreamInstance[]>; /** * Retrieve a single page of SyncStreamInstance 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 { SyncStreamListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncStreamPage) => any): Promise<SyncStreamPage>; page(params: SyncStreamListInstancePageOptions, callback?: (error: Error | null, items: SyncStreamPage) => any): Promise<SyncStreamPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncStreamListInstance(version: V1, serviceSid: string): SyncStreamListInstance; export declare class SyncStreamPage extends Page<V1, SyncStreamPayload, SyncStreamResource, SyncStreamInstance> { /** * Initialize the SyncStreamPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SyncStreamSolution); /** * Build an instance of SyncStreamInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncStreamResource): SyncStreamInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/syncStream.js000064400000024325151677225100013165 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.SyncStreamPage = exports.SyncStreamListInstance = exports.SyncStreamInstance = exports.SyncStreamContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const streamMessage_1 = require("./syncStream/streamMessage"); class SyncStreamContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Streams/${sid}`; } get streamMessages() { this._streamMessages = this._streamMessages || (0, streamMessage_1.StreamMessageListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._streamMessages; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncStreamInstance(operationVersion, payload, instance._solution.serviceSid, 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["ttl"] !== undefined) data["Ttl"] = params["ttl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncStreamInstance(operationVersion, payload, instance._solution.serviceSid, 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.SyncStreamContextImpl = SyncStreamContextImpl; class SyncStreamInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.url = payload.url; this.links = payload.links; this.dateExpires = deserialize.iso8601DateTime(payload.date_expires); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SyncStreamContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a SyncStreamInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SyncStreamInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncStreamInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the streamMessages. */ streamMessages() { return this._proxy.streamMessages; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, serviceSid: this.serviceSid, url: this.url, links: this.links, dateExpires: this.dateExpires, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncStreamInstance = SyncStreamInstance; function SyncStreamListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SyncStreamContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Streams`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncStreamInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncStreamPage(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 SyncStreamPage(instance._version, payload, 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; } exports.SyncStreamListInstance = SyncStreamListInstance; class SyncStreamPage extends Page_1.default { /** * Initialize the SyncStreamPage * * @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 SyncStreamInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncStreamInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncStreamPage = SyncStreamPage; rest/sync/v1/service/syncList.js000064400000025656151677225100012655 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.SyncListPage = exports.SyncListListInstance = exports.SyncListInstance = exports.SyncListContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const syncListItem_1 = require("./syncList/syncListItem"); const syncListPermission_1 = require("./syncList/syncListPermission"); class SyncListContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Lists/${sid}`; } get syncListItems() { this._syncListItems = this._syncListItems || (0, syncListItem_1.SyncListItemListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._syncListItems; } get syncListPermissions() { this._syncListPermissions = this._syncListPermissions || (0, syncListPermission_1.SyncListPermissionListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._syncListPermissions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncListInstance(operationVersion, payload, instance._solution.serviceSid, 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["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["collectionTtl"] !== undefined) data["CollectionTtl"] = params["collectionTtl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListInstance(operationVersion, payload, instance._solution.serviceSid, 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.SyncListContextImpl = SyncListContextImpl; class SyncListInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.url = payload.url; this.links = payload.links; this.revision = payload.revision; this.dateExpires = deserialize.iso8601DateTime(payload.date_expires); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SyncListContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the syncListItems. */ syncListItems() { return this._proxy.syncListItems; } /** * Access the syncListPermissions. */ syncListPermissions() { return this._proxy.syncListPermissions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, serviceSid: this.serviceSid, url: this.url, links: this.links, revision: this.revision, dateExpires: this.dateExpires, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListInstance = SyncListInstance; function SyncListListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SyncListContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Lists`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["collectionTtl"] !== undefined) data["CollectionTtl"] = params["collectionTtl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListPage(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 SyncListPage(instance._version, payload, 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; } exports.SyncListListInstance = SyncListListInstance; class SyncListPage extends Page_1.default { /** * Initialize the SyncListPage * * @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 SyncListInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncListInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListPage = SyncListPage; rest/sync/v1/service/syncMap.d.ts000064400000033103151677225100012675 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { SyncMapItemListInstance } from "./syncMap/syncMapItem"; import { SyncMapPermissionListInstance } from "./syncMap/syncMapPermission"; /** * Options to pass to update a SyncMapInstance */ export interface SyncMapContextUpdateOptions { /** An alias for `collection_ttl`. If both parameters are provided, this value is ignored. */ ttl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Map expires (time-to-live) and is deleted. */ collectionTtl?: number; } /** * Options to pass to create a SyncMapInstance */ export interface SyncMapListInstanceCreateOptions { /** An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. */ uniqueName?: string; /** An alias for `collection_ttl`. If both parameters are provided, this value is ignored. */ ttl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Map expires (time-to-live) and is deleted. */ collectionTtl?: number; } /** * Options to pass to each */ export interface SyncMapListInstanceEachOptions { /** 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: SyncMapInstance, 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 SyncMapListInstanceOptions { /** 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 SyncMapListInstancePageOptions { /** 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 SyncMapContext { syncMapItems: SyncMapItemListInstance; syncMapPermissions: SyncMapPermissionListInstance; /** * Remove a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ fetch(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Update a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ update(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Update a SyncMapInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ update(params: SyncMapContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncMapContextSolution { serviceSid: string; sid: string; } export declare class SyncMapContextImpl implements SyncMapContext { protected _version: V1; protected _solution: SyncMapContextSolution; protected _uri: string; protected _syncMapItems?: SyncMapItemListInstance; protected _syncMapPermissions?: SyncMapPermissionListInstance; constructor(_version: V1, serviceSid: string, sid: string); get syncMapItems(): SyncMapItemListInstance; get syncMapPermissions(): SyncMapPermissionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; update(params?: SyncMapContextUpdateOptions | ((error: Error | null, item?: SyncMapInstance) => any), callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncMapContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncMapPayload extends TwilioResponsePayload { maps: SyncMapResource[]; } interface SyncMapResource { sid: string; unique_name: string; account_sid: string; service_sid: string; url: string; links: Record<string, string>; revision: string; date_expires: Date; date_created: Date; date_updated: Date; created_by: string; } export declare class SyncMapInstance { protected _version: V1; protected _solution: SyncMapContextSolution; protected _context?: SyncMapContext; constructor(_version: V1, payload: SyncMapResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Sync Map resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map resource. */ accountSid: string; /** * The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. */ serviceSid: string; /** * The absolute URL of the Sync Map resource. */ url: string; /** * The URLs of the Sync Map\'s nested resources. */ links: Record<string, string>; /** * The current revision of the Sync Map, represented as a string. */ revision: string; /** * The date and time in GMT when the Sync Map expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Map does not expire, this value is `null`. The Sync Map might not be deleted immediately after it expires. */ dateExpires: Date; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The identity of the Sync Map\'s creator. If the Sync Map is created from the client SDK, the value matches the Access Token\'s `identity` field. If the Sync Map was created from the REST API, the value is `system`. */ createdBy: string; private get _proxy(); /** * Remove a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ fetch(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Update a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ update(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Update a SyncMapInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ update(params: SyncMapContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Access the syncMapItems. */ syncMapItems(): SyncMapItemListInstance; /** * Access the syncMapPermissions. */ syncMapPermissions(): SyncMapPermissionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; revision: string; dateExpires: Date; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncMapSolution { serviceSid: string; } export interface SyncMapListInstance { _version: V1; _solution: SyncMapSolution; _uri: string; (sid: string): SyncMapContext; get(sid: string): SyncMapContext; /** * Create a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ create(callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Create a SyncMapInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ create(params: SyncMapListInstanceCreateOptions, callback?: (error: Error | null, item?: SyncMapInstance) => any): Promise<SyncMapInstance>; /** * Streams SyncMapInstance 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 { SyncMapListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncMapInstance, done: (err?: Error) => void) => void): void; each(params: SyncMapListInstanceEachOptions, callback?: (item: SyncMapInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncMapInstance 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: SyncMapPage) => any): Promise<SyncMapPage>; /** * Lists SyncMapInstance 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 { SyncMapListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncMapInstance[]) => any): Promise<SyncMapInstance[]>; list(params: SyncMapListInstanceOptions, callback?: (error: Error | null, items: SyncMapInstance[]) => any): Promise<SyncMapInstance[]>; /** * Retrieve a single page of SyncMapInstance 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 { SyncMapListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncMapPage) => any): Promise<SyncMapPage>; page(params: SyncMapListInstancePageOptions, callback?: (error: Error | null, items: SyncMapPage) => any): Promise<SyncMapPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncMapListInstance(version: V1, serviceSid: string): SyncMapListInstance; export declare class SyncMapPage extends Page<V1, SyncMapPayload, SyncMapResource, SyncMapInstance> { /** * Initialize the SyncMapPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SyncMapSolution); /** * Build an instance of SyncMapInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncMapResource): SyncMapInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/syncList.d.ts000064400000033437151677225100013105 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { SyncListItemListInstance } from "./syncList/syncListItem"; import { SyncListPermissionListInstance } from "./syncList/syncListPermission"; /** * Options to pass to update a SyncListInstance */ export interface SyncListContextUpdateOptions { /** An alias for `collection_ttl`. If both are provided, this value is ignored. */ ttl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted. */ collectionTtl?: number; } /** * Options to pass to create a SyncListInstance */ export interface SyncListListInstanceCreateOptions { /** An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The `unique_name` value can be used as an alternative to the `sid` in the URL path to address the resource. */ uniqueName?: string; /** Alias for collection_ttl. If both are provided, this value is ignored. */ ttl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted. */ collectionTtl?: number; } /** * Options to pass to each */ export interface SyncListListInstanceEachOptions { /** 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: SyncListInstance, 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 SyncListListInstanceOptions { /** 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 SyncListListInstancePageOptions { /** 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 SyncListContext { syncListItems: SyncListItemListInstance; syncListPermissions: SyncListPermissionListInstance; /** * Remove a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ fetch(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Update a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ update(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Update a SyncListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ update(params: SyncListContextUpdateOptions, callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncListContextSolution { serviceSid: string; sid: string; } export declare class SyncListContextImpl implements SyncListContext { protected _version: V1; protected _solution: SyncListContextSolution; protected _uri: string; protected _syncListItems?: SyncListItemListInstance; protected _syncListPermissions?: SyncListPermissionListInstance; constructor(_version: V1, serviceSid: string, sid: string); get syncListItems(): SyncListItemListInstance; get syncListPermissions(): SyncListPermissionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; update(params?: SyncListContextUpdateOptions | ((error: Error | null, item?: SyncListInstance) => any), callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncListContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncListPayload extends TwilioResponsePayload { lists: SyncListResource[]; } interface SyncListResource { sid: string; unique_name: string; account_sid: string; service_sid: string; url: string; links: Record<string, string>; revision: string; date_expires: Date; date_created: Date; date_updated: Date; created_by: string; } export declare class SyncListInstance { protected _version: V1; protected _solution: SyncListContextSolution; protected _context?: SyncListContext; constructor(_version: V1, payload: SyncListResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Sync List resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List resource. */ accountSid: string; /** * The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. */ serviceSid: string; /** * The absolute URL of the Sync List resource. */ url: string; /** * The URLs of the Sync List\'s nested resources. */ links: Record<string, string>; /** * The current revision of the Sync List, represented as a string. */ revision: string; /** * The date and time in GMT when the Sync List expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync List does not expire, this value is `null`. The Sync List might not be deleted immediately after it expires. */ dateExpires: Date; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The identity of the Sync List\'s creator. If the Sync List is created from the client SDK, the value matches the Access Token\'s `identity` field. If the Sync List was created from the REST API, the value is `system`. */ createdBy: string; private get _proxy(); /** * Remove a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ fetch(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Update a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ update(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Update a SyncListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ update(params: SyncListContextUpdateOptions, callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Access the syncListItems. */ syncListItems(): SyncListItemListInstance; /** * Access the syncListPermissions. */ syncListPermissions(): SyncListPermissionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; revision: string; dateExpires: Date; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncListSolution { serviceSid: string; } export interface SyncListListInstance { _version: V1; _solution: SyncListSolution; _uri: string; (sid: string): SyncListContext; get(sid: string): SyncListContext; /** * Create a SyncListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ create(callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Create a SyncListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListInstance */ create(params: SyncListListInstanceCreateOptions, callback?: (error: Error | null, item?: SyncListInstance) => any): Promise<SyncListInstance>; /** * Streams SyncListInstance 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 { SyncListListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncListInstance, done: (err?: Error) => void) => void): void; each(params: SyncListListInstanceEachOptions, callback?: (item: SyncListInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncListInstance 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: SyncListPage) => any): Promise<SyncListPage>; /** * Lists SyncListInstance 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 { SyncListListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncListInstance[]) => any): Promise<SyncListInstance[]>; list(params: SyncListListInstanceOptions, callback?: (error: Error | null, items: SyncListInstance[]) => any): Promise<SyncListInstance[]>; /** * Retrieve a single page of SyncListInstance 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 { SyncListListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncListPage) => any): Promise<SyncListPage>; page(params: SyncListListInstancePageOptions, callback?: (error: Error | null, items: SyncListPage) => any): Promise<SyncListPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncListListInstance(version: V1, serviceSid: string): SyncListListInstance; export declare class SyncListPage extends Page<V1, SyncListPayload, SyncListResource, SyncListInstance> { /** * Initialize the SyncListPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SyncListSolution); /** * Build an instance of SyncListInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncListResource): SyncListInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/syncStream/streamMessage.js000064400000006326151677225100015766 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.StreamMessageInstance = exports.StreamMessageListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function StreamMessageListInstance(version, serviceSid, streamSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(streamSid)) { throw new Error("Parameter 'streamSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { serviceSid, streamSid }; instance._uri = `/Services/${serviceSid}/Streams/${streamSid}/Messages`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["data"] === null || params["data"] === undefined) { throw new Error("Required parameter \"params['data']\" missing."); } let data = {}; data["Data"] = serialize.object(params["data"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new StreamMessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.streamSid)); 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; } exports.StreamMessageListInstance = StreamMessageListInstance; class StreamMessageInstance { constructor(_version, payload, serviceSid, streamSid) { this._version = _version; this.sid = payload.sid; this.data = payload.data; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, data: this.data, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.StreamMessageInstance = StreamMessageInstance; rest/sync/v1/service/syncStream/streamMessage.d.ts000064400000003726151677225100016223 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to create a StreamMessageInstance */ export interface StreamMessageListInstanceCreateOptions { /** A JSON string that represents an arbitrary, schema-less object that makes up the Stream Message body. Can be up to 4 KiB in length. */ data: any; } export interface StreamMessageSolution { serviceSid: string; streamSid: string; } export interface StreamMessageListInstance { _version: V1; _solution: StreamMessageSolution; _uri: string; /** * Create a StreamMessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed StreamMessageInstance */ create(params: StreamMessageListInstanceCreateOptions, callback?: (error: Error | null, item?: StreamMessageInstance) => any): Promise<StreamMessageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function StreamMessageListInstance(version: V1, serviceSid: string, streamSid: string): StreamMessageListInstance; interface StreamMessageResource { sid: string; data: any; } export declare class StreamMessageInstance { protected _version: V1; constructor(_version: V1, payload: StreamMessageResource, serviceSid: string, streamSid: string); /** * The unique string that we created to identify the Stream Message resource. */ sid: string; /** * An arbitrary, schema-less object that contains the Stream Message body. Can be up to 4 KiB in length. */ data: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; data: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/syncList/syncListItem.d.ts000064400000042171151677225100015527 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type SyncListItemQueryFromBoundType = "inclusive" | "exclusive"; export type SyncListItemQueryResultOrder = "asc" | "desc"; /** * Options to pass to remove a SyncListItemInstance */ export interface SyncListItemContextRemoveOptions { /** If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). */ ifMatch?: string; } /** * Options to pass to update a SyncListItemInstance */ export interface SyncListItemContextUpdateOptions { /** If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). */ ifMatch?: string; /** A JSON string that represents an arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. */ data?: any; /** An alias for `item_ttl`. If both parameters are provided, this value is ignored. */ ttl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item expires (time-to-live) and is deleted. */ itemTtl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item\\\'s parent Sync List expires (time-to-live) and is deleted. This parameter can only be used when the List Item\\\'s `data` or `ttl` is updated in the same request. */ collectionTtl?: number; } /** * Options to pass to create a SyncListItemInstance */ export interface SyncListItemListInstanceCreateOptions { /** A JSON string that represents an arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. */ data: any; /** An alias for `item_ttl`. If both parameters are provided, this value is ignored. */ ttl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item expires (time-to-live) and is deleted. */ itemTtl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item\\\'s parent Sync List expires (time-to-live) and is deleted. */ collectionTtl?: number; } /** * Options to pass to each */ export interface SyncListItemListInstanceEachOptions { /** How to order the List Items returned by their `index` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. */ order?: SyncListItemQueryResultOrder; /** The `index` of the first Sync List Item resource to read. See also `bounds`. */ from?: string; /** Whether to include the List Item referenced by the `from` parameter. Can be: `inclusive` to include the List Item referenced by the `from` parameter or `exclusive` to start with the next List Item. The default value is `inclusive`. */ bounds?: SyncListItemQueryFromBoundType; /** 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: SyncListItemInstance, 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 SyncListItemListInstanceOptions { /** How to order the List Items returned by their `index` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. */ order?: SyncListItemQueryResultOrder; /** The `index` of the first Sync List Item resource to read. See also `bounds`. */ from?: string; /** Whether to include the List Item referenced by the `from` parameter. Can be: `inclusive` to include the List Item referenced by the `from` parameter or `exclusive` to start with the next List Item. The default value is `inclusive`. */ bounds?: SyncListItemQueryFromBoundType; /** 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 SyncListItemListInstancePageOptions { /** How to order the List Items returned by their `index` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. */ order?: SyncListItemQueryResultOrder; /** The `index` of the first Sync List Item resource to read. See also `bounds`. */ from?: string; /** Whether to include the List Item referenced by the `from` parameter. Can be: `inclusive` to include the List Item referenced by the `from` parameter or `exclusive` to start with the next List Item. The default value is `inclusive`. */ bounds?: SyncListItemQueryFromBoundType; /** 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 SyncListItemContext { /** * Remove a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ remove(params: SyncListItemContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ fetch(callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Update a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ update(callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Update a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ update(params: SyncListItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncListItemContextSolution { serviceSid: string; listSid: string; index: number; } export declare class SyncListItemContextImpl implements SyncListItemContext { protected _version: V1; protected _solution: SyncListItemContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, listSid: string, index: number); remove(params?: SyncListItemContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; update(params?: SyncListItemContextUpdateOptions | ((error: Error | null, item?: SyncListItemInstance) => any), callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncListItemContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncListItemPayload extends TwilioResponsePayload { items: SyncListItemResource[]; } interface SyncListItemResource { index: number; account_sid: string; service_sid: string; list_sid: string; url: string; revision: string; data: any; date_expires: Date; date_created: Date; date_updated: Date; created_by: string; } export declare class SyncListItemInstance { protected _version: V1; protected _solution: SyncListItemContextSolution; protected _context?: SyncListItemContext; constructor(_version: V1, payload: SyncListItemResource, serviceSid: string, listSid: string, index?: number); /** * The automatically generated index of the List Item. The `index` values of the List Items in a Sync List can have gaps in their sequence. */ index: number; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the List Item resource. */ accountSid: string; /** * The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. */ serviceSid: string; /** * The SID of the Sync List that contains the List Item. */ listSid: string; /** * The absolute URL of the List Item resource. */ url: string; /** * The current revision of the item, represented as a string. */ revision: string; /** * An arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. */ data: any; /** * The date and time in GMT when the List Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the List Item does not expire, this value is `null`. The List Item resource might not be deleted immediately after it expires. */ dateExpires: Date; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The identity of the List Item\'s creator. If the item is created from the client SDK, the value matches the Access Token\'s `identity` field. If the item was created from the REST API, the value is `system`. */ createdBy: string; private get _proxy(); /** * Remove a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ remove(params: SyncListItemContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ fetch(callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Update a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ update(callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Update a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ update(params: SyncListItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { index: number; accountSid: string; serviceSid: string; listSid: string; url: string; revision: string; data: any; dateExpires: Date; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncListItemSolution { serviceSid: string; listSid: string; } export interface SyncListItemListInstance { _version: V1; _solution: SyncListItemSolution; _uri: string; (index: number): SyncListItemContext; get(index: number): SyncListItemContext; /** * Create a SyncListItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ create(params: SyncListItemListInstanceCreateOptions, callback?: (error: Error | null, item?: SyncListItemInstance) => any): Promise<SyncListItemInstance>; /** * Streams SyncListItemInstance 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 { SyncListItemListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncListItemInstance, done: (err?: Error) => void) => void): void; each(params: SyncListItemListInstanceEachOptions, callback?: (item: SyncListItemInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncListItemInstance 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: SyncListItemPage) => any): Promise<SyncListItemPage>; /** * Lists SyncListItemInstance 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 { SyncListItemListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncListItemInstance[]) => any): Promise<SyncListItemInstance[]>; list(params: SyncListItemListInstanceOptions, callback?: (error: Error | null, items: SyncListItemInstance[]) => any): Promise<SyncListItemInstance[]>; /** * Retrieve a single page of SyncListItemInstance 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 { SyncListItemListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncListItemPage) => any): Promise<SyncListItemPage>; page(params: SyncListItemListInstancePageOptions, callback?: (error: Error | null, items: SyncListItemPage) => any): Promise<SyncListItemPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncListItemListInstance(version: V1, serviceSid: string, listSid: string): SyncListItemListInstance; export declare class SyncListItemPage extends Page<V1, SyncListItemPayload, SyncListItemResource, SyncListItemInstance> { /** * Initialize the SyncListItemPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SyncListItemSolution); /** * Build an instance of SyncListItemInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncListItemResource): SyncListItemInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/syncList/syncListItem.js000064400000027111151677225100015270 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.SyncListItemPage = exports.SyncListItemListInstance = exports.SyncListItemInstance = exports.SyncListItemContextImpl = void 0; 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 SyncListItemContextImpl { constructor(_version, serviceSid, listSid, index) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(listSid)) { throw new Error("Parameter 'listSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(index)) { throw new Error("Parameter 'index' is not valid."); } this._solution = { serviceSid, listSid, index }; this._uri = `/Services/${serviceSid}/Lists/${listSid}/Items/${index}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncListItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid, instance._solution.index)); 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["data"] !== undefined) data["Data"] = serialize.object(params["data"]); if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["itemTtl"] !== undefined) data["ItemTtl"] = params["itemTtl"]; if (params["collectionTtl"] !== undefined) data["CollectionTtl"] = params["collectionTtl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid, instance._solution.index)); 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.SyncListItemContextImpl = SyncListItemContextImpl; class SyncListItemInstance { constructor(_version, payload, serviceSid, listSid, index) { this._version = _version; this.index = deserialize.integer(payload.index); this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.listSid = payload.list_sid; this.url = payload.url; this.revision = payload.revision; this.data = payload.data; this.dateExpires = deserialize.iso8601DateTime(payload.date_expires); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, listSid, index: index || this.index }; } get _proxy() { this._context = this._context || new SyncListItemContextImpl(this._version, this._solution.serviceSid, this._solution.listSid, this._solution.index); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a SyncListItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListItemInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { index: this.index, accountSid: this.accountSid, serviceSid: this.serviceSid, listSid: this.listSid, url: this.url, revision: this.revision, data: this.data, dateExpires: this.dateExpires, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListItemInstance = SyncListItemInstance; function SyncListItemListInstance(version, serviceSid, listSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(listSid)) { throw new Error("Parameter 'listSid' is not valid."); } const instance = ((index) => instance.get(index)); instance.get = function get(index) { return new SyncListItemContextImpl(version, serviceSid, listSid, index); }; instance._version = version; instance._solution = { serviceSid, listSid }; instance._uri = `/Services/${serviceSid}/Lists/${listSid}/Items`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["data"] === null || params["data"] === undefined) { throw new Error("Required parameter \"params['data']\" missing."); } let data = {}; data["Data"] = serialize.object(params["data"]); if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["itemTtl"] !== undefined) data["ItemTtl"] = params["itemTtl"]; if (params["collectionTtl"] !== undefined) data["CollectionTtl"] = params["collectionTtl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid)); 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["order"] !== undefined) data["Order"] = params["order"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["bounds"] !== undefined) data["Bounds"] = params["bounds"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListItemPage(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 SyncListItemPage(instance._version, payload, 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; } exports.SyncListItemListInstance = SyncListItemListInstance; class SyncListItemPage extends Page_1.default { /** * Initialize the SyncListItemPage * * @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 SyncListItemInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncListItemInstance(this._version, payload, this._solution.serviceSid, this._solution.listSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListItemPage = SyncListItemPage; rest/sync/v1/service/syncList/syncListPermission.d.ts000064400000026212151677225100016757 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to update a SyncListPermissionInstance */ export interface SyncListPermissionContextUpdateOptions { /** Whether the identity can read the Sync List and its Items. Default value is `false`. */ read: boolean; /** Whether the identity can create, update, and delete Items in the Sync List. Default value is `false`. */ write: boolean; /** Whether the identity can delete the Sync List. Default value is `false`. */ manage: boolean; } /** * Options to pass to each */ export interface SyncListPermissionListInstanceEachOptions { /** 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: SyncListPermissionInstance, 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 SyncListPermissionListInstanceOptions { /** 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 SyncListPermissionListInstancePageOptions { /** 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 SyncListPermissionContext { /** * Remove a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ fetch(callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Update a SyncListPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ update(params: SyncListPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncListPermissionContextSolution { serviceSid: string; listSid: string; identity: string; } export declare class SyncListPermissionContextImpl implements SyncListPermissionContext { protected _version: V1; protected _solution: SyncListPermissionContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, listSid: string, identity: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; update(params: SyncListPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncListPermissionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncListPermissionPayload extends TwilioResponsePayload { permissions: SyncListPermissionResource[]; } interface SyncListPermissionResource { account_sid: string; service_sid: string; list_sid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; } export declare class SyncListPermissionInstance { protected _version: V1; protected _solution: SyncListPermissionContextSolution; protected _context?: SyncListPermissionContext; constructor(_version: V1, payload: SyncListPermissionResource, serviceSid: string, listSid: string, identity?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List Permission resource. */ accountSid: string; /** * The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. */ serviceSid: string; /** * The SID of the Sync List to which the Permission applies. */ listSid: string; /** * The application-defined string that uniquely identifies the resource\'s User within the Service to an FPA token. */ identity: string; /** * Whether the identity can read the Sync List and its Items. */ read: boolean; /** * Whether the identity can create, update, and delete Items in the Sync List. */ write: boolean; /** * Whether the identity can delete the Sync List. */ manage: boolean; /** * The absolute URL of the Sync List Permission resource. */ url: string; private get _proxy(); /** * Remove a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ fetch(callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Update a SyncListPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ update(params: SyncListPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncListPermissionInstance) => any): Promise<SyncListPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; listSid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncListPermissionSolution { serviceSid: string; listSid: string; } export interface SyncListPermissionListInstance { _version: V1; _solution: SyncListPermissionSolution; _uri: string; (identity: string): SyncListPermissionContext; get(identity: string): SyncListPermissionContext; /** * Streams SyncListPermissionInstance 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 { SyncListPermissionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncListPermissionInstance, done: (err?: Error) => void) => void): void; each(params: SyncListPermissionListInstanceEachOptions, callback?: (item: SyncListPermissionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncListPermissionInstance 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: SyncListPermissionPage) => any): Promise<SyncListPermissionPage>; /** * Lists SyncListPermissionInstance 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 { SyncListPermissionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncListPermissionInstance[]) => any): Promise<SyncListPermissionInstance[]>; list(params: SyncListPermissionListInstanceOptions, callback?: (error: Error | null, items: SyncListPermissionInstance[]) => any): Promise<SyncListPermissionInstance[]>; /** * Retrieve a single page of SyncListPermissionInstance 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 { SyncListPermissionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncListPermissionPage) => any): Promise<SyncListPermissionPage>; page(params: SyncListPermissionListInstancePageOptions, callback?: (error: Error | null, items: SyncListPermissionPage) => any): Promise<SyncListPermissionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncListPermissionListInstance(version: V1, serviceSid: string, listSid: string): SyncListPermissionListInstance; export declare class SyncListPermissionPage extends Page<V1, SyncListPermissionPayload, SyncListPermissionResource, SyncListPermissionInstance> { /** * Initialize the SyncListPermissionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SyncListPermissionSolution); /** * Build an instance of SyncListPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncListPermissionResource): SyncListPermissionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/syncList/syncListPermission.js000064400000023515151677225100016526 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.SyncListPermissionPage = exports.SyncListPermissionListInstance = exports.SyncListPermissionInstance = exports.SyncListPermissionContextImpl = void 0; 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 SyncListPermissionContextImpl { constructor(_version, serviceSid, listSid, identity) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(listSid)) { throw new Error("Parameter 'listSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } this._solution = { serviceSid, listSid, identity }; this._uri = `/Services/${serviceSid}/Lists/${listSid}/Permissions/${identity}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncListPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid, instance._solution.identity)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["read"] === null || params["read"] === undefined) { throw new Error("Required parameter \"params['read']\" missing."); } if (params["write"] === null || params["write"] === undefined) { throw new Error("Required parameter \"params['write']\" missing."); } if (params["manage"] === null || params["manage"] === undefined) { throw new Error("Required parameter \"params['manage']\" missing."); } let data = {}; data["Read"] = serialize.bool(params["read"]); data["Write"] = serialize.bool(params["write"]); data["Manage"] = serialize.bool(params["manage"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.listSid, instance._solution.identity)); 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.SyncListPermissionContextImpl = SyncListPermissionContextImpl; class SyncListPermissionInstance { constructor(_version, payload, serviceSid, listSid, identity) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.listSid = payload.list_sid; this.identity = payload.identity; this.read = payload.read; this.write = payload.write; this.manage = payload.manage; this.url = payload.url; this._solution = { serviceSid, listSid, identity: identity || this.identity, }; } get _proxy() { this._context = this._context || new SyncListPermissionContextImpl(this._version, this._solution.serviceSid, this._solution.listSid, this._solution.identity); return this._context; } /** * Remove a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SyncListPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncListPermissionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, listSid: this.listSid, identity: this.identity, read: this.read, write: this.write, manage: this.manage, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListPermissionInstance = SyncListPermissionInstance; function SyncListPermissionListInstance(version, serviceSid, listSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(listSid)) { throw new Error("Parameter 'listSid' is not valid."); } const instance = ((identity) => instance.get(identity)); instance.get = function get(identity) { return new SyncListPermissionContextImpl(version, serviceSid, listSid, identity); }; instance._version = version; instance._solution = { serviceSid, listSid }; instance._uri = `/Services/${serviceSid}/Lists/${listSid}/Permissions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncListPermissionPage(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 SyncListPermissionPage(instance._version, payload, 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; } exports.SyncListPermissionListInstance = SyncListPermissionListInstance; class SyncListPermissionPage extends Page_1.default { /** * Initialize the SyncListPermissionPage * * @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 SyncListPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncListPermissionInstance(this._version, payload, this._solution.serviceSid, this._solution.listSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncListPermissionPage = SyncListPermissionPage; rest/sync/v1/service/document/documentPermission.js000064400000023651151677225100016543 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.DocumentPermissionPage = exports.DocumentPermissionListInstance = exports.DocumentPermissionInstance = exports.DocumentPermissionContextImpl = void 0; 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 DocumentPermissionContextImpl { constructor(_version, serviceSid, documentSid, identity) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(documentSid)) { throw new Error("Parameter 'documentSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } this._solution = { serviceSid, documentSid, identity }; this._uri = `/Services/${serviceSid}/Documents/${documentSid}/Permissions/${identity}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DocumentPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.documentSid, instance._solution.identity)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["read"] === null || params["read"] === undefined) { throw new Error("Required parameter \"params['read']\" missing."); } if (params["write"] === null || params["write"] === undefined) { throw new Error("Required parameter \"params['write']\" missing."); } if (params["manage"] === null || params["manage"] === undefined) { throw new Error("Required parameter \"params['manage']\" missing."); } let data = {}; data["Read"] = serialize.bool(params["read"]); data["Write"] = serialize.bool(params["write"]); data["Manage"] = serialize.bool(params["manage"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.documentSid, instance._solution.identity)); 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.DocumentPermissionContextImpl = DocumentPermissionContextImpl; class DocumentPermissionInstance { constructor(_version, payload, serviceSid, documentSid, identity) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.documentSid = payload.document_sid; this.identity = payload.identity; this.read = payload.read; this.write = payload.write; this.manage = payload.manage; this.url = payload.url; this._solution = { serviceSid, documentSid, identity: identity || this.identity, }; } get _proxy() { this._context = this._context || new DocumentPermissionContextImpl(this._version, this._solution.serviceSid, this._solution.documentSid, this._solution.identity); return this._context; } /** * Remove a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, documentSid: this.documentSid, identity: this.identity, read: this.read, write: this.write, manage: this.manage, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DocumentPermissionInstance = DocumentPermissionInstance; function DocumentPermissionListInstance(version, serviceSid, documentSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(documentSid)) { throw new Error("Parameter 'documentSid' is not valid."); } const instance = ((identity) => instance.get(identity)); instance.get = function get(identity) { return new DocumentPermissionContextImpl(version, serviceSid, documentSid, identity); }; instance._version = version; instance._solution = { serviceSid, documentSid }; instance._uri = `/Services/${serviceSid}/Documents/${documentSid}/Permissions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentPermissionPage(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 DocumentPermissionPage(instance._version, payload, 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; } exports.DocumentPermissionListInstance = DocumentPermissionListInstance; class DocumentPermissionPage extends Page_1.default { /** * Initialize the DocumentPermissionPage * * @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 DocumentPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DocumentPermissionInstance(this._version, payload, this._solution.serviceSid, this._solution.documentSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DocumentPermissionPage = DocumentPermissionPage; rest/sync/v1/service/document/documentPermission.d.ts000064400000026174151677225100017002 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to update a DocumentPermissionInstance */ export interface DocumentPermissionContextUpdateOptions { /** Whether the identity can read the Sync Document. Default value is `false`. */ read: boolean; /** Whether the identity can update the Sync Document. Default value is `false`. */ write: boolean; /** Whether the identity can delete the Sync Document. Default value is `false`. */ manage: boolean; } /** * Options to pass to each */ export interface DocumentPermissionListInstanceEachOptions { /** 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: DocumentPermissionInstance, 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 DocumentPermissionListInstanceOptions { /** 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 DocumentPermissionListInstancePageOptions { /** 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 DocumentPermissionContext { /** * Remove a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ fetch(callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Update a DocumentPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ update(params: DocumentPermissionContextUpdateOptions, callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DocumentPermissionContextSolution { serviceSid: string; documentSid: string; identity: string; } export declare class DocumentPermissionContextImpl implements DocumentPermissionContext { protected _version: V1; protected _solution: DocumentPermissionContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, documentSid: string, identity: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; update(params: DocumentPermissionContextUpdateOptions, callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DocumentPermissionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DocumentPermissionPayload extends TwilioResponsePayload { permissions: DocumentPermissionResource[]; } interface DocumentPermissionResource { account_sid: string; service_sid: string; document_sid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; } export declare class DocumentPermissionInstance { protected _version: V1; protected _solution: DocumentPermissionContextSolution; protected _context?: DocumentPermissionContext; constructor(_version: V1, payload: DocumentPermissionResource, serviceSid: string, documentSid: string, identity?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document Permission resource. */ accountSid: string; /** * The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. */ serviceSid: string; /** * The SID of the Sync Document to which the Document Permission applies. */ documentSid: string; /** * The application-defined string that uniquely identifies the resource\'s User within the Service to an FPA token. */ identity: string; /** * Whether the identity can read the Sync Document. */ read: boolean; /** * Whether the identity can update the Sync Document. */ write: boolean; /** * Whether the identity can delete the Sync Document. */ manage: boolean; /** * The absolute URL of the Sync Document Permission resource. */ url: string; private get _proxy(); /** * Remove a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DocumentPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ fetch(callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Update a DocumentPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentPermissionInstance */ update(params: DocumentPermissionContextUpdateOptions, callback?: (error: Error | null, item?: DocumentPermissionInstance) => any): Promise<DocumentPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; documentSid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DocumentPermissionSolution { serviceSid: string; documentSid: string; } export interface DocumentPermissionListInstance { _version: V1; _solution: DocumentPermissionSolution; _uri: string; (identity: string): DocumentPermissionContext; get(identity: string): DocumentPermissionContext; /** * Streams DocumentPermissionInstance 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 { DocumentPermissionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DocumentPermissionInstance, done: (err?: Error) => void) => void): void; each(params: DocumentPermissionListInstanceEachOptions, callback?: (item: DocumentPermissionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DocumentPermissionInstance 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: DocumentPermissionPage) => any): Promise<DocumentPermissionPage>; /** * Lists DocumentPermissionInstance 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 { DocumentPermissionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DocumentPermissionInstance[]) => any): Promise<DocumentPermissionInstance[]>; list(params: DocumentPermissionListInstanceOptions, callback?: (error: Error | null, items: DocumentPermissionInstance[]) => any): Promise<DocumentPermissionInstance[]>; /** * Retrieve a single page of DocumentPermissionInstance 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 { DocumentPermissionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DocumentPermissionPage) => any): Promise<DocumentPermissionPage>; page(params: DocumentPermissionListInstancePageOptions, callback?: (error: Error | null, items: DocumentPermissionPage) => any): Promise<DocumentPermissionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DocumentPermissionListInstance(version: V1, serviceSid: string, documentSid: string): DocumentPermissionListInstance; export declare class DocumentPermissionPage extends Page<V1, DocumentPermissionPayload, DocumentPermissionResource, DocumentPermissionInstance> { /** * Initialize the DocumentPermissionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DocumentPermissionSolution); /** * Build an instance of DocumentPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload: DocumentPermissionResource): DocumentPermissionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/document.d.ts000064400000033433151677225100013107 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { DocumentPermissionListInstance } from "./document/documentPermission"; /** * Options to pass to update a DocumentInstance */ export interface DocumentContextUpdateOptions { /** The If-Match HTTP request header */ ifMatch?: string; /** A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. */ data?: any; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Document expires and is deleted (time-to-live). */ ttl?: number; } /** * Options to pass to create a DocumentInstance */ export interface DocumentListInstanceCreateOptions { /** An application-defined string that uniquely identifies the Sync Document */ uniqueName?: string; /** A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. */ data?: any; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Document expires and is deleted (the Sync Document\\\'s time-to-live). */ ttl?: number; } /** * Options to pass to each */ export interface DocumentListInstanceEachOptions { /** 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: DocumentInstance, 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 DocumentListInstanceOptions { /** 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 DocumentListInstancePageOptions { /** 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 DocumentContext { documentPermissions: DocumentPermissionListInstance; /** * Remove a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ fetch(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Update a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ update(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Update a DocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ update(params: DocumentContextUpdateOptions, callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DocumentContextSolution { serviceSid: string; sid: string; } export declare class DocumentContextImpl implements DocumentContext { protected _version: V1; protected _solution: DocumentContextSolution; protected _uri: string; protected _documentPermissions?: DocumentPermissionListInstance; constructor(_version: V1, serviceSid: string, sid: string); get documentPermissions(): DocumentPermissionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; update(params?: DocumentContextUpdateOptions | ((error: Error | null, item?: DocumentInstance) => any), callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DocumentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DocumentPayload extends TwilioResponsePayload { documents: DocumentResource[]; } interface DocumentResource { sid: string; unique_name: string; account_sid: string; service_sid: string; url: string; links: Record<string, string>; revision: string; data: any; date_expires: Date; date_created: Date; date_updated: Date; created_by: string; } export declare class DocumentInstance { protected _version: V1; protected _solution: DocumentContextSolution; protected _context?: DocumentContext; constructor(_version: V1, payload: DocumentResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Document resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource and can be up to 320 characters long. */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. */ accountSid: string; /** * The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. */ serviceSid: string; /** * The absolute URL of the Document resource. */ url: string; /** * The URLs of resources related to the Sync Document. */ links: Record<string, string>; /** * The current revision of the Sync Document, represented as a string. The `revision` property is used with conditional updates to ensure data consistency. */ revision: string; /** * An arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. */ data: any; /** * The date and time in GMT when the Sync Document expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Document does not expire, this value is `null`. The Document resource might not be deleted immediately after it expires. */ dateExpires: Date; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The identity of the Sync Document\'s creator. If the Sync Document is created from the client SDK, the value matches the Access Token\'s `identity` field. If the Sync Document was created from the REST API, the value is `system`. */ createdBy: string; private get _proxy(); /** * Remove a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ fetch(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Update a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ update(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Update a DocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ update(params: DocumentContextUpdateOptions, callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Access the documentPermissions. */ documentPermissions(): DocumentPermissionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; serviceSid: string; url: string; links: Record<string, string>; revision: string; data: any; dateExpires: Date; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DocumentSolution { serviceSid: string; } export interface DocumentListInstance { _version: V1; _solution: DocumentSolution; _uri: string; (sid: string): DocumentContext; get(sid: string): DocumentContext; /** * Create a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ create(callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Create a DocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ create(params: DocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: DocumentInstance) => any): Promise<DocumentInstance>; /** * Streams DocumentInstance 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 { DocumentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DocumentInstance, done: (err?: Error) => void) => void): void; each(params: DocumentListInstanceEachOptions, callback?: (item: DocumentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DocumentInstance 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: DocumentPage) => any): Promise<DocumentPage>; /** * Lists DocumentInstance 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 { DocumentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DocumentInstance[]) => any): Promise<DocumentInstance[]>; list(params: DocumentListInstanceOptions, callback?: (error: Error | null, items: DocumentInstance[]) => any): Promise<DocumentInstance[]>; /** * Retrieve a single page of DocumentInstance 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 { DocumentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DocumentPage) => any): Promise<DocumentPage>; page(params: DocumentListInstancePageOptions, callback?: (error: Error | null, items: DocumentPage) => any): Promise<DocumentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DocumentListInstance(version: V1, serviceSid: string): DocumentListInstance; export declare class DocumentPage extends Page<V1, DocumentPayload, DocumentResource, DocumentInstance> { /** * Initialize the DocumentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DocumentSolution); /** * Build an instance of DocumentInstance * * @param payload - Payload response from the API */ getInstance(payload: DocumentResource): DocumentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/syncMap/syncMapPermission.d.ts000064400000026047151677225100016371 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to update a SyncMapPermissionInstance */ export interface SyncMapPermissionContextUpdateOptions { /** Whether the identity can read the Sync Map and its Items. Default value is `false`. */ read: boolean; /** Whether the identity can create, update, and delete Items in the Sync Map. Default value is `false`. */ write: boolean; /** Whether the identity can delete the Sync Map. Default value is `false`. */ manage: boolean; } /** * Options to pass to each */ export interface SyncMapPermissionListInstanceEachOptions { /** 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: SyncMapPermissionInstance, 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 SyncMapPermissionListInstanceOptions { /** 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 SyncMapPermissionListInstancePageOptions { /** 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 SyncMapPermissionContext { /** * Remove a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ fetch(callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Update a SyncMapPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ update(params: SyncMapPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncMapPermissionContextSolution { serviceSid: string; mapSid: string; identity: string; } export declare class SyncMapPermissionContextImpl implements SyncMapPermissionContext { protected _version: V1; protected _solution: SyncMapPermissionContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, mapSid: string, identity: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; update(params: SyncMapPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncMapPermissionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncMapPermissionPayload extends TwilioResponsePayload { permissions: SyncMapPermissionResource[]; } interface SyncMapPermissionResource { account_sid: string; service_sid: string; map_sid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; } export declare class SyncMapPermissionInstance { protected _version: V1; protected _solution: SyncMapPermissionContextSolution; protected _context?: SyncMapPermissionContext; constructor(_version: V1, payload: SyncMapPermissionResource, serviceSid: string, mapSid: string, identity?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map Permission resource. */ accountSid: string; /** * The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. */ serviceSid: string; /** * The SID of the Sync Map to which the Permission applies. */ mapSid: string; /** * The application-defined string that uniquely identifies the resource\'s User within the Service to an FPA token. */ identity: string; /** * Whether the identity can read the Sync Map and its Items. */ read: boolean; /** * Whether the identity can create, update, and delete Items in the Sync Map. */ write: boolean; /** * Whether the identity can delete the Sync Map. */ manage: boolean; /** * The absolute URL of the Sync Map Permission resource. */ url: string; private get _proxy(); /** * Remove a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ fetch(callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Update a SyncMapPermissionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ update(params: SyncMapPermissionContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapPermissionInstance) => any): Promise<SyncMapPermissionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; mapSid: string; identity: string; read: boolean; write: boolean; manage: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncMapPermissionSolution { serviceSid: string; mapSid: string; } export interface SyncMapPermissionListInstance { _version: V1; _solution: SyncMapPermissionSolution; _uri: string; (identity: string): SyncMapPermissionContext; get(identity: string): SyncMapPermissionContext; /** * Streams SyncMapPermissionInstance 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 { SyncMapPermissionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncMapPermissionInstance, done: (err?: Error) => void) => void): void; each(params: SyncMapPermissionListInstanceEachOptions, callback?: (item: SyncMapPermissionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncMapPermissionInstance 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: SyncMapPermissionPage) => any): Promise<SyncMapPermissionPage>; /** * Lists SyncMapPermissionInstance 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 { SyncMapPermissionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncMapPermissionInstance[]) => any): Promise<SyncMapPermissionInstance[]>; list(params: SyncMapPermissionListInstanceOptions, callback?: (error: Error | null, items: SyncMapPermissionInstance[]) => any): Promise<SyncMapPermissionInstance[]>; /** * Retrieve a single page of SyncMapPermissionInstance 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 { SyncMapPermissionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncMapPermissionPage) => any): Promise<SyncMapPermissionPage>; page(params: SyncMapPermissionListInstancePageOptions, callback?: (error: Error | null, items: SyncMapPermissionPage) => any): Promise<SyncMapPermissionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncMapPermissionListInstance(version: V1, serviceSid: string, mapSid: string): SyncMapPermissionListInstance; export declare class SyncMapPermissionPage extends Page<V1, SyncMapPermissionPayload, SyncMapPermissionResource, SyncMapPermissionInstance> { /** * Initialize the SyncMapPermissionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SyncMapPermissionSolution); /** * Build an instance of SyncMapPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncMapPermissionResource): SyncMapPermissionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/syncMap/syncMapPermission.js000064400000023432151677225100016130 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.SyncMapPermissionPage = exports.SyncMapPermissionListInstance = exports.SyncMapPermissionInstance = exports.SyncMapPermissionContextImpl = void 0; 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 SyncMapPermissionContextImpl { constructor(_version, serviceSid, mapSid, identity) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(mapSid)) { throw new Error("Parameter 'mapSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } this._solution = { serviceSid, mapSid, identity }; this._uri = `/Services/${serviceSid}/Maps/${mapSid}/Permissions/${identity}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncMapPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid, instance._solution.identity)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["read"] === null || params["read"] === undefined) { throw new Error("Required parameter \"params['read']\" missing."); } if (params["write"] === null || params["write"] === undefined) { throw new Error("Required parameter \"params['write']\" missing."); } if (params["manage"] === null || params["manage"] === undefined) { throw new Error("Required parameter \"params['manage']\" missing."); } let data = {}; data["Read"] = serialize.bool(params["read"]); data["Write"] = serialize.bool(params["write"]); data["Manage"] = serialize.bool(params["manage"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapPermissionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid, instance._solution.identity)); 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.SyncMapPermissionContextImpl = SyncMapPermissionContextImpl; class SyncMapPermissionInstance { constructor(_version, payload, serviceSid, mapSid, identity) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.mapSid = payload.map_sid; this.identity = payload.identity; this.read = payload.read; this.write = payload.write; this.manage = payload.manage; this.url = payload.url; this._solution = { serviceSid, mapSid, identity: identity || this.identity, }; } get _proxy() { this._context = this._context || new SyncMapPermissionContextImpl(this._version, this._solution.serviceSid, this._solution.mapSid, this._solution.identity); return this._context; } /** * Remove a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SyncMapPermissionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapPermissionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, mapSid: this.mapSid, identity: this.identity, read: this.read, write: this.write, manage: this.manage, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapPermissionInstance = SyncMapPermissionInstance; function SyncMapPermissionListInstance(version, serviceSid, mapSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(mapSid)) { throw new Error("Parameter 'mapSid' is not valid."); } const instance = ((identity) => instance.get(identity)); instance.get = function get(identity) { return new SyncMapPermissionContextImpl(version, serviceSid, mapSid, identity); }; instance._version = version; instance._solution = { serviceSid, mapSid }; instance._uri = `/Services/${serviceSid}/Maps/${mapSid}/Permissions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapPermissionPage(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 SyncMapPermissionPage(instance._version, payload, 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; } exports.SyncMapPermissionListInstance = SyncMapPermissionListInstance; class SyncMapPermissionPage extends Page_1.default { /** * Initialize the SyncMapPermissionPage * * @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 SyncMapPermissionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncMapPermissionInstance(this._version, payload, this._solution.serviceSid, this._solution.mapSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapPermissionPage = SyncMapPermissionPage; rest/sync/v1/service/syncMap/syncMapItem.js000064400000027232151677225100014700 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.SyncMapItemPage = exports.SyncMapItemListInstance = exports.SyncMapItemInstance = exports.SyncMapItemContextImpl = void 0; 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 SyncMapItemContextImpl { constructor(_version, serviceSid, mapSid, key) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(mapSid)) { throw new Error("Parameter 'mapSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(key)) { throw new Error("Parameter 'key' is not valid."); } this._solution = { serviceSid, mapSid, key }; this._uri = `/Services/${serviceSid}/Maps/${mapSid}/Items/${key}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncMapItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid, instance._solution.key)); 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["data"] !== undefined) data["Data"] = serialize.object(params["data"]); if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["itemTtl"] !== undefined) data["ItemTtl"] = params["itemTtl"]; if (params["collectionTtl"] !== undefined) data["CollectionTtl"] = params["collectionTtl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid, instance._solution.key)); 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.SyncMapItemContextImpl = SyncMapItemContextImpl; class SyncMapItemInstance { constructor(_version, payload, serviceSid, mapSid, key) { this._version = _version; this.key = payload.key; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.mapSid = payload.map_sid; this.url = payload.url; this.revision = payload.revision; this.data = payload.data; this.dateExpires = deserialize.iso8601DateTime(payload.date_expires); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, mapSid, key: key || this.key }; } get _proxy() { this._context = this._context || new SyncMapItemContextImpl(this._version, this._solution.serviceSid, this._solution.mapSid, this._solution.key); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { key: this.key, accountSid: this.accountSid, serviceSid: this.serviceSid, mapSid: this.mapSid, url: this.url, revision: this.revision, data: this.data, dateExpires: this.dateExpires, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapItemInstance = SyncMapItemInstance; function SyncMapItemListInstance(version, serviceSid, mapSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(mapSid)) { throw new Error("Parameter 'mapSid' is not valid."); } const instance = ((key) => instance.get(key)); instance.get = function get(key) { return new SyncMapItemContextImpl(version, serviceSid, mapSid, key); }; instance._version = version; instance._solution = { serviceSid, mapSid }; instance._uri = `/Services/${serviceSid}/Maps/${mapSid}/Items`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["key"] === null || params["key"] === undefined) { throw new Error("Required parameter \"params['key']\" missing."); } if (params["data"] === null || params["data"] === undefined) { throw new Error("Required parameter \"params['data']\" missing."); } let data = {}; data["Key"] = params["key"]; data["Data"] = serialize.object(params["data"]); if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["itemTtl"] !== undefined) data["ItemTtl"] = params["itemTtl"]; if (params["collectionTtl"] !== undefined) data["CollectionTtl"] = params["collectionTtl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapItemInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.mapSid)); 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["order"] !== undefined) data["Order"] = params["order"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["bounds"] !== undefined) data["Bounds"] = params["bounds"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapItemPage(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 SyncMapItemPage(instance._version, payload, 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; } exports.SyncMapItemListInstance = SyncMapItemListInstance; class SyncMapItemPage extends Page_1.default { /** * Initialize the SyncMapItemPage * * @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 SyncMapItemInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncMapItemInstance(this._version, payload, this._solution.serviceSid, this._solution.mapSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapItemPage = SyncMapItemPage; rest/sync/v1/service/syncMap/syncMapItem.d.ts000064400000042434151677225100015135 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type SyncMapItemQueryFromBoundType = "inclusive" | "exclusive"; export type SyncMapItemQueryResultOrder = "asc" | "desc"; /** * Options to pass to remove a SyncMapItemInstance */ export interface SyncMapItemContextRemoveOptions { /** If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). */ ifMatch?: string; } /** * Options to pass to update a SyncMapItemInstance */ export interface SyncMapItemContextUpdateOptions { /** If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). */ ifMatch?: string; /** A JSON string that represents an arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. */ data?: any; /** An alias for `item_ttl`. If both parameters are provided, this value is ignored. */ ttl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item expires (time-to-live) and is deleted. */ itemTtl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item\\\'s parent Sync Map expires (time-to-live) and is deleted. This parameter can only be used when the Map Item\\\'s `data` or `ttl` is updated in the same request. */ collectionTtl?: number; } /** * Options to pass to create a SyncMapItemInstance */ export interface SyncMapItemListInstanceCreateOptions { /** The unique, user-defined key for the Map Item. Can be up to 320 characters long. */ key: string; /** A JSON string that represents an arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. */ data: any; /** An alias for `item_ttl`. If both parameters are provided, this value is ignored. */ ttl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item expires (time-to-live) and is deleted. */ itemTtl?: number; /** How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item\\\'s parent Sync Map expires (time-to-live) and is deleted. */ collectionTtl?: number; } /** * Options to pass to each */ export interface SyncMapItemListInstanceEachOptions { /** How to order the Map Items returned by their `key` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. Map Items are [ordered lexicographically](https://en.wikipedia.org/wiki/Lexicographical_order) by Item key. */ order?: SyncMapItemQueryResultOrder; /** The `key` of the first Sync Map Item resource to read. See also `bounds`. */ from?: string; /** Whether to include the Map Item referenced by the `from` parameter. Can be: `inclusive` to include the Map Item referenced by the `from` parameter or `exclusive` to start with the next Map Item. The default value is `inclusive`. */ bounds?: SyncMapItemQueryFromBoundType; /** 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: SyncMapItemInstance, 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 SyncMapItemListInstanceOptions { /** How to order the Map Items returned by their `key` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. Map Items are [ordered lexicographically](https://en.wikipedia.org/wiki/Lexicographical_order) by Item key. */ order?: SyncMapItemQueryResultOrder; /** The `key` of the first Sync Map Item resource to read. See also `bounds`. */ from?: string; /** Whether to include the Map Item referenced by the `from` parameter. Can be: `inclusive` to include the Map Item referenced by the `from` parameter or `exclusive` to start with the next Map Item. The default value is `inclusive`. */ bounds?: SyncMapItemQueryFromBoundType; /** 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 SyncMapItemListInstancePageOptions { /** How to order the Map Items returned by their `key` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. Map Items are [ordered lexicographically](https://en.wikipedia.org/wiki/Lexicographical_order) by Item key. */ order?: SyncMapItemQueryResultOrder; /** The `key` of the first Sync Map Item resource to read. See also `bounds`. */ from?: string; /** Whether to include the Map Item referenced by the `from` parameter. Can be: `inclusive` to include the Map Item referenced by the `from` parameter or `exclusive` to start with the next Map Item. The default value is `inclusive`. */ bounds?: SyncMapItemQueryFromBoundType; /** 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 SyncMapItemContext { /** * Remove a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ remove(params: SyncMapItemContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ fetch(callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Update a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ update(callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Update a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ update(params: SyncMapItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SyncMapItemContextSolution { serviceSid: string; mapSid: string; key: string; } export declare class SyncMapItemContextImpl implements SyncMapItemContext { protected _version: V1; protected _solution: SyncMapItemContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, mapSid: string, key: string); remove(params?: SyncMapItemContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; update(params?: SyncMapItemContextUpdateOptions | ((error: Error | null, item?: SyncMapItemInstance) => any), callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SyncMapItemContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SyncMapItemPayload extends TwilioResponsePayload { items: SyncMapItemResource[]; } interface SyncMapItemResource { key: string; account_sid: string; service_sid: string; map_sid: string; url: string; revision: string; data: any; date_expires: Date; date_created: Date; date_updated: Date; created_by: string; } export declare class SyncMapItemInstance { protected _version: V1; protected _solution: SyncMapItemContextSolution; protected _context?: SyncMapItemContext; constructor(_version: V1, payload: SyncMapItemResource, serviceSid: string, mapSid: string, key?: string); /** * The unique, user-defined key for the Map Item. */ key: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Map Item resource. */ accountSid: string; /** * The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. */ serviceSid: string; /** * The SID of the Sync Map that contains the Map Item. */ mapSid: string; /** * The absolute URL of the Map Item resource. */ url: string; /** * The current revision of the Map Item, represented as a string. */ revision: string; /** * An arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. */ data: any; /** * The date and time in GMT when the Map Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Map Item does not expire, this value is `null`. The Map Item might not be deleted immediately after it expires. */ dateExpires: Date; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The identity of the Map Item\'s creator. If the Map Item is created from the client SDK, the value matches the Access Token\'s `identity` field. If the Map Item was created from the REST API, the value is `system`. */ createdBy: string; private get _proxy(); /** * Remove a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ remove(params: SyncMapItemContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ fetch(callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Update a SyncMapItemInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ update(callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Update a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ update(params: SyncMapItemContextUpdateOptions, callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { key: string; accountSid: string; serviceSid: string; mapSid: string; url: string; revision: string; data: any; dateExpires: Date; dateCreated: Date; dateUpdated: Date; createdBy: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SyncMapItemSolution { serviceSid: string; mapSid: string; } export interface SyncMapItemListInstance { _version: V1; _solution: SyncMapItemSolution; _uri: string; (key: string): SyncMapItemContext; get(key: string): SyncMapItemContext; /** * Create a SyncMapItemInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapItemInstance */ create(params: SyncMapItemListInstanceCreateOptions, callback?: (error: Error | null, item?: SyncMapItemInstance) => any): Promise<SyncMapItemInstance>; /** * Streams SyncMapItemInstance 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 { SyncMapItemListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SyncMapItemInstance, done: (err?: Error) => void) => void): void; each(params: SyncMapItemListInstanceEachOptions, callback?: (item: SyncMapItemInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SyncMapItemInstance 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: SyncMapItemPage) => any): Promise<SyncMapItemPage>; /** * Lists SyncMapItemInstance 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 { SyncMapItemListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SyncMapItemInstance[]) => any): Promise<SyncMapItemInstance[]>; list(params: SyncMapItemListInstanceOptions, callback?: (error: Error | null, items: SyncMapItemInstance[]) => any): Promise<SyncMapItemInstance[]>; /** * Retrieve a single page of SyncMapItemInstance 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 { SyncMapItemListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SyncMapItemPage) => any): Promise<SyncMapItemPage>; page(params: SyncMapItemListInstancePageOptions, callback?: (error: Error | null, items: SyncMapItemPage) => any): Promise<SyncMapItemPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SyncMapItemListInstance(version: V1, serviceSid: string, mapSid: string): SyncMapItemListInstance; export declare class SyncMapItemPage extends Page<V1, SyncMapItemPayload, SyncMapItemResource, SyncMapItemInstance> { /** * Initialize the SyncMapItemPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SyncMapItemSolution); /** * Build an instance of SyncMapItemInstance * * @param payload - Payload response from the API */ getInstance(payload: SyncMapItemResource): SyncMapItemInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/sync/v1/service/syncMap.js000064400000025567151677225100012460 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.SyncMapPage = exports.SyncMapListInstance = exports.SyncMapInstance = exports.SyncMapContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const syncMapItem_1 = require("./syncMap/syncMapItem"); const syncMapPermission_1 = require("./syncMap/syncMapPermission"); class SyncMapContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Maps/${sid}`; } get syncMapItems() { this._syncMapItems = this._syncMapItems || (0, syncMapItem_1.SyncMapItemListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._syncMapItems; } get syncMapPermissions() { this._syncMapPermissions = this._syncMapPermissions || (0, syncMapPermission_1.SyncMapPermissionListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._syncMapPermissions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SyncMapInstance(operationVersion, payload, instance._solution.serviceSid, 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["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["collectionTtl"] !== undefined) data["CollectionTtl"] = params["collectionTtl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapInstance(operationVersion, payload, instance._solution.serviceSid, 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.SyncMapContextImpl = SyncMapContextImpl; class SyncMapInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.url = payload.url; this.links = payload.links; this.revision = payload.revision; this.dateExpires = deserialize.iso8601DateTime(payload.date_expires); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SyncMapContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SyncMapInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SyncMapInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the syncMapItems. */ syncMapItems() { return this._proxy.syncMapItems; } /** * Access the syncMapPermissions. */ syncMapPermissions() { return this._proxy.syncMapPermissions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, serviceSid: this.serviceSid, url: this.url, links: this.links, revision: this.revision, dateExpires: this.dateExpires, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapInstance = SyncMapInstance; function SyncMapListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SyncMapContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Maps`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["collectionTtl"] !== undefined) data["CollectionTtl"] = params["collectionTtl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SyncMapPage(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 SyncMapPage(instance._version, payload, 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; } exports.SyncMapListInstance = SyncMapListInstance; class SyncMapPage extends Page_1.default { /** * Initialize the SyncMapPage * * @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 SyncMapInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SyncMapInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SyncMapPage = SyncMapPage; rest/sync/v1/service/document.js000064400000025222151677225100012650 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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.DocumentPage = exports.DocumentListInstance = exports.DocumentInstance = exports.DocumentContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const documentPermission_1 = require("./document/documentPermission"); class DocumentContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Documents/${sid}`; } get documentPermissions() { this._documentPermissions = this._documentPermissions || (0, documentPermission_1.DocumentPermissionListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._documentPermissions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DocumentInstance(operationVersion, payload, instance._solution.serviceSid, 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["data"] !== undefined) data["Data"] = serialize.object(params["data"]); if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentInstance(operationVersion, payload, instance._solution.serviceSid, 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.DocumentContextImpl = DocumentContextImpl; class DocumentInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.url = payload.url; this.links = payload.links; this.revision = payload.revision; this.data = payload.data; this.dateExpires = deserialize.iso8601DateTime(payload.date_expires); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new DocumentContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DocumentInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the documentPermissions. */ documentPermissions() { return this._proxy.documentPermissions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, serviceSid: this.serviceSid, url: this.url, links: this.links, revision: this.revision, data: this.data, dateExpires: this.dateExpires, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DocumentInstance = DocumentInstance; function DocumentListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new DocumentContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Documents`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["data"] !== undefined) data["Data"] = serialize.object(params["data"]); if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DocumentPage(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 DocumentPage(instance._version, payload, 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; } exports.DocumentListInstance = DocumentListInstance; class DocumentPage extends Page_1.default { /** * Initialize the DocumentPage * * @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 DocumentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DocumentInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DocumentPage = DocumentPage; rest/sync/V1.js000064400000002330151677225100007325 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Sync * 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 service_1 = require("./v1/service"); class V1 extends Version_1.default { /** * Initialize the V1 version of Sync * * @param domain - The Twilio (Twilio.Sync) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } } exports.default = V1; rest/Marketplace.d.ts000064400000000175151677225100010554 0ustar00import MarketplaceBase from "./MarketplaceBase"; declare class Marketplace extends MarketplaceBase { } export = Marketplace; rest/Routes.d.ts000064400000001133151677225100007600 0ustar00import { PhoneNumberListInstance } from "./routes/v2/phoneNumber"; import { SipDomainListInstance } from "./routes/v2/sipDomain"; import { TrunkListInstance } from "./routes/v2/trunk"; import RoutesBase from "./RoutesBase"; declare class Routes extends RoutesBase { /** * @deprecated - Use v1.phoneNumbers instead */ get phoneNumbers(): PhoneNumberListInstance; /** * @deprecated - Use v1.sipDomains instead */ get sipDomains(): SipDomainListInstance; /** * @deprecated - Use v1.trunks instead */ get trunks(): TrunkListInstance; } export = Routes; rest/routes/V2.d.ts000064400000002066151677225100010135 0ustar00import RoutesBase from "../RoutesBase"; import Version from "../../base/Version"; import { PhoneNumberListInstance } from "./v2/phoneNumber"; import { SipDomainListInstance } from "./v2/sipDomain"; import { TrunkListInstance } from "./v2/trunk"; export default class V2 extends Version { /** * Initialize the V2 version of Routes * * @param domain - The Twilio (Twilio.Routes) domain */ constructor(domain: RoutesBase); /** phoneNumbers - { Twilio.Routes.V2.PhoneNumberListInstance } resource */ protected _phoneNumbers?: PhoneNumberListInstance; /** sipDomains - { Twilio.Routes.V2.SipDomainListInstance } resource */ protected _sipDomains?: SipDomainListInstance; /** trunks - { Twilio.Routes.V2.TrunkListInstance } resource */ protected _trunks?: TrunkListInstance; /** Getter for phoneNumbers resource */ get phoneNumbers(): PhoneNumberListInstance; /** Getter for sipDomains resource */ get sipDomains(): SipDomainListInstance; /** Getter for trunks resource */ get trunks(): TrunkListInstance; } rest/routes/V2.js000064400000003306151677225100007677 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Routes * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const phoneNumber_1 = require("./v2/phoneNumber"); const sipDomain_1 = require("./v2/sipDomain"); const trunk_1 = require("./v2/trunk"); class V2 extends Version_1.default { /** * Initialize the V2 version of Routes * * @param domain - The Twilio (Twilio.Routes) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for phoneNumbers resource */ get phoneNumbers() { this._phoneNumbers = this._phoneNumbers || (0, phoneNumber_1.PhoneNumberListInstance)(this); return this._phoneNumbers; } /** Getter for sipDomains resource */ get sipDomains() { this._sipDomains = this._sipDomains || (0, sipDomain_1.SipDomainListInstance)(this); return this._sipDomains; } /** Getter for trunks resource */ get trunks() { this._trunks = this._trunks || (0, trunk_1.TrunkListInstance)(this); return this._trunks; } } exports.default = V2; rest/routes/v2/trunk.js000064400000012466151677225100011111 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Routes * 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.TrunkListInstance = exports.TrunkInstance = exports.TrunkContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class TrunkContextImpl { constructor(_version, sipTrunkDomain) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sipTrunkDomain)) { throw new Error("Parameter 'sipTrunkDomain' is not valid."); } this._solution = { sipTrunkDomain }; this._uri = `/Trunks/${sipTrunkDomain}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TrunkInstance(operationVersion, payload, instance._solution.sipTrunkDomain)); 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["voiceRegion"] !== undefined) data["VoiceRegion"] = params["voiceRegion"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TrunkInstance(operationVersion, payload, instance._solution.sipTrunkDomain)); 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.TrunkContextImpl = TrunkContextImpl; class TrunkInstance { constructor(_version, payload, sipTrunkDomain) { this._version = _version; this.sipTrunkDomain = payload.sip_trunk_domain; this.url = payload.url; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.voiceRegion = payload.voice_region; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { sipTrunkDomain: sipTrunkDomain || this.sipTrunkDomain }; } get _proxy() { this._context = this._context || new TrunkContextImpl(this._version, this._solution.sipTrunkDomain); return this._context; } /** * Fetch a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sipTrunkDomain: this.sipTrunkDomain, url: this.url, sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, voiceRegion: this.voiceRegion, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrunkInstance = TrunkInstance; function TrunkListInstance(version) { const instance = ((sipTrunkDomain) => instance.get(sipTrunkDomain)); instance.get = function get(sipTrunkDomain) { return new TrunkContextImpl(version, sipTrunkDomain); }; 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; } exports.TrunkListInstance = TrunkListInstance; rest/routes/v2/phoneNumber.js000064400000012553151677225100012225 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Routes * 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.PhoneNumberListInstance = exports.PhoneNumberInstance = exports.PhoneNumberContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PhoneNumberContextImpl { constructor(_version, phoneNumber) { this._version = _version; if (!(0, utility_1.isValidPathParam)(phoneNumber)) { throw new Error("Parameter 'phoneNumber' is not valid."); } this._solution = { phoneNumber }; this._uri = `/PhoneNumbers/${phoneNumber}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.phoneNumber)); 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["voiceRegion"] !== undefined) data["VoiceRegion"] = params["voiceRegion"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.phoneNumber)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberContextImpl = PhoneNumberContextImpl; class PhoneNumberInstance { constructor(_version, payload, phoneNumber) { this._version = _version; this.phoneNumber = payload.phone_number; this.url = payload.url; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.voiceRegion = payload.voice_region; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { phoneNumber: phoneNumber || this.phoneNumber }; } get _proxy() { this._context = this._context || new PhoneNumberContextImpl(this._version, this._solution.phoneNumber); return this._context; } /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { phoneNumber: this.phoneNumber, url: this.url, sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, voiceRegion: this.voiceRegion, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberInstance = PhoneNumberInstance; function PhoneNumberListInstance(version) { const instance = ((phoneNumber) => instance.get(phoneNumber)); instance.get = function get(phoneNumber) { return new PhoneNumberContextImpl(version, phoneNumber); }; instance._version = version; instance._solution = {}; instance._uri = ``; instance.toJSON = function toJSON() { return instance._solution; }; instance[util_1.inspect.custom] = function inspectImpl(_depth, options) { return (0, util_1.inspect)(instance.toJSON(), options); }; return instance; } exports.PhoneNumberListInstance = PhoneNumberListInstance; rest/routes/v2/phoneNumber.d.ts000064400000013204151677225100012453 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; /** * Options to pass to update a PhoneNumberInstance */ export interface PhoneNumberContextUpdateOptions { /** The Inbound Processing Region used for this phone number for voice */ voiceRegion?: string; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; } export interface PhoneNumberContext { /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Update a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ update(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Update a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ update(params: PhoneNumberContextUpdateOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PhoneNumberContextSolution { phoneNumber: string; } export declare class PhoneNumberContextImpl implements PhoneNumberContext { protected _version: V2; protected _solution: PhoneNumberContextSolution; protected _uri: string; constructor(_version: V2, phoneNumber: string); fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; update(params?: PhoneNumberContextUpdateOptions | ((error: Error | null, item?: PhoneNumberInstance) => any), callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PhoneNumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PhoneNumberResource { phone_number: string; url: string; sid: string; account_sid: string; friendly_name: string; voice_region: string; date_created: Date; date_updated: Date; } export declare class PhoneNumberInstance { protected _version: V2; protected _solution: PhoneNumberContextSolution; protected _context?: PhoneNumberContext; constructor(_version: V2, payload: PhoneNumberResource, phoneNumber?: string); /** * The phone number in E.164 format */ phoneNumber: string; /** * The absolute URL of the resource. */ url: string; /** * A 34 character string that uniquely identifies the Inbound Processing Region assignments for this phone number. */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * A human readable description of the Inbound Processing Region assignments for this phone number, up to 64 characters. */ friendlyName: string; /** * The Inbound Processing Region used for this phone number for voice. */ voiceRegion: string; /** * The date that this phone number was assigned an Inbound Processing Region, given in ISO 8601 format. */ dateCreated: Date; /** * The date that the Inbound Processing Region was updated for this phone number, given in ISO 8601 format. */ dateUpdated: Date; private get _proxy(); /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Update a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ update(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Update a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ update(params: PhoneNumberContextUpdateOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { phoneNumber: string; url: string; sid: string; accountSid: string; friendlyName: string; voiceRegion: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PhoneNumberSolution { } export interface PhoneNumberListInstance { _version: V2; _solution: PhoneNumberSolution; _uri: string; (phoneNumber: string): PhoneNumberContext; get(phoneNumber: string): PhoneNumberContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PhoneNumberListInstance(version: V2): PhoneNumberListInstance; export {}; rest/routes/v2/sipDomain.d.ts000064400000011152151677225100012114 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; /** * Options to pass to update a SipDomainInstance */ export interface SipDomainContextUpdateOptions { /** */ voiceRegion?: string; /** */ friendlyName?: string; } export interface SipDomainContext { /** * Fetch a SipDomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SipDomainInstance */ fetch(callback?: (error: Error | null, item?: SipDomainInstance) => any): Promise<SipDomainInstance>; /** * Update a SipDomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SipDomainInstance */ update(callback?: (error: Error | null, item?: SipDomainInstance) => any): Promise<SipDomainInstance>; /** * Update a SipDomainInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SipDomainInstance */ update(params: SipDomainContextUpdateOptions, callback?: (error: Error | null, item?: SipDomainInstance) => any): Promise<SipDomainInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SipDomainContextSolution { sipDomain: string; } export declare class SipDomainContextImpl implements SipDomainContext { protected _version: V2; protected _solution: SipDomainContextSolution; protected _uri: string; constructor(_version: V2, sipDomain: string); fetch(callback?: (error: Error | null, item?: SipDomainInstance) => any): Promise<SipDomainInstance>; update(params?: SipDomainContextUpdateOptions | ((error: Error | null, item?: SipDomainInstance) => any), callback?: (error: Error | null, item?: SipDomainInstance) => any): Promise<SipDomainInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SipDomainContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SipDomainResource { sip_domain: string; url: string; sid: string; account_sid: string; friendly_name: string; voice_region: string; date_created: Date; date_updated: Date; } export declare class SipDomainInstance { protected _version: V2; protected _solution: SipDomainContextSolution; protected _context?: SipDomainContext; constructor(_version: V2, payload: SipDomainResource, sipDomain?: string); sipDomain: string; url: string; sid: string; accountSid: string; friendlyName: string; voiceRegion: string; dateCreated: Date; dateUpdated: Date; private get _proxy(); /** * Fetch a SipDomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SipDomainInstance */ fetch(callback?: (error: Error | null, item?: SipDomainInstance) => any): Promise<SipDomainInstance>; /** * Update a SipDomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SipDomainInstance */ update(callback?: (error: Error | null, item?: SipDomainInstance) => any): Promise<SipDomainInstance>; /** * Update a SipDomainInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SipDomainInstance */ update(params: SipDomainContextUpdateOptions, callback?: (error: Error | null, item?: SipDomainInstance) => any): Promise<SipDomainInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sipDomain: string; url: string; sid: string; accountSid: string; friendlyName: string; voiceRegion: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SipDomainSolution { } export interface SipDomainListInstance { _version: V2; _solution: SipDomainSolution; _uri: string; (sipDomain: string): SipDomainContext; get(sipDomain: string): SipDomainContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SipDomainListInstance(version: V2): SipDomainListInstance; export {}; rest/routes/v2/trunk.d.ts000064400000012524151677225100011340 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; /** * Options to pass to update a TrunkInstance */ export interface TrunkContextUpdateOptions { /** The Inbound Processing Region used for this SIP Trunk for voice */ voiceRegion?: string; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; } export interface TrunkContext { /** * Fetch a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ fetch(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Update a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ update(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Update a TrunkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ update(params: TrunkContextUpdateOptions, callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TrunkContextSolution { sipTrunkDomain: string; } export declare class TrunkContextImpl implements TrunkContext { protected _version: V2; protected _solution: TrunkContextSolution; protected _uri: string; constructor(_version: V2, sipTrunkDomain: string); fetch(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; update(params?: TrunkContextUpdateOptions | ((error: Error | null, item?: TrunkInstance) => any), callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TrunkContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TrunkResource { sip_trunk_domain: string; url: string; sid: string; account_sid: string; friendly_name: string; voice_region: string; date_created: Date; date_updated: Date; } export declare class TrunkInstance { protected _version: V2; protected _solution: TrunkContextSolution; protected _context?: TrunkContext; constructor(_version: V2, payload: TrunkResource, sipTrunkDomain?: string); /** * The absolute URL of the SIP Trunk */ sipTrunkDomain: string; /** * The absolute URL of the resource. */ url: string; /** * A 34 character string that uniquely identifies the Inbound Processing Region assignments for this SIP Trunk. */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * A human readable description of the Inbound Processing Region assignments for this SIP Trunk, up to 64 characters. */ friendlyName: string; /** * The Inbound Processing Region used for this SIP Trunk for voice. */ voiceRegion: string; /** * The date that this SIP Trunk was assigned an Inbound Processing Region, given in ISO 8601 format. */ dateCreated: Date; /** * The date that the Inbound Processing Region was updated for this SIP Trunk, given in ISO 8601 format. */ dateUpdated: Date; private get _proxy(); /** * Fetch a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ fetch(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Update a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ update(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Update a TrunkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ update(params: TrunkContextUpdateOptions, callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sipTrunkDomain: string; url: string; sid: string; accountSid: string; friendlyName: string; voiceRegion: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TrunkSolution { } export interface TrunkListInstance { _version: V2; _solution: TrunkSolution; _uri: string; (sipTrunkDomain: string): TrunkContext; get(sipTrunkDomain: string): TrunkContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TrunkListInstance(version: V2): TrunkListInstance; export {}; rest/routes/v2/sipDomain.js000064400000012435151677225100011665 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Routes * 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.SipDomainListInstance = exports.SipDomainInstance = exports.SipDomainContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class SipDomainContextImpl { constructor(_version, sipDomain) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sipDomain)) { throw new Error("Parameter 'sipDomain' is not valid."); } this._solution = { sipDomain }; this._uri = `/SipDomains/${sipDomain}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SipDomainInstance(operationVersion, payload, instance._solution.sipDomain)); 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["voiceRegion"] !== undefined) data["VoiceRegion"] = params["voiceRegion"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SipDomainInstance(operationVersion, payload, instance._solution.sipDomain)); 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.SipDomainContextImpl = SipDomainContextImpl; class SipDomainInstance { constructor(_version, payload, sipDomain) { this._version = _version; this.sipDomain = payload.sip_domain; this.url = payload.url; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.voiceRegion = payload.voice_region; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { sipDomain: sipDomain || this.sipDomain }; } get _proxy() { this._context = this._context || new SipDomainContextImpl(this._version, this._solution.sipDomain); return this._context; } /** * Fetch a SipDomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SipDomainInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sipDomain: this.sipDomain, url: this.url, sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, voiceRegion: this.voiceRegion, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SipDomainInstance = SipDomainInstance; function SipDomainListInstance(version) { const instance = ((sipDomain) => instance.get(sipDomain)); instance.get = function get(sipDomain) { return new SipDomainContextImpl(version, sipDomain); }; 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; } exports.SipDomainListInstance = SipDomainListInstance; rest/TrunkingBase.d.ts000064400000000452151677225100010716 0ustar00import Domain from "../base/Domain"; import V1 from "./trunking/V1"; declare class TrunkingBase extends Domain { _v1?: V1; /** * Initialize trunking domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = TrunkingBase; rest/ChatBase.js000064400000002510151677225100007535 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./chat/V1")); const V2_1 = __importDefault(require("./chat/V2")); const V3_1 = __importDefault(require("./chat/V3")); class ChatBase extends Domain_1.default { /** * Initialize chat domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://chat.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } get v3() { this._v3 = this._v3 || new V3_1.default(this); return this._v3; } } module.exports = ChatBase; rest/MessagingBase.d.ts000064400000000456151677225100011036 0ustar00import Domain from "../base/Domain"; import V1 from "./messaging/V1"; declare class MessagingBase extends Domain { _v1?: V1; /** * Initialize messaging domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = MessagingBase; rest/WirelessBase.js000064400000002052151677225100010454 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./wireless/V1")); class WirelessBase extends Domain_1.default { /** * Initialize wireless domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://wireless.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = WirelessBase; rest/Messaging.d.ts000064400000002621151677225100010237 0ustar00import { BrandRegistrationListInstance } from "./messaging/v1/brandRegistration"; import { DeactivationsListInstance } from "./messaging/v1/deactivations"; import { ExternalCampaignListInstance } from "./messaging/v1/externalCampaign"; import { ServiceListInstance } from "./messaging/v1/service"; import { UsecaseListInstance } from "./messaging/v1/usecase"; import { DomainCertsListInstance } from "./messaging/v1/domainCerts"; import { DomainConfigListInstance } from "./messaging/v1/domainConfig"; import MessagingBase from "./MessagingBase"; declare class Messaging extends MessagingBase { /** * @deprecated - Use v1.brandRegistrations instead */ get brandRegistrations(): BrandRegistrationListInstance; /** * @deprecated - Use v1.deactivations instead */ get deactivations(): DeactivationsListInstance; /** * @deprecated - Use v1.domainCerts instead */ get domainCerts(): DomainCertsListInstance; /** * @deprecated - Use v1.domainConfig instead */ get domainConfig(): DomainConfigListInstance; /** * @deprecated - Use v1.externalCampaign instead */ get externalCampaign(): ExternalCampaignListInstance; /** * @deprecated - Use v1.services instead */ get services(): ServiceListInstance; /** * @deprecated - Use v1.usecases instead */ get usecases(): UsecaseListInstance; } export = Messaging; rest/Voice.d.ts000064400000002323151677225100007366 0ustar00import { ArchivedCallListInstance } from "./voice/v1/archivedCall"; import { ByocTrunkListInstance } from "./voice/v1/byocTrunk"; import { ConnectionPolicyListInstance } from "./voice/v1/connectionPolicy"; import { DialingPermissionsListInstance } from "./voice/v1/dialingPermissions"; import { IpRecordListInstance } from "./voice/v1/ipRecord"; import { SourceIpMappingListInstance } from "./voice/v1/sourceIpMapping"; import VoiceBase from "./VoiceBase"; declare class Voice extends VoiceBase { /** * @deprecated - Use v1.archivedCalls instead */ get archivedCalls(): ArchivedCallListInstance; /** * @deprecated - Use v1.byocTrunks instead */ get byocTrunks(): ByocTrunkListInstance; /** * @deprecated - Use v1.connectionPolicies instead */ get connectionPolicies(): ConnectionPolicyListInstance; /** * @deprecated - Use v1.dialingPermissions instead */ get dialingPermissions(): DialingPermissionsListInstance; /** * @deprecated - Use v1.ipRecords instead */ get ipRecords(): IpRecordListInstance; /** * @deprecated - Use v1.sourceIpMappings instead */ get sourceIpMappings(): SourceIpMappingListInstance; } export = Voice; rest/ContentBase.d.ts000064400000000545151677225100010532 0ustar00import Domain from "../base/Domain"; import V1 from "./content/V1"; import V2 from "./content/V2"; declare class ContentBase extends Domain { _v1?: V1; _v2?: V2; /** * Initialize content domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; get v2(): V2; } export = ContentBase; rest/Serverless.js000064400000000766151677225100010233 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const ServerlessBase_1 = __importDefault(require("./ServerlessBase")); class Serverless extends ServerlessBase_1.default { /** * @deprecated - Use v1.services instead */ get services() { console.warn("services is deprecated. Use v1.services instead."); return this.v1.services; } } module.exports = Serverless; rest/OauthBase.js000064400000002033151677225100007736 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./oauth/V1")); class OauthBase extends Domain_1.default { /** * Initialize oauth domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://oauth.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = OauthBase; rest/OauthBase.d.ts000064400000000436151677225100010177 0ustar00import Domain from "../base/Domain"; import V1 from "./oauth/V1"; declare class OauthBase extends Domain { _v1?: V1; /** * Initialize oauth domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = OauthBase; rest/ProxyBase.d.ts000064400000000436151677225100010240 0ustar00import Domain from "../base/Domain"; import V1 from "./proxy/V1"; declare class ProxyBase extends Domain { _v1?: V1; /** * Initialize proxy domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = ProxyBase; rest/NotifyBase.d.ts000064400000000442151677225100010364 0ustar00import Domain from "../base/Domain"; import V1 from "./notify/V1"; declare class NotifyBase extends Domain { _v1?: V1; /** * Initialize notify domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = NotifyBase; rest/PricingBase.d.ts000064400000000545151677225100010513 0ustar00import Domain from "../base/Domain"; import V1 from "./pricing/V1"; import V2 from "./pricing/V2"; declare class PricingBase extends Domain { _v1?: V1; _v2?: V2; /** * Initialize pricing domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; get v2(): V2; } export = PricingBase; rest/TrusthubBase.d.ts000064400000000452151677225100010735 0ustar00import Domain from "../base/Domain"; import V1 from "./trusthub/V1"; declare class TrusthubBase extends Domain { _v1?: V1; /** * Initialize trusthub domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = TrusthubBase; rest/TrusthubBase.js000064400000002052151677225100010477 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./trusthub/V1")); class TrusthubBase extends Domain_1.default { /** * Initialize trusthub domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://trusthub.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = TrusthubBase; rest/ipMessaging/V2.d.ts000064400000001524151677225100011060 0ustar00import IpMessagingBase from "../IpMessagingBase"; import Version from "../../base/Version"; import { CredentialListInstance } from "./v2/credential"; import { ServiceListInstance } from "./v2/service"; export default class V2 extends Version { /** * Initialize the V2 version of IpMessaging * * @param domain - The Twilio (Twilio.IpMessaging) domain */ constructor(domain: IpMessagingBase); /** credentials - { Twilio.IpMessaging.V2.CredentialListInstance } resource */ protected _credentials?: CredentialListInstance; /** services - { Twilio.IpMessaging.V2.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** Getter for credentials resource */ get credentials(): CredentialListInstance; /** Getter for services resource */ get services(): ServiceListInstance; } rest/ipMessaging/V1.d.ts000064400000001524151677225100011057 0ustar00import IpMessagingBase from "../IpMessagingBase"; import Version from "../../base/Version"; import { CredentialListInstance } from "./v1/credential"; import { ServiceListInstance } from "./v1/service"; export default class V1 extends Version { /** * Initialize the V1 version of IpMessaging * * @param domain - The Twilio (Twilio.IpMessaging) domain */ constructor(domain: IpMessagingBase); /** credentials - { Twilio.IpMessaging.V1.CredentialListInstance } resource */ protected _credentials?: CredentialListInstance; /** services - { Twilio.IpMessaging.V1.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** Getter for credentials resource */ get credentials(): CredentialListInstance; /** Getter for services resource */ get services(): ServiceListInstance; } rest/ipMessaging/V2.js000064400000002753151677225100010631 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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 credential_1 = require("./v2/credential"); const service_1 = require("./v2/service"); class V2 extends Version_1.default { /** * Initialize the V2 version of IpMessaging * * @param domain - The Twilio (Twilio.IpMessaging) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for credentials resource */ get credentials() { this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this); return this._credentials; } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } } exports.default = V2; rest/ipMessaging/v2/service.d.ts000064400000034203151677225100012560 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; import { BindingListInstance } from "./service/binding"; import { ChannelListInstance } from "./service/channel"; import { RoleListInstance } from "./service/role"; import { UserListInstance } from "./service/user"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** */ friendlyName?: string; /** */ defaultServiceRoleSid?: string; /** */ defaultChannelRoleSid?: string; /** */ defaultChannelCreatorRoleSid?: string; /** */ readStatusEnabled?: boolean; /** */ reachabilityEnabled?: boolean; /** */ typingIndicatorTimeout?: number; /** */ consumptionReportInterval?: number; /** */ "notifications.newMessage.enabled"?: boolean; /** */ "notifications.newMessage.template"?: string; /** */ "notifications.newMessage.sound"?: string; /** */ "notifications.newMessage.badgeCountEnabled"?: boolean; /** */ "notifications.addedToChannel.enabled"?: boolean; /** */ "notifications.addedToChannel.template"?: string; /** */ "notifications.addedToChannel.sound"?: string; /** */ "notifications.removedFromChannel.enabled"?: boolean; /** */ "notifications.removedFromChannel.template"?: string; /** */ "notifications.removedFromChannel.sound"?: string; /** */ "notifications.invitedToChannel.enabled"?: boolean; /** */ "notifications.invitedToChannel.template"?: string; /** */ "notifications.invitedToChannel.sound"?: string; /** */ preWebhookUrl?: string; /** */ postWebhookUrl?: string; /** */ webhookMethod?: string; /** */ webhookFilters?: Array<string>; /** */ "limits.channelMembers"?: number; /** */ "limits.userChannels"?: number; /** */ "media.compatibilityMessage"?: string; /** */ preWebhookRetryCount?: number; /** */ postWebhookRetryCount?: number; /** */ "notifications.logEnabled"?: boolean; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** */ friendlyName: string; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { bindings: BindingListInstance; channels: ChannelListInstance; roles: RoleListInstance; users: UserListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V2; protected _solution: ServiceContextSolution; protected _uri: string; protected _bindings?: BindingListInstance; protected _channels?: ChannelListInstance; protected _roles?: RoleListInstance; protected _users?: UserListInstance; constructor(_version: V2, sid: string); get bindings(): BindingListInstance; get channels(): ChannelListInstance; get roles(): RoleListInstance; get users(): UserListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; date_created: Date; date_updated: Date; default_service_role_sid: string; default_channel_role_sid: string; default_channel_creator_role_sid: string; read_status_enabled: boolean; reachability_enabled: boolean; typing_indicator_timeout: number; consumption_report_interval: number; limits: any; pre_webhook_url: string; post_webhook_url: string; webhook_method: string; webhook_filters: Array<string>; pre_webhook_retry_count: number; post_webhook_retry_count: number; notifications: any; media: any; url: string; links: Record<string, string>; } export declare class ServiceInstance { protected _version: V2; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V2, payload: ServiceResource, sid?: string); sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; defaultServiceRoleSid: string; defaultChannelRoleSid: string; defaultChannelCreatorRoleSid: string; readStatusEnabled: boolean; reachabilityEnabled: boolean; typingIndicatorTimeout: number; consumptionReportInterval: number; limits: any; preWebhookUrl: string; postWebhookUrl: string; webhookMethod: string; webhookFilters: Array<string>; preWebhookRetryCount: number; postWebhookRetryCount: number; notifications: any; media: any; url: string; links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the bindings. */ bindings(): BindingListInstance; /** * Access the channels. */ channels(): ChannelListInstance; /** * Access the roles. */ roles(): RoleListInstance; /** * Access the users. */ users(): UserListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; defaultServiceRoleSid: string; defaultChannelRoleSid: string; defaultChannelCreatorRoleSid: string; readStatusEnabled: boolean; reachabilityEnabled: boolean; typingIndicatorTimeout: number; consumptionReportInterval: number; limits: any; preWebhookUrl: string; postWebhookUrl: string; webhookMethod: string; webhookFilters: string[]; preWebhookRetryCount: number; postWebhookRetryCount: number; notifications: any; media: any; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V2; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V2): ServiceListInstance; export declare class ServicePage extends Page<V2, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service.js000064400000041647151677225100012336 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const binding_1 = require("./service/binding"); const channel_1 = require("./service/channel"); const role_1 = require("./service/role"); const user_1 = require("./service/user"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get bindings() { this._bindings = this._bindings || (0, binding_1.BindingListInstance)(this._version, this._solution.sid); return this._bindings; } get channels() { this._channels = this._channels || (0, channel_1.ChannelListInstance)(this._version, this._solution.sid); return this._channels; } get roles() { this._roles = this._roles || (0, role_1.RoleListInstance)(this._version, this._solution.sid); return this._roles; } get users() { this._users = this._users || (0, user_1.UserListInstance)(this._version, this._solution.sid); return this._users; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["defaultServiceRoleSid"] !== undefined) data["DefaultServiceRoleSid"] = params["defaultServiceRoleSid"]; if (params["defaultChannelRoleSid"] !== undefined) data["DefaultChannelRoleSid"] = params["defaultChannelRoleSid"]; if (params["defaultChannelCreatorRoleSid"] !== undefined) data["DefaultChannelCreatorRoleSid"] = params["defaultChannelCreatorRoleSid"]; if (params["readStatusEnabled"] !== undefined) data["ReadStatusEnabled"] = serialize.bool(params["readStatusEnabled"]); if (params["reachabilityEnabled"] !== undefined) data["ReachabilityEnabled"] = serialize.bool(params["reachabilityEnabled"]); if (params["typingIndicatorTimeout"] !== undefined) data["TypingIndicatorTimeout"] = params["typingIndicatorTimeout"]; if (params["consumptionReportInterval"] !== undefined) data["ConsumptionReportInterval"] = params["consumptionReportInterval"]; if (params["notifications.newMessage.enabled"] !== undefined) data["Notifications.NewMessage.Enabled"] = serialize.bool(params["notifications.newMessage.enabled"]); if (params["notifications.newMessage.template"] !== undefined) data["Notifications.NewMessage.Template"] = params["notifications.newMessage.template"]; if (params["notifications.newMessage.sound"] !== undefined) data["Notifications.NewMessage.Sound"] = params["notifications.newMessage.sound"]; if (params["notifications.newMessage.badgeCountEnabled"] !== undefined) data["Notifications.NewMessage.BadgeCountEnabled"] = serialize.bool(params["notifications.newMessage.badgeCountEnabled"]); if (params["notifications.addedToChannel.enabled"] !== undefined) data["Notifications.AddedToChannel.Enabled"] = serialize.bool(params["notifications.addedToChannel.enabled"]); if (params["notifications.addedToChannel.template"] !== undefined) data["Notifications.AddedToChannel.Template"] = params["notifications.addedToChannel.template"]; if (params["notifications.addedToChannel.sound"] !== undefined) data["Notifications.AddedToChannel.Sound"] = params["notifications.addedToChannel.sound"]; if (params["notifications.removedFromChannel.enabled"] !== undefined) data["Notifications.RemovedFromChannel.Enabled"] = serialize.bool(params["notifications.removedFromChannel.enabled"]); if (params["notifications.removedFromChannel.template"] !== undefined) data["Notifications.RemovedFromChannel.Template"] = params["notifications.removedFromChannel.template"]; if (params["notifications.removedFromChannel.sound"] !== undefined) data["Notifications.RemovedFromChannel.Sound"] = params["notifications.removedFromChannel.sound"]; if (params["notifications.invitedToChannel.enabled"] !== undefined) data["Notifications.InvitedToChannel.Enabled"] = serialize.bool(params["notifications.invitedToChannel.enabled"]); if (params["notifications.invitedToChannel.template"] !== undefined) data["Notifications.InvitedToChannel.Template"] = params["notifications.invitedToChannel.template"]; if (params["notifications.invitedToChannel.sound"] !== undefined) data["Notifications.InvitedToChannel.Sound"] = params["notifications.invitedToChannel.sound"]; if (params["preWebhookUrl"] !== undefined) data["PreWebhookUrl"] = params["preWebhookUrl"]; if (params["postWebhookUrl"] !== undefined) data["PostWebhookUrl"] = params["postWebhookUrl"]; if (params["webhookMethod"] !== undefined) data["WebhookMethod"] = params["webhookMethod"]; if (params["webhookFilters"] !== undefined) data["WebhookFilters"] = serialize.map(params["webhookFilters"], (e) => e); if (params["limits.channelMembers"] !== undefined) data["Limits.ChannelMembers"] = params["limits.channelMembers"]; if (params["limits.userChannels"] !== undefined) data["Limits.UserChannels"] = params["limits.userChannels"]; if (params["media.compatibilityMessage"] !== undefined) data["Media.CompatibilityMessage"] = params["media.compatibilityMessage"]; if (params["preWebhookRetryCount"] !== undefined) data["PreWebhookRetryCount"] = params["preWebhookRetryCount"]; if (params["postWebhookRetryCount"] !== undefined) data["PostWebhookRetryCount"] = params["postWebhookRetryCount"]; if (params["notifications.logEnabled"] !== undefined) data["Notifications.LogEnabled"] = serialize.bool(params["notifications.logEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { 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.defaultServiceRoleSid = payload.default_service_role_sid; this.defaultChannelRoleSid = payload.default_channel_role_sid; this.defaultChannelCreatorRoleSid = payload.default_channel_creator_role_sid; this.readStatusEnabled = payload.read_status_enabled; this.reachabilityEnabled = payload.reachability_enabled; this.typingIndicatorTimeout = deserialize.integer(payload.typing_indicator_timeout); this.consumptionReportInterval = deserialize.integer(payload.consumption_report_interval); this.limits = payload.limits; this.preWebhookUrl = payload.pre_webhook_url; this.postWebhookUrl = payload.post_webhook_url; this.webhookMethod = payload.webhook_method; this.webhookFilters = payload.webhook_filters; this.preWebhookRetryCount = deserialize.integer(payload.pre_webhook_retry_count); this.postWebhookRetryCount = deserialize.integer(payload.post_webhook_retry_count); this.notifications = payload.notifications; this.media = payload.media; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the bindings. */ bindings() { return this._proxy.bindings; } /** * Access the channels. */ channels() { return this._proxy.channels; } /** * Access the roles. */ roles() { return this._proxy.roles; } /** * Access the users. */ users() { return this._proxy.users; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, defaultServiceRoleSid: this.defaultServiceRoleSid, defaultChannelRoleSid: this.defaultChannelRoleSid, defaultChannelCreatorRoleSid: this.defaultChannelCreatorRoleSid, readStatusEnabled: this.readStatusEnabled, reachabilityEnabled: this.reachabilityEnabled, typingIndicatorTimeout: this.typingIndicatorTimeout, consumptionReportInterval: this.consumptionReportInterval, limits: this.limits, preWebhookUrl: this.preWebhookUrl, postWebhookUrl: this.postWebhookUrl, webhookMethod: this.webhookMethod, webhookFilters: this.webhookFilters, preWebhookRetryCount: this.preWebhookRetryCount, postWebhookRetryCount: this.postWebhookRetryCount, notifications: this.notifications, media: this.media, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/ipMessaging/v2/credential.d.ts000064400000025457151677225100013245 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; export type CredentialPushService = "gcm" | "apn" | "fcm"; /** * Options to pass to update a CredentialInstance */ export interface CredentialContextUpdateOptions { /** */ friendlyName?: string; /** */ certificate?: string; /** */ privateKey?: string; /** */ sandbox?: boolean; /** */ apiKey?: string; /** */ secret?: string; } /** * Options to pass to create a CredentialInstance */ export interface CredentialListInstanceCreateOptions { /** */ type: CredentialPushService; /** */ friendlyName?: string; /** */ certificate?: string; /** */ privateKey?: string; /** */ sandbox?: boolean; /** */ apiKey?: string; /** */ secret?: string; } /** * Options to pass to each */ export interface CredentialListInstanceEachOptions { /** 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: CredentialInstance, 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 CredentialListInstanceOptions { /** 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 CredentialListInstancePageOptions { /** 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 CredentialContext { /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialContextSolution { sid: string; } export declare class CredentialContextImpl implements CredentialContext { protected _version: V2; protected _solution: CredentialContextSolution; protected _uri: string; constructor(_version: V2, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; update(params?: CredentialContextUpdateOptions | ((error: Error | null, item?: CredentialInstance) => any), callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialPayload extends TwilioResponsePayload { credentials: CredentialResource[]; } interface CredentialResource { sid: string; account_sid: string; friendly_name: string; type: CredentialPushService; sandbox: string; date_created: Date; date_updated: Date; url: string; } export declare class CredentialInstance { protected _version: V2; protected _solution: CredentialContextSolution; protected _context?: CredentialContext; constructor(_version: V2, payload: CredentialResource, sid?: string); sid: string; accountSid: string; friendlyName: string; type: CredentialPushService; sandbox: string; dateCreated: Date; dateUpdated: Date; url: string; private get _proxy(); /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; type: CredentialPushService; sandbox: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialSolution { } export interface CredentialListInstance { _version: V2; _solution: CredentialSolution; _uri: string; (sid: string): CredentialContext; get(sid: string): CredentialContext; /** * Create a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ create(params: CredentialListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Streams CredentialInstance 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 { CredentialListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListInstanceEachOptions, callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialInstance 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: CredentialPage) => any): Promise<CredentialPage>; /** * Lists CredentialInstance 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 { CredentialListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; list(params: CredentialListInstanceOptions, callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; /** * Retrieve a single page of CredentialInstance 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 { CredentialListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; page(params: CredentialListInstancePageOptions, callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListInstance(version: V2): CredentialListInstance; export declare class CredentialPage extends Page<V2, CredentialPayload, CredentialResource, CredentialInstance> { /** * Initialize the CredentialPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: CredentialSolution); /** * Build an instance of CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialResource): CredentialInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/credential.js000064400000024202151677225100012774 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.CredentialPage = exports.CredentialListInstance = exports.CredentialInstance = exports.CredentialContextImpl = void 0; 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 CredentialContextImpl { 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/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, 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.CredentialContextImpl = CredentialContextImpl; class CredentialInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.sandbox = payload.sandbox; 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 CredentialContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, type: this.type, sandbox: this.sandbox, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialInstance = CredentialInstance; function CredentialListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Credentials`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["Type"] = params["type"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialPage(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 CredentialPage(instance._version, payload, 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; } exports.CredentialListInstance = CredentialListInstance; class CredentialPage extends Page_1.default { /** * Initialize the CredentialPage * * @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 CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialPage = CredentialPage; rest/ipMessaging/v2/service/user/userBinding.d.ts000064400000022025151677225100016006 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type UserBindingBindingType = "gcm" | "apn" | "fcm"; /** * Options to pass to each */ export interface UserBindingListInstanceEachOptions { /** */ bindingType?: Array<UserBindingBindingType>; /** 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: UserBindingInstance, 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 UserBindingListInstanceOptions { /** */ bindingType?: Array<UserBindingBindingType>; /** 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 UserBindingListInstancePageOptions { /** */ bindingType?: Array<UserBindingBindingType>; /** 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 UserBindingContext { /** * Remove a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserBindingInstance */ fetch(callback?: (error: Error | null, item?: UserBindingInstance) => any): Promise<UserBindingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserBindingContextSolution { serviceSid: string; userSid: string; sid: string; } export declare class UserBindingContextImpl implements UserBindingContext { protected _version: V2; protected _solution: UserBindingContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, userSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserBindingInstance) => any): Promise<UserBindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserBindingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserBindingPayload extends TwilioResponsePayload { bindings: UserBindingResource[]; } interface UserBindingResource { sid: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; endpoint: string; identity: string; user_sid: string; credential_sid: string; binding_type: UserBindingBindingType; message_types: Array<string>; url: string; } export declare class UserBindingInstance { protected _version: V2; protected _solution: UserBindingContextSolution; protected _context?: UserBindingContext; constructor(_version: V2, payload: UserBindingResource, serviceSid: string, userSid: string, sid?: string); sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; endpoint: string; identity: string; userSid: string; credentialSid: string; bindingType: UserBindingBindingType; messageTypes: Array<string>; url: string; private get _proxy(); /** * Remove a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserBindingInstance */ fetch(callback?: (error: Error | null, item?: UserBindingInstance) => any): Promise<UserBindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; endpoint: string; identity: string; userSid: string; credentialSid: string; bindingType: UserBindingBindingType; messageTypes: string[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserBindingSolution { serviceSid: string; userSid: string; } export interface UserBindingListInstance { _version: V2; _solution: UserBindingSolution; _uri: string; (sid: string): UserBindingContext; get(sid: string): UserBindingContext; /** * Streams UserBindingInstance 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 { UserBindingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserBindingInstance, done: (err?: Error) => void) => void): void; each(params: UserBindingListInstanceEachOptions, callback?: (item: UserBindingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserBindingInstance 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: UserBindingPage) => any): Promise<UserBindingPage>; /** * Lists UserBindingInstance 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 { UserBindingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserBindingInstance[]) => any): Promise<UserBindingInstance[]>; list(params: UserBindingListInstanceOptions, callback?: (error: Error | null, items: UserBindingInstance[]) => any): Promise<UserBindingInstance[]>; /** * Retrieve a single page of UserBindingInstance 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 { UserBindingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserBindingPage) => any): Promise<UserBindingPage>; page(params: UserBindingListInstancePageOptions, callback?: (error: Error | null, items: UserBindingPage) => any): Promise<UserBindingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserBindingListInstance(version: V2, serviceSid: string, userSid: string): UserBindingListInstance; export declare class UserBindingPage extends Page<V2, UserBindingPayload, UserBindingResource, UserBindingInstance> { /** * Initialize the UserBindingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: UserBindingSolution); /** * Build an instance of UserBindingInstance * * @param payload - Payload response from the API */ getInstance(payload: UserBindingResource): UserBindingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/user/userBinding.js000064400000021040151677225100015546 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.UserBindingPage = exports.UserBindingListInstance = exports.UserBindingInstance = exports.UserBindingContextImpl = void 0; 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 UserBindingContextImpl { constructor(_version, serviceSid, userSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, userSid, sid }; this._uri = `/Services/${serviceSid}/Users/${userSid}/Bindings/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserBindingInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.userSid, 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.UserBindingContextImpl = UserBindingContextImpl; class UserBindingInstance { constructor(_version, payload, serviceSid, userSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.endpoint = payload.endpoint; this.identity = payload.identity; this.userSid = payload.user_sid; this.credentialSid = payload.credential_sid; this.bindingType = payload.binding_type; this.messageTypes = payload.message_types; this.url = payload.url; this._solution = { serviceSid, userSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserBindingContextImpl(this._version, this._solution.serviceSid, this._solution.userSid, this._solution.sid); return this._context; } /** * Remove a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UserBindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserBindingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, endpoint: this.endpoint, identity: this.identity, userSid: this.userSid, credentialSid: this.credentialSid, bindingType: this.bindingType, messageTypes: this.messageTypes, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserBindingInstance = UserBindingInstance; function UserBindingListInstance(version, serviceSid, userSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserBindingContextImpl(version, serviceSid, userSid, sid); }; instance._version = version; instance._solution = { serviceSid, userSid }; instance._uri = `/Services/${serviceSid}/Users/${userSid}/Bindings`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["bindingType"] !== undefined) data["BindingType"] = serialize.map(params["bindingType"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserBindingPage(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 UserBindingPage(instance._version, payload, 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; } exports.UserBindingListInstance = UserBindingListInstance; class UserBindingPage extends Page_1.default { /** * Initialize the UserBindingPage * * @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 UserBindingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserBindingInstance(this._version, payload, this._solution.serviceSid, this._solution.userSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserBindingPage = UserBindingPage; rest/ipMessaging/v2/service/user/userChannel.js000064400000023675151677225100015564 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.UserChannelPage = exports.UserChannelListInstance = exports.UserChannelInstance = exports.UserChannelContextImpl = void 0; 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 UserChannelContextImpl { constructor(_version, serviceSid, userSid, channelSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } this._solution = { serviceSid, userSid, channelSid }; this._uri = `/Services/${serviceSid}/Users/${userSid}/Channels/${channelSid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserChannelInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.userSid, instance._solution.channelSid)); 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["notificationLevel"] !== undefined) data["NotificationLevel"] = params["notificationLevel"]; if (params["lastConsumedMessageIndex"] !== undefined) data["LastConsumedMessageIndex"] = params["lastConsumedMessageIndex"]; if (params["lastConsumptionTimestamp"] !== undefined) data["LastConsumptionTimestamp"] = serialize.iso8601DateTime(params["lastConsumptionTimestamp"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserChannelInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.userSid, instance._solution.channelSid)); 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.UserChannelContextImpl = UserChannelContextImpl; class UserChannelInstance { constructor(_version, payload, serviceSid, userSid, channelSid) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.channelSid = payload.channel_sid; this.userSid = payload.user_sid; this.memberSid = payload.member_sid; this.status = payload.status; this.lastConsumedMessageIndex = deserialize.integer(payload.last_consumed_message_index); this.unreadMessagesCount = deserialize.integer(payload.unread_messages_count); this.links = payload.links; this.url = payload.url; this.notificationLevel = payload.notification_level; this._solution = { serviceSid, userSid, channelSid: channelSid || this.channelSid, }; } get _proxy() { this._context = this._context || new UserChannelContextImpl(this._version, this._solution.serviceSid, this._solution.userSid, this._solution.channelSid); return this._context; } /** * Remove a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, channelSid: this.channelSid, userSid: this.userSid, memberSid: this.memberSid, status: this.status, lastConsumedMessageIndex: this.lastConsumedMessageIndex, unreadMessagesCount: this.unreadMessagesCount, links: this.links, url: this.url, notificationLevel: this.notificationLevel, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserChannelInstance = UserChannelInstance; function UserChannelListInstance(version, serviceSid, userSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } const instance = ((channelSid) => instance.get(channelSid)); instance.get = function get(channelSid) { return new UserChannelContextImpl(version, serviceSid, userSid, channelSid); }; instance._version = version; instance._solution = { serviceSid, userSid }; instance._uri = `/Services/${serviceSid}/Users/${userSid}/Channels`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserChannelPage(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 UserChannelPage(instance._version, payload, 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; } exports.UserChannelListInstance = UserChannelListInstance; class UserChannelPage extends Page_1.default { /** * Initialize the UserChannelPage * * @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 UserChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserChannelInstance(this._version, payload, this._solution.serviceSid, this._solution.userSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserChannelPage = UserChannelPage; rest/ipMessaging/v2/service/user/userChannel.d.ts000064400000025600151677225100016006 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type UserChannelChannelStatus = "joined" | "invited" | "not_participating"; export type UserChannelNotificationLevel = "default" | "muted"; /** * Options to pass to update a UserChannelInstance */ export interface UserChannelContextUpdateOptions { /** */ notificationLevel?: UserChannelNotificationLevel; /** */ lastConsumedMessageIndex?: number; /** */ lastConsumptionTimestamp?: Date; } /** * Options to pass to each */ export interface UserChannelListInstanceEachOptions { /** 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: UserChannelInstance, 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 UserChannelListInstanceOptions { /** 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 UserChannelListInstancePageOptions { /** 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 UserChannelContext { /** * Remove a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ fetch(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Update a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ update(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Update a UserChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ update(params: UserChannelContextUpdateOptions, callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserChannelContextSolution { serviceSid: string; userSid: string; channelSid: string; } export declare class UserChannelContextImpl implements UserChannelContext { protected _version: V2; protected _solution: UserChannelContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, userSid: string, channelSid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; update(params?: UserChannelContextUpdateOptions | ((error: Error | null, item?: UserChannelInstance) => any), callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserChannelPayload extends TwilioResponsePayload { channels: UserChannelResource[]; } interface UserChannelResource { account_sid: string; service_sid: string; channel_sid: string; user_sid: string; member_sid: string; status: UserChannelChannelStatus; last_consumed_message_index: number; unread_messages_count: number; links: Record<string, string>; url: string; notification_level: UserChannelNotificationLevel; } export declare class UserChannelInstance { protected _version: V2; protected _solution: UserChannelContextSolution; protected _context?: UserChannelContext; constructor(_version: V2, payload: UserChannelResource, serviceSid: string, userSid: string, channelSid?: string); accountSid: string; serviceSid: string; channelSid: string; userSid: string; memberSid: string; status: UserChannelChannelStatus; lastConsumedMessageIndex: number; unreadMessagesCount: number; links: Record<string, string>; url: string; notificationLevel: UserChannelNotificationLevel; private get _proxy(); /** * Remove a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ fetch(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Update a UserChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ update(callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Update a UserChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserChannelInstance */ update(params: UserChannelContextUpdateOptions, callback?: (error: Error | null, item?: UserChannelInstance) => any): Promise<UserChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; channelSid: string; userSid: string; memberSid: string; status: UserChannelChannelStatus; lastConsumedMessageIndex: number; unreadMessagesCount: number; links: Record<string, string>; url: string; notificationLevel: UserChannelNotificationLevel; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserChannelSolution { serviceSid: string; userSid: string; } export interface UserChannelListInstance { _version: V2; _solution: UserChannelSolution; _uri: string; (channelSid: string): UserChannelContext; get(channelSid: string): UserChannelContext; /** * Streams UserChannelInstance 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 { UserChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserChannelInstance, done: (err?: Error) => void) => void): void; each(params: UserChannelListInstanceEachOptions, callback?: (item: UserChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserChannelInstance 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: UserChannelPage) => any): Promise<UserChannelPage>; /** * Lists UserChannelInstance 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 { UserChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserChannelInstance[]) => any): Promise<UserChannelInstance[]>; list(params: UserChannelListInstanceOptions, callback?: (error: Error | null, items: UserChannelInstance[]) => any): Promise<UserChannelInstance[]>; /** * Retrieve a single page of UserChannelInstance 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 { UserChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserChannelPage) => any): Promise<UserChannelPage>; page(params: UserChannelListInstancePageOptions, callback?: (error: Error | null, items: UserChannelPage) => any): Promise<UserChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserChannelListInstance(version: V2, serviceSid: string, userSid: string): UserChannelListInstance; export declare class UserChannelPage extends Page<V2, UserChannelPayload, UserChannelResource, UserChannelInstance> { /** * Initialize the UserChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: UserChannelSolution); /** * Build an instance of UserChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: UserChannelResource): UserChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/binding.d.ts000064400000021456151677225100014200 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type BindingBindingType = "gcm" | "apn" | "fcm"; /** * Options to pass to each */ export interface BindingListInstanceEachOptions { /** */ bindingType?: Array<BindingBindingType>; /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: BindingInstance, 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 BindingListInstanceOptions { /** */ bindingType?: Array<BindingBindingType>; /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface BindingListInstancePageOptions { /** */ bindingType?: Array<BindingBindingType>; /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface BindingContext { /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BindingContextSolution { serviceSid: string; sid: string; } export declare class BindingContextImpl implements BindingContext { protected _version: V2; protected _solution: BindingContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BindingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BindingPayload extends TwilioResponsePayload { bindings: BindingResource[]; } interface BindingResource { sid: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; endpoint: string; identity: string; credential_sid: string; binding_type: BindingBindingType; message_types: Array<string>; url: string; links: Record<string, string>; } export declare class BindingInstance { protected _version: V2; protected _solution: BindingContextSolution; protected _context?: BindingContext; constructor(_version: V2, payload: BindingResource, serviceSid: string, sid?: string); sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; endpoint: string; identity: string; credentialSid: string; bindingType: BindingBindingType; messageTypes: Array<string>; url: string; links: Record<string, string>; private get _proxy(); /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; endpoint: string; identity: string; credentialSid: string; bindingType: BindingBindingType; messageTypes: string[]; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BindingSolution { serviceSid: string; } export interface BindingListInstance { _version: V2; _solution: BindingSolution; _uri: string; (sid: string): BindingContext; get(sid: string): BindingContext; /** * Streams BindingInstance 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 { BindingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void; each(params: BindingListInstanceEachOptions, callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BindingInstance 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: BindingPage) => any): Promise<BindingPage>; /** * Lists BindingInstance 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 { BindingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>; list(params: BindingListInstanceOptions, callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>; /** * Retrieve a single page of BindingInstance 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 { BindingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>; page(params: BindingListInstancePageOptions, callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BindingListInstance(version: V2, serviceSid: string): BindingListInstance; export declare class BindingPage extends Page<V2, BindingPayload, BindingResource, BindingInstance> { /** * Initialize the BindingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: BindingSolution); /** * Build an instance of BindingInstance * * @param payload - Payload response from the API */ getInstance(payload: BindingResource): BindingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/channel.d.ts000064400000033455151677225100014200 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; import { InviteListInstance } from "./channel/invite"; import { MemberListInstance } from "./channel/member"; import { MessageListInstance } from "./channel/message"; import { WebhookListInstance } from "./channel/webhook"; export type ChannelChannelType = "public" | "private"; export type ChannelWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a ChannelInstance */ export interface ChannelContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ChannelWebhookEnabledType; } /** * Options to pass to update a ChannelInstance */ export interface ChannelContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ChannelWebhookEnabledType; /** */ friendlyName?: string; /** */ uniqueName?: string; /** */ attributes?: string; /** */ dateCreated?: Date; /** */ dateUpdated?: Date; /** */ createdBy?: string; } /** * Options to pass to create a ChannelInstance */ export interface ChannelListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ChannelWebhookEnabledType; /** */ friendlyName?: string; /** */ uniqueName?: string; /** */ attributes?: string; /** */ type?: ChannelChannelType; /** */ dateCreated?: Date; /** */ dateUpdated?: Date; /** */ createdBy?: string; } /** * Options to pass to each */ export interface ChannelListInstanceEachOptions { /** */ type?: Array<ChannelChannelType>; /** 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: ChannelInstance, 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 ChannelListInstanceOptions { /** */ type?: Array<ChannelChannelType>; /** 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 ChannelListInstancePageOptions { /** */ type?: Array<ChannelChannelType>; /** 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 ChannelContext { invites: InviteListInstance; members: MemberListInstance; messages: MessageListInstance; webhooks: WebhookListInstance; /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ remove(params: ChannelContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ChannelContextSolution { serviceSid: string; sid: string; } export declare class ChannelContextImpl implements ChannelContext { protected _version: V2; protected _solution: ChannelContextSolution; protected _uri: string; protected _invites?: InviteListInstance; protected _members?: MemberListInstance; protected _messages?: MessageListInstance; protected _webhooks?: WebhookListInstance; constructor(_version: V2, serviceSid: string, sid: string); get invites(): InviteListInstance; get members(): MemberListInstance; get messages(): MessageListInstance; get webhooks(): WebhookListInstance; remove(params?: ChannelContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; update(params?: ChannelContextUpdateOptions | ((error: Error | null, item?: ChannelInstance) => any), callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ChannelPayload extends TwilioResponsePayload { channels: ChannelResource[]; } interface ChannelResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; unique_name: string; attributes: string; type: ChannelChannelType; date_created: Date; date_updated: Date; created_by: string; members_count: number; messages_count: number; url: string; links: Record<string, string>; } export declare class ChannelInstance { protected _version: V2; protected _solution: ChannelContextSolution; protected _context?: ChannelContext; constructor(_version: V2, payload: ChannelResource, serviceSid: string, sid?: string); sid: string; accountSid: string; serviceSid: string; friendlyName: string; uniqueName: string; attributes: string; type: ChannelChannelType; dateCreated: Date; dateUpdated: Date; createdBy: string; membersCount: number; messagesCount: number; url: string; links: Record<string, string>; private get _proxy(); /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ remove(params: ChannelContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Access the invites. */ invites(): InviteListInstance; /** * Access the members. */ members(): MemberListInstance; /** * Access the messages. */ messages(): MessageListInstance; /** * Access the webhooks. */ webhooks(): WebhookListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; uniqueName: string; attributes: string; type: ChannelChannelType; dateCreated: Date; dateUpdated: Date; createdBy: string; membersCount: number; messagesCount: number; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ChannelSolution { serviceSid: string; } export interface ChannelListInstance { _version: V2; _solution: ChannelSolution; _uri: string; (sid: string): ChannelContext; get(sid: string): ChannelContext; /** * Create a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ create(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Create a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ create(params: ChannelListInstanceCreateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Streams ChannelInstance 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 { ChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; each(params: ChannelListInstanceEachOptions, callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ChannelInstance 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: ChannelPage) => any): Promise<ChannelPage>; /** * Lists ChannelInstance 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 { ChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; list(params: ChannelListInstanceOptions, callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; /** * Retrieve a single page of ChannelInstance 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 { ChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; page(params: ChannelListInstancePageOptions, callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ChannelListInstance(version: V2, serviceSid: string): ChannelListInstance; export declare class ChannelPage extends Page<V2, ChannelPayload, ChannelResource, ChannelInstance> { /** * Initialize the ChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ChannelSolution); /** * Build an instance of ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: ChannelResource): ChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/binding.js000064400000020156151677225100013740 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.BindingPage = exports.BindingListInstance = exports.BindingInstance = exports.BindingContextImpl = void 0; 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 BindingContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Bindings/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BindingInstance(operationVersion, payload, instance._solution.serviceSid, 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.BindingContextImpl = BindingContextImpl; class BindingInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.endpoint = payload.endpoint; this.identity = payload.identity; this.credentialSid = payload.credential_sid; this.bindingType = payload.binding_type; this.messageTypes = payload.message_types; this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new BindingContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, endpoint: this.endpoint, identity: this.identity, credentialSid: this.credentialSid, bindingType: this.bindingType, messageTypes: this.messageTypes, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BindingInstance = BindingInstance; function BindingListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new BindingContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Bindings`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["bindingType"] !== undefined) data["BindingType"] = serialize.map(params["bindingType"], (e) => e); if (params["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BindingPage(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 BindingPage(instance._version, payload, 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; } exports.BindingListInstance = BindingListInstance; class BindingPage extends Page_1.default { /** * Initialize the BindingPage * * @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 BindingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BindingInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BindingPage = BindingPage; rest/ipMessaging/v2/service/channel/member.d.ts000064400000030524151677225100015441 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type MemberWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a MemberInstance */ export interface MemberContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MemberWebhookEnabledType; } /** * Options to pass to update a MemberInstance */ export interface MemberContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MemberWebhookEnabledType; /** */ roleSid?: string; /** */ lastConsumedMessageIndex?: number; /** */ lastConsumptionTimestamp?: Date; /** */ dateCreated?: Date; /** */ dateUpdated?: Date; /** */ attributes?: string; } /** * Options to pass to create a MemberInstance */ export interface MemberListInstanceCreateOptions { /** */ identity: string; /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MemberWebhookEnabledType; /** */ roleSid?: string; /** */ lastConsumedMessageIndex?: number; /** */ lastConsumptionTimestamp?: Date; /** */ dateCreated?: Date; /** */ dateUpdated?: Date; /** */ attributes?: string; } /** * Options to pass to each */ export interface MemberListInstanceEachOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: MemberInstance, 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 MemberListInstanceOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface MemberListInstancePageOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface MemberContext { /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ remove(params: MemberContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MemberContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class MemberContextImpl implements MemberContext { protected _version: V2; protected _solution: MemberContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, channelSid: string, sid: string); remove(params?: MemberContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; update(params?: MemberContextUpdateOptions | ((error: Error | null, item?: MemberInstance) => any), callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MemberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MemberPayload extends TwilioResponsePayload { members: MemberResource[]; } interface MemberResource { sid: string; account_sid: string; channel_sid: string; service_sid: string; identity: string; date_created: Date; date_updated: Date; role_sid: string; last_consumed_message_index: number; last_consumption_timestamp: Date; url: string; attributes: string; } export declare class MemberInstance { protected _version: V2; protected _solution: MemberContextSolution; protected _context?: MemberContext; constructor(_version: V2, payload: MemberResource, serviceSid: string, channelSid: string, sid?: string); sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; lastConsumedMessageIndex: number; lastConsumptionTimestamp: Date; url: string; attributes: string; private get _proxy(); /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ remove(params: MemberContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; lastConsumedMessageIndex: number; lastConsumptionTimestamp: Date; url: string; attributes: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MemberSolution { serviceSid: string; channelSid: string; } export interface MemberListInstance { _version: V2; _solution: MemberSolution; _uri: string; (sid: string): MemberContext; get(sid: string): MemberContext; /** * Create a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ create(params: MemberListInstanceCreateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Streams MemberInstance 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 { MemberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; each(params: MemberListInstanceEachOptions, callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MemberInstance 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: MemberPage) => any): Promise<MemberPage>; /** * Lists MemberInstance 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 { MemberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; list(params: MemberListInstanceOptions, callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; /** * Retrieve a single page of MemberInstance 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 { MemberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; page(params: MemberListInstancePageOptions, callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MemberListInstance(version: V2, serviceSid: string, channelSid: string): MemberListInstance; export declare class MemberPage extends Page<V2, MemberPayload, MemberResource, MemberInstance> { /** * Initialize the MemberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: MemberSolution); /** * Build an instance of MemberInstance * * @param payload - Payload response from the API */ getInstance(payload: MemberResource): MemberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/channel/message.js000064400000030551151677225100015362 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.MessagePage = exports.MessageListInstance = exports.MessageInstance = exports.MessageContextImpl = void 0; 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 MessageContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Messages/${sid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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["body"] !== undefined) data["Body"] = params["body"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["lastUpdatedBy"] !== undefined) data["LastUpdatedBy"] = params["lastUpdatedBy"]; if (params["from"] !== undefined) data["From"] = params["from"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.MessageContextImpl = MessageContextImpl; class MessageInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.attributes = payload.attributes; this.serviceSid = payload.service_sid; this.to = payload.to; this.channelSid = payload.channel_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.lastUpdatedBy = payload.last_updated_by; this.wasEdited = payload.was_edited; this.from = payload.from; this.body = payload.body; this.index = deserialize.integer(payload.index); this.type = payload.type; this.media = payload.media; this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MessageContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, attributes: this.attributes, serviceSid: this.serviceSid, to: this.to, channelSid: this.channelSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, lastUpdatedBy: this.lastUpdatedBy, wasEdited: this.wasEdited, from: this.from, body: this.body, index: this.index, type: this.type, media: this.media, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessageInstance = MessageInstance; function MessageListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MessageContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Messages`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["lastUpdatedBy"] !== undefined) data["LastUpdatedBy"] = params["lastUpdatedBy"]; if (params["body"] !== undefined) data["Body"] = params["body"]; if (params["mediaSid"] !== undefined) data["MediaSid"] = params["mediaSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["order"] !== undefined) data["Order"] = params["order"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MessagePage(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 MessagePage(instance._version, payload, 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; } exports.MessageListInstance = MessageListInstance; class MessagePage extends Page_1.default { /** * Initialize the MessagePage * * @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 MessageInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MessageInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessagePage = MessagePage; rest/ipMessaging/v2/service/channel/invite.js000064400000022551151677225100015235 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.InvitePage = exports.InviteListInstance = exports.InviteInstance = exports.InviteContextImpl = void 0; 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 InviteContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Invites/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InviteInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.InviteContextImpl = InviteContextImpl; class InviteInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.channelSid = payload.channel_sid; this.serviceSid = payload.service_sid; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.roleSid = payload.role_sid; this.createdBy = payload.created_by; this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InviteContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, channelSid: this.channelSid, serviceSid: this.serviceSid, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, roleSid: this.roleSid, createdBy: this.createdBy, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InviteInstance = InviteInstance; function InviteListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InviteContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Invites`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InviteInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InvitePage(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 InvitePage(instance._version, payload, 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; } exports.InviteListInstance = InviteListInstance; class InvitePage extends Page_1.default { /** * Initialize the InvitePage * * @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 InviteInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InviteInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InvitePage = InvitePage; rest/ipMessaging/v2/service/channel/webhook.d.ts000064400000026010151677225100015623 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type WebhookMethod = "GET" | "POST"; export type WebhookType = "webhook" | "trigger" | "studio"; /** * Options to pass to update a WebhookInstance */ export interface WebhookContextUpdateOptions { /** */ "configuration.url"?: string; /** */ "configuration.method"?: WebhookMethod; /** */ "configuration.filters"?: Array<string>; /** */ "configuration.triggers"?: Array<string>; /** */ "configuration.flowSid"?: string; /** */ "configuration.retryCount"?: number; } /** * Options to pass to create a WebhookInstance */ export interface WebhookListInstanceCreateOptions { /** */ type: WebhookType; /** */ "configuration.url"?: string; /** */ "configuration.method"?: WebhookMethod; /** */ "configuration.filters"?: Array<string>; /** */ "configuration.triggers"?: Array<string>; /** */ "configuration.flowSid"?: string; /** */ "configuration.retryCount"?: number; } /** * Options to pass to each */ export interface WebhookListInstanceEachOptions { /** 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: WebhookInstance, 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 WebhookListInstanceOptions { /** 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 WebhookListInstancePageOptions { /** 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 WebhookContext { /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WebhookContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class WebhookContextImpl implements WebhookContext { protected _version: V2; protected _solution: WebhookContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; update(params?: WebhookContextUpdateOptions | ((error: Error | null, item?: WebhookInstance) => any), callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WebhookContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WebhookPayload extends TwilioResponsePayload { webhooks: WebhookResource[]; } interface WebhookResource { sid: string; account_sid: string; service_sid: string; channel_sid: string; type: string; url: string; configuration: any; date_created: Date; date_updated: Date; } export declare class WebhookInstance { protected _version: V2; protected _solution: WebhookContextSolution; protected _context?: WebhookContext; constructor(_version: V2, payload: WebhookResource, serviceSid: string, channelSid: string, sid?: string); sid: string; accountSid: string; serviceSid: string; channelSid: string; type: string; url: string; configuration: any; dateCreated: Date; dateUpdated: Date; private get _proxy(); /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; channelSid: string; type: string; url: string; configuration: any; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WebhookSolution { serviceSid: string; channelSid: string; } export interface WebhookListInstance { _version: V2; _solution: WebhookSolution; _uri: string; (sid: string): WebhookContext; get(sid: string): WebhookContext; /** * Create a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ create(params: WebhookListInstanceCreateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Streams WebhookInstance 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 { WebhookListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; each(params: WebhookListInstanceEachOptions, callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WebhookInstance 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: WebhookPage) => any): Promise<WebhookPage>; /** * Lists WebhookInstance 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 { WebhookListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; list(params: WebhookListInstanceOptions, callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; /** * Retrieve a single page of WebhookInstance 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 { WebhookListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; page(params: WebhookListInstancePageOptions, callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WebhookListInstance(version: V2, serviceSid: string, channelSid: string): WebhookListInstance; export declare class WebhookPage extends Page<V2, WebhookPayload, WebhookResource, WebhookInstance> { /** * Initialize the WebhookPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: WebhookSolution); /** * Build an instance of WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload: WebhookResource): WebhookInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/channel/message.d.ts000064400000031516151677225100015620 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type MessageOrderType = "asc" | "desc"; export type MessageWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a MessageInstance */ export interface MessageContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; } /** * Options to pass to update a MessageInstance */ export interface MessageContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; /** */ body?: string; /** */ attributes?: string; /** */ dateCreated?: Date; /** */ dateUpdated?: Date; /** */ lastUpdatedBy?: string; /** */ from?: string; } /** * Options to pass to create a MessageInstance */ export interface MessageListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; /** */ from?: string; /** */ attributes?: string; /** */ dateCreated?: Date; /** */ dateUpdated?: Date; /** */ lastUpdatedBy?: string; /** */ body?: string; /** */ mediaSid?: string; } /** * Options to pass to each */ export interface MessageListInstanceEachOptions { /** */ order?: MessageOrderType; /** 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: MessageInstance, 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 MessageListInstanceOptions { /** */ order?: MessageOrderType; /** 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 MessageListInstancePageOptions { /** */ order?: MessageOrderType; /** 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 MessageContext { /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ remove(params: MessageContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MessageContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class MessageContextImpl implements MessageContext { protected _version: V2; protected _solution: MessageContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, channelSid: string, sid: string); remove(params?: MessageContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; update(params?: MessageContextUpdateOptions | ((error: Error | null, item?: MessageInstance) => any), callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MessageContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MessagePayload extends TwilioResponsePayload { messages: MessageResource[]; } interface MessageResource { sid: string; account_sid: string; attributes: string; service_sid: string; to: string; channel_sid: string; date_created: Date; date_updated: Date; last_updated_by: string; was_edited: boolean; from: string; body: string; index: number; type: string; media: any; url: string; } export declare class MessageInstance { protected _version: V2; protected _solution: MessageContextSolution; protected _context?: MessageContext; constructor(_version: V2, payload: MessageResource, serviceSid: string, channelSid: string, sid?: string); sid: string; accountSid: string; attributes: string; serviceSid: string; to: string; channelSid: string; dateCreated: Date; dateUpdated: Date; lastUpdatedBy: string; wasEdited: boolean; from: string; body: string; index: number; type: string; media: any; url: string; private get _proxy(); /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ remove(params: MessageContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; attributes: string; serviceSid: string; to: string; channelSid: string; dateCreated: Date; dateUpdated: Date; lastUpdatedBy: string; wasEdited: boolean; from: string; body: string; index: number; type: string; media: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MessageSolution { serviceSid: string; channelSid: string; } export interface MessageListInstance { _version: V2; _solution: MessageSolution; _uri: string; (sid: string): MessageContext; get(sid: string): MessageContext; /** * Create a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Create a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(params: MessageListInstanceCreateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Streams MessageInstance 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 { MessageListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; each(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MessageInstance 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: MessagePage) => any): Promise<MessagePage>; /** * Lists MessageInstance 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 { MessageListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; list(params: MessageListInstanceOptions, callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; /** * Retrieve a single page of MessageInstance 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 { MessageListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; page(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessageListInstance(version: V2, serviceSid: string, channelSid: string): MessageListInstance; export declare class MessagePage extends Page<V2, MessagePayload, MessageResource, MessageInstance> { /** * Initialize the MessagePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: MessageSolution); /** * Build an instance of MessageInstance * * @param payload - Payload response from the API */ getInstance(payload: MessageResource): MessageInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/channel/member.js000064400000031157151677225100015210 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.MemberPage = exports.MemberListInstance = exports.MemberInstance = exports.MemberContextImpl = void 0; 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 MemberContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Members/${sid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["lastConsumedMessageIndex"] !== undefined) data["LastConsumedMessageIndex"] = params["lastConsumedMessageIndex"]; if (params["lastConsumptionTimestamp"] !== undefined) data["LastConsumptionTimestamp"] = serialize.iso8601DateTime(params["lastConsumptionTimestamp"]); if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.MemberContextImpl = MemberContextImpl; class MemberInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.channelSid = payload.channel_sid; this.serviceSid = payload.service_sid; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.roleSid = payload.role_sid; this.lastConsumedMessageIndex = deserialize.integer(payload.last_consumed_message_index); this.lastConsumptionTimestamp = deserialize.iso8601DateTime(payload.last_consumption_timestamp); this.url = payload.url; this.attributes = payload.attributes; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MemberContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, channelSid: this.channelSid, serviceSid: this.serviceSid, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, roleSid: this.roleSid, lastConsumedMessageIndex: this.lastConsumedMessageIndex, lastConsumptionTimestamp: this.lastConsumptionTimestamp, url: this.url, attributes: this.attributes, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberInstance = MemberInstance; function MemberListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MemberContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Members`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["lastConsumedMessageIndex"] !== undefined) data["LastConsumedMessageIndex"] = params["lastConsumedMessageIndex"]; if (params["lastConsumptionTimestamp"] !== undefined) data["LastConsumptionTimestamp"] = serialize.iso8601DateTime(params["lastConsumptionTimestamp"]); if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MemberPage(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 MemberPage(instance._version, payload, 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; } exports.MemberListInstance = MemberListInstance; class MemberPage extends Page_1.default { /** * Initialize the MemberPage * * @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 MemberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MemberInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberPage = MemberPage; rest/ipMessaging/v2/service/channel/invite.d.ts000064400000021620151677225100015465 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; /** * Options to pass to create a InviteInstance */ export interface InviteListInstanceCreateOptions { /** */ identity: string; /** */ roleSid?: string; } /** * Options to pass to each */ export interface InviteListInstanceEachOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InviteInstance, 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 InviteListInstanceOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InviteListInstancePageOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InviteContext { /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InviteContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class InviteContextImpl implements InviteContext { protected _version: V2; protected _solution: InviteContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InviteContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InvitePayload extends TwilioResponsePayload { invites: InviteResource[]; } interface InviteResource { sid: string; account_sid: string; channel_sid: string; service_sid: string; identity: string; date_created: Date; date_updated: Date; role_sid: string; created_by: string; url: string; } export declare class InviteInstance { protected _version: V2; protected _solution: InviteContextSolution; protected _context?: InviteContext; constructor(_version: V2, payload: InviteResource, serviceSid: string, channelSid: string, sid?: string); sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; createdBy: string; url: string; private get _proxy(); /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; createdBy: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InviteSolution { serviceSid: string; channelSid: string; } export interface InviteListInstance { _version: V2; _solution: InviteSolution; _uri: string; (sid: string): InviteContext; get(sid: string): InviteContext; /** * Create a InviteInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ create(params: InviteListInstanceCreateOptions, callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Streams InviteInstance 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 { InviteListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InviteInstance, done: (err?: Error) => void) => void): void; each(params: InviteListInstanceEachOptions, callback?: (item: InviteInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InviteInstance 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: InvitePage) => any): Promise<InvitePage>; /** * Lists InviteInstance 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 { InviteListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InviteInstance[]) => any): Promise<InviteInstance[]>; list(params: InviteListInstanceOptions, callback?: (error: Error | null, items: InviteInstance[]) => any): Promise<InviteInstance[]>; /** * Retrieve a single page of InviteInstance 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 { InviteListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InvitePage) => any): Promise<InvitePage>; page(params: InviteListInstancePageOptions, callback?: (error: Error | null, items: InvitePage) => any): Promise<InvitePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InviteListInstance(version: V2, serviceSid: string, channelSid: string): InviteListInstance; export declare class InvitePage extends Page<V2, InvitePayload, InviteResource, InviteInstance> { /** * Initialize the InvitePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: InviteSolution); /** * Build an instance of InviteInstance * * @param payload - Payload response from the API */ getInstance(payload: InviteResource): InviteInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/channel/webhook.js000064400000027335151677225100015402 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.WebhookPage = exports.WebhookListInstance = exports.WebhookInstance = exports.WebhookContextImpl = void 0; 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 WebhookContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Webhooks/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["configuration.url"] !== undefined) data["Configuration.Url"] = params["configuration.url"]; if (params["configuration.method"] !== undefined) data["Configuration.Method"] = params["configuration.method"]; if (params["configuration.filters"] !== undefined) data["Configuration.Filters"] = serialize.map(params["configuration.filters"], (e) => e); if (params["configuration.triggers"] !== undefined) data["Configuration.Triggers"] = serialize.map(params["configuration.triggers"], (e) => e); if (params["configuration.flowSid"] !== undefined) data["Configuration.FlowSid"] = params["configuration.flowSid"]; if (params["configuration.retryCount"] !== undefined) data["Configuration.RetryCount"] = params["configuration.retryCount"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.WebhookContextImpl = WebhookContextImpl; class WebhookInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.channelSid = payload.channel_sid; this.type = payload.type; this.url = payload.url; this.configuration = payload.configuration; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WebhookContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, channelSid: this.channelSid, type: this.type, url: this.url, configuration: this.configuration, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookInstance = WebhookInstance; function WebhookListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WebhookContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Webhooks`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["Type"] = params["type"]; if (params["configuration.url"] !== undefined) data["Configuration.Url"] = params["configuration.url"]; if (params["configuration.method"] !== undefined) data["Configuration.Method"] = params["configuration.method"]; if (params["configuration.filters"] !== undefined) data["Configuration.Filters"] = serialize.map(params["configuration.filters"], (e) => e); if (params["configuration.triggers"] !== undefined) data["Configuration.Triggers"] = serialize.map(params["configuration.triggers"], (e) => e); if (params["configuration.flowSid"] !== undefined) data["Configuration.FlowSid"] = params["configuration.flowSid"]; if (params["configuration.retryCount"] !== undefined) data["Configuration.RetryCount"] = params["configuration.retryCount"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookPage(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 WebhookPage(instance._version, payload, 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; } exports.WebhookListInstance = WebhookListInstance; class WebhookPage extends Page_1.default { /** * Initialize the WebhookPage * * @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 WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WebhookInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookPage = WebhookPage; rest/ipMessaging/v2/service/user.js000064400000027120151677225100013302 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.UserPage = exports.UserListInstance = exports.UserInstance = exports.UserContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const userBinding_1 = require("./user/userBinding"); const userChannel_1 = require("./user/userChannel"); class UserContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Users/${sid}`; } get userBindings() { this._userBindings = this._userBindings || (0, userBinding_1.UserBindingListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._userBindings; } get userChannels() { this._userChannels = this._userChannels || (0, userChannel_1.UserChannelListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._userChannels; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid, 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["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid, 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.UserContextImpl = UserContextImpl; class UserInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.attributes = payload.attributes; this.friendlyName = payload.friendly_name; this.roleSid = payload.role_sid; this.identity = payload.identity; this.isOnline = payload.is_online; this.isNotifiable = payload.is_notifiable; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.joinedChannelsCount = deserialize.integer(payload.joined_channels_count); this.links = payload.links; this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the userBindings. */ userBindings() { return this._proxy.userBindings; } /** * Access the userChannels. */ userChannels() { return this._proxy.userChannels; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, attributes: this.attributes, friendlyName: this.friendlyName, roleSid: this.roleSid, identity: this.identity, isOnline: this.isOnline, isNotifiable: this.isNotifiable, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, joinedChannelsCount: this.joinedChannelsCount, links: this.links, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserInstance = UserInstance; function UserListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Users`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserPage(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 UserPage(instance._version, payload, 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; } exports.UserListInstance = UserListInstance; class UserPage extends Page_1.default { /** * Initialize the UserPage * * @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 UserInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserPage = UserPage; rest/ipMessaging/v2/service/role.d.ts000064400000023020151677225100013514 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type RoleRoleType = "channel" | "deployment"; /** * Options to pass to update a RoleInstance */ export interface RoleContextUpdateOptions { /** */ permission: Array<string>; } /** * Options to pass to create a RoleInstance */ export interface RoleListInstanceCreateOptions { /** */ friendlyName: string; /** */ type: RoleRoleType; /** */ permission: Array<string>; } /** * Options to pass to each */ export interface RoleListInstanceEachOptions { /** 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: RoleInstance, 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 RoleListInstanceOptions { /** 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 RoleListInstancePageOptions { /** 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 RoleContext { /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RoleContextSolution { serviceSid: string; sid: string; } export declare class RoleContextImpl implements RoleContext { protected _version: V2; protected _solution: RoleContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RoleContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RolePayload extends TwilioResponsePayload { roles: RoleResource[]; } interface RoleResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; type: RoleRoleType; permissions: Array<string>; date_created: Date; date_updated: Date; url: string; } export declare class RoleInstance { protected _version: V2; protected _solution: RoleContextSolution; protected _context?: RoleContext; constructor(_version: V2, payload: RoleResource, serviceSid: string, sid?: string); sid: string; accountSid: string; serviceSid: string; friendlyName: string; type: RoleRoleType; permissions: Array<string>; dateCreated: Date; dateUpdated: Date; url: string; private get _proxy(); /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; type: RoleRoleType; permissions: string[]; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RoleSolution { serviceSid: string; } export interface RoleListInstance { _version: V2; _solution: RoleSolution; _uri: string; (sid: string): RoleContext; get(sid: string): RoleContext; /** * Create a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ create(params: RoleListInstanceCreateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Streams RoleInstance 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 { RoleListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; each(params: RoleListInstanceEachOptions, callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RoleInstance 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: RolePage) => any): Promise<RolePage>; /** * Lists RoleInstance 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 { RoleListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; list(params: RoleListInstanceOptions, callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; /** * Retrieve a single page of RoleInstance 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 { RoleListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; page(params: RoleListInstancePageOptions, callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RoleListInstance(version: V2, serviceSid: string): RoleListInstance; export declare class RolePage extends Page<V2, RolePayload, RoleResource, RoleInstance> { /** * Initialize the RolePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: RoleSolution); /** * Build an instance of RoleInstance * * @param payload - Payload response from the API */ getInstance(payload: RoleResource): RoleInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/user.d.ts000064400000026634151677225100013547 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; import { UserBindingListInstance } from "./user/userBinding"; import { UserChannelListInstance } from "./user/userChannel"; export type UserWebhookEnabledType = "true" | "false"; /** * Options to pass to update a UserInstance */ export interface UserContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; /** */ roleSid?: string; /** */ attributes?: string; /** */ friendlyName?: string; } /** * Options to pass to create a UserInstance */ export interface UserListInstanceCreateOptions { /** */ identity: string; /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; /** */ roleSid?: string; /** */ attributes?: string; /** */ friendlyName?: string; } /** * Options to pass to each */ export interface UserListInstanceEachOptions { /** 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: UserInstance, 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 UserListInstanceOptions { /** 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 UserListInstancePageOptions { /** 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 UserContext { userBindings: UserBindingListInstance; userChannels: UserChannelListInstance; /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserContextSolution { serviceSid: string; sid: string; } export declare class UserContextImpl implements UserContext { protected _version: V2; protected _solution: UserContextSolution; protected _uri: string; protected _userBindings?: UserBindingListInstance; protected _userChannels?: UserChannelListInstance; constructor(_version: V2, serviceSid: string, sid: string); get userBindings(): UserBindingListInstance; get userChannels(): UserChannelListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; update(params?: UserContextUpdateOptions | ((error: Error | null, item?: UserInstance) => any), callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserPayload extends TwilioResponsePayload { users: UserResource[]; } interface UserResource { sid: string; account_sid: string; service_sid: string; attributes: string; friendly_name: string; role_sid: string; identity: string; is_online: boolean; is_notifiable: boolean; date_created: Date; date_updated: Date; joined_channels_count: number; links: Record<string, string>; url: string; } export declare class UserInstance { protected _version: V2; protected _solution: UserContextSolution; protected _context?: UserContext; constructor(_version: V2, payload: UserResource, serviceSid: string, sid?: string); sid: string; accountSid: string; serviceSid: string; attributes: string; friendlyName: string; roleSid: string; identity: string; isOnline: boolean; isNotifiable: boolean; dateCreated: Date; dateUpdated: Date; joinedChannelsCount: number; links: Record<string, string>; url: string; private get _proxy(); /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Access the userBindings. */ userBindings(): UserBindingListInstance; /** * Access the userChannels. */ userChannels(): UserChannelListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; attributes: string; friendlyName: string; roleSid: string; identity: string; isOnline: boolean; isNotifiable: boolean; dateCreated: Date; dateUpdated: Date; joinedChannelsCount: number; links: Record<string, string>; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserSolution { serviceSid: string; } export interface UserListInstance { _version: V2; _solution: UserSolution; _uri: string; (sid: string): UserContext; get(sid: string): UserContext; /** * Create a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ create(params: UserListInstanceCreateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Streams UserInstance 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 { UserListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; each(params: UserListInstanceEachOptions, callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserInstance 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: UserPage) => any): Promise<UserPage>; /** * Lists UserInstance 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 { UserListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; list(params: UserListInstanceOptions, callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; /** * Retrieve a single page of UserInstance 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 { UserListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; page(params: UserListInstancePageOptions, callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserListInstance(version: V2, serviceSid: string): UserListInstance; export declare class UserPage extends Page<V2, UserPayload, UserResource, UserInstance> { /** * Initialize the UserPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: UserSolution); /** * Build an instance of UserInstance * * @param payload - Payload response from the API */ getInstance(payload: UserResource): UserInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v2/service/channel.js000064400000032466151677225100013745 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.ChannelPage = exports.ChannelListInstance = exports.ChannelInstance = exports.ChannelContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const invite_1 = require("./channel/invite"); const member_1 = require("./channel/member"); const message_1 = require("./channel/message"); const webhook_1 = require("./channel/webhook"); class ChannelContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${sid}`; } get invites() { this._invites = this._invites || (0, invite_1.InviteListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._invites; } get members() { this._members = this._members || (0, member_1.MemberListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._members; } get messages() { this._messages = this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._messages; } get webhooks() { this._webhooks = this._webhooks || (0, webhook_1.WebhookListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._webhooks; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["createdBy"] !== undefined) data["CreatedBy"] = params["createdBy"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid, 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.ChannelContextImpl = ChannelContextImpl; class ChannelInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.attributes = payload.attributes; this.type = payload.type; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this.membersCount = deserialize.integer(payload.members_count); this.messagesCount = deserialize.integer(payload.messages_count); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ChannelContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the invites. */ invites() { return this._proxy.invites; } /** * Access the members. */ members() { return this._proxy.members; } /** * Access the messages. */ messages() { return this._proxy.messages; } /** * Access the webhooks. */ webhooks() { return this._proxy.webhooks; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, uniqueName: this.uniqueName, attributes: this.attributes, type: this.type, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, membersCount: this.membersCount, messagesCount: this.messagesCount, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelInstance = ChannelInstance; function ChannelListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ChannelContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Channels`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["type"] !== undefined) data["Type"] = params["type"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["createdBy"] !== undefined) data["CreatedBy"] = params["createdBy"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid)); 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["type"] !== undefined) data["Type"] = serialize.map(params["type"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelPage(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 ChannelPage(instance._version, payload, 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; } exports.ChannelListInstance = ChannelListInstance; class ChannelPage extends Page_1.default { /** * Initialize the ChannelPage * * @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 ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ChannelInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelPage = ChannelPage; rest/ipMessaging/v2/service/role.js000064400000024154151677225100013271 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.RolePage = exports.RoleListInstance = exports.RoleInstance = exports.RoleContextImpl = void 0; 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 RoleContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Roles/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid, 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.RoleContextImpl = RoleContextImpl; class RoleInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.permissions = payload.permissions; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RoleContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, type: this.type, permissions: this.permissions, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoleInstance = RoleInstance; function RoleListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RoleContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Roles`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RolePage(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 RolePage(instance._version, payload, 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; } exports.RoleListInstance = RoleListInstance; class RolePage extends Page_1.default { /** * Initialize the RolePage * * @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 RoleInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RoleInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RolePage = RolePage; rest/ipMessaging/v1/service.d.ts000064400000035730151677225100012565 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { ChannelListInstance } from "./service/channel"; import { RoleListInstance } from "./service/role"; import { UserListInstance } from "./service/user"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** */ friendlyName?: string; /** */ defaultServiceRoleSid?: string; /** */ defaultChannelRoleSid?: string; /** */ defaultChannelCreatorRoleSid?: string; /** */ readStatusEnabled?: boolean; /** */ reachabilityEnabled?: boolean; /** */ typingIndicatorTimeout?: number; /** */ consumptionReportInterval?: number; /** */ "notifications.newMessage.enabled"?: boolean; /** */ "notifications.newMessage.template"?: string; /** */ "notifications.addedToChannel.enabled"?: boolean; /** */ "notifications.addedToChannel.template"?: string; /** */ "notifications.removedFromChannel.enabled"?: boolean; /** */ "notifications.removedFromChannel.template"?: string; /** */ "notifications.invitedToChannel.enabled"?: boolean; /** */ "notifications.invitedToChannel.template"?: string; /** */ preWebhookUrl?: string; /** */ postWebhookUrl?: string; /** */ webhookMethod?: string; /** */ webhookFilters?: Array<string>; /** */ "webhooks.onMessageSend.url"?: string; /** */ "webhooks.onMessageSend.method"?: string; /** */ "webhooks.onMessageUpdate.url"?: string; /** */ "webhooks.onMessageUpdate.method"?: string; /** */ "webhooks.onMessageRemove.url"?: string; /** */ "webhooks.onMessageRemove.method"?: string; /** */ "webhooks.onChannelAdd.url"?: string; /** */ "webhooks.onChannelAdd.method"?: string; /** */ "webhooks.onChannelDestroy.url"?: string; /** */ "webhooks.onChannelDestroy.method"?: string; /** */ "webhooks.onChannelUpdate.url"?: string; /** */ "webhooks.onChannelUpdate.method"?: string; /** */ "webhooks.onMemberAdd.url"?: string; /** */ "webhooks.onMemberAdd.method"?: string; /** */ "webhooks.onMemberRemove.url"?: string; /** */ "webhooks.onMemberRemove.method"?: string; /** */ "webhooks.onMessageSent.url"?: string; /** */ "webhooks.onMessageSent.method"?: string; /** */ "webhooks.onMessageUpdated.url"?: string; /** */ "webhooks.onMessageUpdated.method"?: string; /** */ "webhooks.onMessageRemoved.url"?: string; /** */ "webhooks.onMessageRemoved.method"?: string; /** */ "webhooks.onChannelAdded.url"?: string; /** */ "webhooks.onChannelAdded.method"?: string; /** */ "webhooks.onChannelDestroyed.url"?: string; /** */ "webhooks.onChannelDestroyed.method"?: string; /** */ "webhooks.onChannelUpdated.url"?: string; /** */ "webhooks.onChannelUpdated.method"?: string; /** */ "webhooks.onMemberAdded.url"?: string; /** */ "webhooks.onMemberAdded.method"?: string; /** */ "webhooks.onMemberRemoved.url"?: string; /** */ "webhooks.onMemberRemoved.method"?: string; /** */ "limits.channelMembers"?: number; /** */ "limits.userChannels"?: number; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** */ friendlyName: string; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { channels: ChannelListInstance; roles: RoleListInstance; users: UserListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V1; protected _solution: ServiceContextSolution; protected _uri: string; protected _channels?: ChannelListInstance; protected _roles?: RoleListInstance; protected _users?: UserListInstance; constructor(_version: V1, sid: string); get channels(): ChannelListInstance; get roles(): RoleListInstance; get users(): UserListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; date_created: Date; date_updated: Date; default_service_role_sid: string; default_channel_role_sid: string; default_channel_creator_role_sid: string; read_status_enabled: boolean; reachability_enabled: boolean; typing_indicator_timeout: number; consumption_report_interval: number; limits: any; webhooks: any; pre_webhook_url: string; post_webhook_url: string; webhook_method: string; webhook_filters: Array<string>; notifications: any; url: string; links: Record<string, string>; } export declare class ServiceInstance { protected _version: V1; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V1, payload: ServiceResource, sid?: string); sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; defaultServiceRoleSid: string; defaultChannelRoleSid: string; defaultChannelCreatorRoleSid: string; readStatusEnabled: boolean; reachabilityEnabled: boolean; typingIndicatorTimeout: number; consumptionReportInterval: number; limits: any; webhooks: any; preWebhookUrl: string; postWebhookUrl: string; webhookMethod: string; webhookFilters: Array<string>; notifications: any; url: string; links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the channels. */ channels(): ChannelListInstance; /** * Access the roles. */ roles(): RoleListInstance; /** * Access the users. */ users(): UserListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; defaultServiceRoleSid: string; defaultChannelRoleSid: string; defaultChannelCreatorRoleSid: string; readStatusEnabled: boolean; reachabilityEnabled: boolean; typingIndicatorTimeout: number; consumptionReportInterval: number; limits: any; webhooks: any; preWebhookUrl: string; postWebhookUrl: string; webhookMethod: string; webhookFilters: string[]; notifications: any; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V1; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V1): ServiceListInstance; export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v1/service.js000064400000050303151677225100012322 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const channel_1 = require("./service/channel"); const role_1 = require("./service/role"); const user_1 = require("./service/user"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get channels() { this._channels = this._channels || (0, channel_1.ChannelListInstance)(this._version, this._solution.sid); return this._channels; } get roles() { this._roles = this._roles || (0, role_1.RoleListInstance)(this._version, this._solution.sid); return this._roles; } get users() { this._users = this._users || (0, user_1.UserListInstance)(this._version, this._solution.sid); return this._users; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["defaultServiceRoleSid"] !== undefined) data["DefaultServiceRoleSid"] = params["defaultServiceRoleSid"]; if (params["defaultChannelRoleSid"] !== undefined) data["DefaultChannelRoleSid"] = params["defaultChannelRoleSid"]; if (params["defaultChannelCreatorRoleSid"] !== undefined) data["DefaultChannelCreatorRoleSid"] = params["defaultChannelCreatorRoleSid"]; if (params["readStatusEnabled"] !== undefined) data["ReadStatusEnabled"] = serialize.bool(params["readStatusEnabled"]); if (params["reachabilityEnabled"] !== undefined) data["ReachabilityEnabled"] = serialize.bool(params["reachabilityEnabled"]); if (params["typingIndicatorTimeout"] !== undefined) data["TypingIndicatorTimeout"] = params["typingIndicatorTimeout"]; if (params["consumptionReportInterval"] !== undefined) data["ConsumptionReportInterval"] = params["consumptionReportInterval"]; if (params["notifications.newMessage.enabled"] !== undefined) data["Notifications.NewMessage.Enabled"] = serialize.bool(params["notifications.newMessage.enabled"]); if (params["notifications.newMessage.template"] !== undefined) data["Notifications.NewMessage.Template"] = params["notifications.newMessage.template"]; if (params["notifications.addedToChannel.enabled"] !== undefined) data["Notifications.AddedToChannel.Enabled"] = serialize.bool(params["notifications.addedToChannel.enabled"]); if (params["notifications.addedToChannel.template"] !== undefined) data["Notifications.AddedToChannel.Template"] = params["notifications.addedToChannel.template"]; if (params["notifications.removedFromChannel.enabled"] !== undefined) data["Notifications.RemovedFromChannel.Enabled"] = serialize.bool(params["notifications.removedFromChannel.enabled"]); if (params["notifications.removedFromChannel.template"] !== undefined) data["Notifications.RemovedFromChannel.Template"] = params["notifications.removedFromChannel.template"]; if (params["notifications.invitedToChannel.enabled"] !== undefined) data["Notifications.InvitedToChannel.Enabled"] = serialize.bool(params["notifications.invitedToChannel.enabled"]); if (params["notifications.invitedToChannel.template"] !== undefined) data["Notifications.InvitedToChannel.Template"] = params["notifications.invitedToChannel.template"]; if (params["preWebhookUrl"] !== undefined) data["PreWebhookUrl"] = params["preWebhookUrl"]; if (params["postWebhookUrl"] !== undefined) data["PostWebhookUrl"] = params["postWebhookUrl"]; if (params["webhookMethod"] !== undefined) data["WebhookMethod"] = params["webhookMethod"]; if (params["webhookFilters"] !== undefined) data["WebhookFilters"] = serialize.map(params["webhookFilters"], (e) => e); if (params["webhooks.onMessageSend.url"] !== undefined) data["Webhooks.OnMessageSend.Url"] = params["webhooks.onMessageSend.url"]; if (params["webhooks.onMessageSend.method"] !== undefined) data["Webhooks.OnMessageSend.Method"] = params["webhooks.onMessageSend.method"]; if (params["webhooks.onMessageUpdate.url"] !== undefined) data["Webhooks.OnMessageUpdate.Url"] = params["webhooks.onMessageUpdate.url"]; if (params["webhooks.onMessageUpdate.method"] !== undefined) data["Webhooks.OnMessageUpdate.Method"] = params["webhooks.onMessageUpdate.method"]; if (params["webhooks.onMessageRemove.url"] !== undefined) data["Webhooks.OnMessageRemove.Url"] = params["webhooks.onMessageRemove.url"]; if (params["webhooks.onMessageRemove.method"] !== undefined) data["Webhooks.OnMessageRemove.Method"] = params["webhooks.onMessageRemove.method"]; if (params["webhooks.onChannelAdd.url"] !== undefined) data["Webhooks.OnChannelAdd.Url"] = params["webhooks.onChannelAdd.url"]; if (params["webhooks.onChannelAdd.method"] !== undefined) data["Webhooks.OnChannelAdd.Method"] = params["webhooks.onChannelAdd.method"]; if (params["webhooks.onChannelDestroy.url"] !== undefined) data["Webhooks.OnChannelDestroy.Url"] = params["webhooks.onChannelDestroy.url"]; if (params["webhooks.onChannelDestroy.method"] !== undefined) data["Webhooks.OnChannelDestroy.Method"] = params["webhooks.onChannelDestroy.method"]; if (params["webhooks.onChannelUpdate.url"] !== undefined) data["Webhooks.OnChannelUpdate.Url"] = params["webhooks.onChannelUpdate.url"]; if (params["webhooks.onChannelUpdate.method"] !== undefined) data["Webhooks.OnChannelUpdate.Method"] = params["webhooks.onChannelUpdate.method"]; if (params["webhooks.onMemberAdd.url"] !== undefined) data["Webhooks.OnMemberAdd.Url"] = params["webhooks.onMemberAdd.url"]; if (params["webhooks.onMemberAdd.method"] !== undefined) data["Webhooks.OnMemberAdd.Method"] = params["webhooks.onMemberAdd.method"]; if (params["webhooks.onMemberRemove.url"] !== undefined) data["Webhooks.OnMemberRemove.Url"] = params["webhooks.onMemberRemove.url"]; if (params["webhooks.onMemberRemove.method"] !== undefined) data["Webhooks.OnMemberRemove.Method"] = params["webhooks.onMemberRemove.method"]; if (params["webhooks.onMessageSent.url"] !== undefined) data["Webhooks.OnMessageSent.Url"] = params["webhooks.onMessageSent.url"]; if (params["webhooks.onMessageSent.method"] !== undefined) data["Webhooks.OnMessageSent.Method"] = params["webhooks.onMessageSent.method"]; if (params["webhooks.onMessageUpdated.url"] !== undefined) data["Webhooks.OnMessageUpdated.Url"] = params["webhooks.onMessageUpdated.url"]; if (params["webhooks.onMessageUpdated.method"] !== undefined) data["Webhooks.OnMessageUpdated.Method"] = params["webhooks.onMessageUpdated.method"]; if (params["webhooks.onMessageRemoved.url"] !== undefined) data["Webhooks.OnMessageRemoved.Url"] = params["webhooks.onMessageRemoved.url"]; if (params["webhooks.onMessageRemoved.method"] !== undefined) data["Webhooks.OnMessageRemoved.Method"] = params["webhooks.onMessageRemoved.method"]; if (params["webhooks.onChannelAdded.url"] !== undefined) data["Webhooks.OnChannelAdded.Url"] = params["webhooks.onChannelAdded.url"]; if (params["webhooks.onChannelAdded.method"] !== undefined) data["Webhooks.OnChannelAdded.Method"] = params["webhooks.onChannelAdded.method"]; if (params["webhooks.onChannelDestroyed.url"] !== undefined) data["Webhooks.OnChannelDestroyed.Url"] = params["webhooks.onChannelDestroyed.url"]; if (params["webhooks.onChannelDestroyed.method"] !== undefined) data["Webhooks.OnChannelDestroyed.Method"] = params["webhooks.onChannelDestroyed.method"]; if (params["webhooks.onChannelUpdated.url"] !== undefined) data["Webhooks.OnChannelUpdated.Url"] = params["webhooks.onChannelUpdated.url"]; if (params["webhooks.onChannelUpdated.method"] !== undefined) data["Webhooks.OnChannelUpdated.Method"] = params["webhooks.onChannelUpdated.method"]; if (params["webhooks.onMemberAdded.url"] !== undefined) data["Webhooks.OnMemberAdded.Url"] = params["webhooks.onMemberAdded.url"]; if (params["webhooks.onMemberAdded.method"] !== undefined) data["Webhooks.OnMemberAdded.Method"] = params["webhooks.onMemberAdded.method"]; if (params["webhooks.onMemberRemoved.url"] !== undefined) data["Webhooks.OnMemberRemoved.Url"] = params["webhooks.onMemberRemoved.url"]; if (params["webhooks.onMemberRemoved.method"] !== undefined) data["Webhooks.OnMemberRemoved.Method"] = params["webhooks.onMemberRemoved.method"]; if (params["limits.channelMembers"] !== undefined) data["Limits.ChannelMembers"] = params["limits.channelMembers"]; if (params["limits.userChannels"] !== undefined) data["Limits.UserChannels"] = params["limits.userChannels"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { 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.defaultServiceRoleSid = payload.default_service_role_sid; this.defaultChannelRoleSid = payload.default_channel_role_sid; this.defaultChannelCreatorRoleSid = payload.default_channel_creator_role_sid; this.readStatusEnabled = payload.read_status_enabled; this.reachabilityEnabled = payload.reachability_enabled; this.typingIndicatorTimeout = deserialize.integer(payload.typing_indicator_timeout); this.consumptionReportInterval = deserialize.integer(payload.consumption_report_interval); this.limits = payload.limits; this.webhooks = payload.webhooks; this.preWebhookUrl = payload.pre_webhook_url; this.postWebhookUrl = payload.post_webhook_url; this.webhookMethod = payload.webhook_method; this.webhookFilters = payload.webhook_filters; this.notifications = payload.notifications; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the channels. */ channels() { return this._proxy.channels; } /** * Access the roles. */ roles() { return this._proxy.roles; } /** * Access the users. */ users() { return this._proxy.users; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, defaultServiceRoleSid: this.defaultServiceRoleSid, defaultChannelRoleSid: this.defaultChannelRoleSid, defaultChannelCreatorRoleSid: this.defaultChannelCreatorRoleSid, readStatusEnabled: this.readStatusEnabled, reachabilityEnabled: this.reachabilityEnabled, typingIndicatorTimeout: this.typingIndicatorTimeout, consumptionReportInterval: this.consumptionReportInterval, limits: this.limits, webhooks: this.webhooks, preWebhookUrl: this.preWebhookUrl, postWebhookUrl: this.postWebhookUrl, webhookMethod: this.webhookMethod, webhookFilters: this.webhookFilters, notifications: this.notifications, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/ipMessaging/v1/credential.d.ts000064400000025457151677225100013244 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type CredentialPushService = "gcm" | "apn" | "fcm"; /** * Options to pass to update a CredentialInstance */ export interface CredentialContextUpdateOptions { /** */ friendlyName?: string; /** */ certificate?: string; /** */ privateKey?: string; /** */ sandbox?: boolean; /** */ apiKey?: string; /** */ secret?: string; } /** * Options to pass to create a CredentialInstance */ export interface CredentialListInstanceCreateOptions { /** */ type: CredentialPushService; /** */ friendlyName?: string; /** */ certificate?: string; /** */ privateKey?: string; /** */ sandbox?: boolean; /** */ apiKey?: string; /** */ secret?: string; } /** * Options to pass to each */ export interface CredentialListInstanceEachOptions { /** 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: CredentialInstance, 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 CredentialListInstanceOptions { /** 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 CredentialListInstancePageOptions { /** 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 CredentialContext { /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialContextSolution { sid: string; } export declare class CredentialContextImpl implements CredentialContext { protected _version: V1; protected _solution: CredentialContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; update(params?: CredentialContextUpdateOptions | ((error: Error | null, item?: CredentialInstance) => any), callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialPayload extends TwilioResponsePayload { credentials: CredentialResource[]; } interface CredentialResource { sid: string; account_sid: string; friendly_name: string; type: CredentialPushService; sandbox: string; date_created: Date; date_updated: Date; url: string; } export declare class CredentialInstance { protected _version: V1; protected _solution: CredentialContextSolution; protected _context?: CredentialContext; constructor(_version: V1, payload: CredentialResource, sid?: string); sid: string; accountSid: string; friendlyName: string; type: CredentialPushService; sandbox: string; dateCreated: Date; dateUpdated: Date; url: string; private get _proxy(); /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; type: CredentialPushService; sandbox: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialSolution { } export interface CredentialListInstance { _version: V1; _solution: CredentialSolution; _uri: string; (sid: string): CredentialContext; get(sid: string): CredentialContext; /** * Create a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ create(params: CredentialListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Streams CredentialInstance 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 { CredentialListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListInstanceEachOptions, callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialInstance 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: CredentialPage) => any): Promise<CredentialPage>; /** * Lists CredentialInstance 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 { CredentialListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; list(params: CredentialListInstanceOptions, callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; /** * Retrieve a single page of CredentialInstance 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 { CredentialListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; page(params: CredentialListInstancePageOptions, callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListInstance(version: V1): CredentialListInstance; export declare class CredentialPage extends Page<V1, CredentialPayload, CredentialResource, CredentialInstance> { /** * Initialize the CredentialPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CredentialSolution); /** * Build an instance of CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialResource): CredentialInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v1/credential.js000064400000024202151677225100012773 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.CredentialPage = exports.CredentialListInstance = exports.CredentialInstance = exports.CredentialContextImpl = void 0; 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 CredentialContextImpl { 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/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, 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.CredentialContextImpl = CredentialContextImpl; class CredentialInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.sandbox = payload.sandbox; 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 CredentialContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, type: this.type, sandbox: this.sandbox, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialInstance = CredentialInstance; function CredentialListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Credentials`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["Type"] = params["type"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialPage(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 CredentialPage(instance._version, payload, 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; } exports.CredentialListInstance = CredentialListInstance; class CredentialPage extends Page_1.default { /** * Initialize the CredentialPage * * @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 CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialPage = CredentialPage; rest/ipMessaging/v1/service/user/userChannel.js000064400000012535151677225100015554 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.UserChannelPage = exports.UserChannelInstance = exports.UserChannelListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function UserChannelListInstance(version, serviceSid, userSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { serviceSid, userSid }; instance._uri = `/Services/${serviceSid}/Users/${userSid}/Channels`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserChannelPage(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 UserChannelPage(instance._version, payload, 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; } exports.UserChannelListInstance = UserChannelListInstance; class UserChannelInstance { constructor(_version, payload, serviceSid, userSid) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.channelSid = payload.channel_sid; this.memberSid = payload.member_sid; this.status = payload.status; this.lastConsumedMessageIndex = deserialize.integer(payload.last_consumed_message_index); this.unreadMessagesCount = deserialize.integer(payload.unread_messages_count); this.links = payload.links; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, channelSid: this.channelSid, memberSid: this.memberSid, status: this.status, lastConsumedMessageIndex: this.lastConsumedMessageIndex, unreadMessagesCount: this.unreadMessagesCount, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserChannelInstance = UserChannelInstance; class UserChannelPage extends Page_1.default { /** * Initialize the UserChannelPage * * @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 UserChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserChannelInstance(this._version, payload, this._solution.serviceSid, this._solution.userSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserChannelPage = UserChannelPage; rest/ipMessaging/v1/service/user/userChannel.d.ts000064400000014724151677225100016012 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type UserChannelChannelStatus = "joined" | "invited" | "not_participating"; /** * Options to pass to each */ export interface UserChannelListInstanceEachOptions { /** 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: UserChannelInstance, 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 UserChannelListInstanceOptions { /** 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 UserChannelListInstancePageOptions { /** 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 UserChannelSolution { serviceSid: string; userSid: string; } export interface UserChannelListInstance { _version: V1; _solution: UserChannelSolution; _uri: string; /** * Streams UserChannelInstance 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 { UserChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserChannelInstance, done: (err?: Error) => void) => void): void; each(params: UserChannelListInstanceEachOptions, callback?: (item: UserChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserChannelInstance 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: UserChannelPage) => any): Promise<UserChannelPage>; /** * Lists UserChannelInstance 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 { UserChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserChannelInstance[]) => any): Promise<UserChannelInstance[]>; list(params: UserChannelListInstanceOptions, callback?: (error: Error | null, items: UserChannelInstance[]) => any): Promise<UserChannelInstance[]>; /** * Retrieve a single page of UserChannelInstance 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 { UserChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserChannelPage) => any): Promise<UserChannelPage>; page(params: UserChannelListInstancePageOptions, callback?: (error: Error | null, items: UserChannelPage) => any): Promise<UserChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserChannelListInstance(version: V1, serviceSid: string, userSid: string): UserChannelListInstance; interface UserChannelPayload extends TwilioResponsePayload { channels: UserChannelResource[]; } interface UserChannelResource { account_sid: string; service_sid: string; channel_sid: string; member_sid: string; status: UserChannelChannelStatus; last_consumed_message_index: number; unread_messages_count: number; links: Record<string, string>; } export declare class UserChannelInstance { protected _version: V1; constructor(_version: V1, payload: UserChannelResource, serviceSid: string, userSid: string); accountSid: string; serviceSid: string; channelSid: string; memberSid: string; status: UserChannelChannelStatus; lastConsumedMessageIndex: number; unreadMessagesCount: number; links: Record<string, string>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; channelSid: string; memberSid: string; status: UserChannelChannelStatus; lastConsumedMessageIndex: number; unreadMessagesCount: number; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class UserChannelPage extends Page<V1, UserChannelPayload, UserChannelResource, UserChannelInstance> { /** * Initialize the UserChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UserChannelSolution); /** * Build an instance of UserChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: UserChannelResource): UserChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v1/service/channel.d.ts000064400000030112151677225100014162 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { InviteListInstance } from "./channel/invite"; import { MemberListInstance } from "./channel/member"; import { MessageListInstance } from "./channel/message"; export type ChannelChannelType = "public" | "private"; /** * Options to pass to update a ChannelInstance */ export interface ChannelContextUpdateOptions { /** */ friendlyName?: string; /** */ uniqueName?: string; /** */ attributes?: string; } /** * Options to pass to create a ChannelInstance */ export interface ChannelListInstanceCreateOptions { /** */ friendlyName?: string; /** */ uniqueName?: string; /** */ attributes?: string; /** */ type?: ChannelChannelType; } /** * Options to pass to each */ export interface ChannelListInstanceEachOptions { /** */ type?: Array<ChannelChannelType>; /** 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: ChannelInstance, 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 ChannelListInstanceOptions { /** */ type?: Array<ChannelChannelType>; /** 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 ChannelListInstancePageOptions { /** */ type?: Array<ChannelChannelType>; /** 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 ChannelContext { invites: InviteListInstance; members: MemberListInstance; messages: MessageListInstance; /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ChannelContextSolution { serviceSid: string; sid: string; } export declare class ChannelContextImpl implements ChannelContext { protected _version: V1; protected _solution: ChannelContextSolution; protected _uri: string; protected _invites?: InviteListInstance; protected _members?: MemberListInstance; protected _messages?: MessageListInstance; constructor(_version: V1, serviceSid: string, sid: string); get invites(): InviteListInstance; get members(): MemberListInstance; get messages(): MessageListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; update(params?: ChannelContextUpdateOptions | ((error: Error | null, item?: ChannelInstance) => any), callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ChannelPayload extends TwilioResponsePayload { channels: ChannelResource[]; } interface ChannelResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; unique_name: string; attributes: string; type: ChannelChannelType; date_created: Date; date_updated: Date; created_by: string; members_count: number; messages_count: number; url: string; links: Record<string, string>; } export declare class ChannelInstance { protected _version: V1; protected _solution: ChannelContextSolution; protected _context?: ChannelContext; constructor(_version: V1, payload: ChannelResource, serviceSid: string, sid?: string); sid: string; accountSid: string; serviceSid: string; friendlyName: string; uniqueName: string; attributes: string; type: ChannelChannelType; dateCreated: Date; dateUpdated: Date; createdBy: string; membersCount: number; messagesCount: number; url: string; links: Record<string, string>; private get _proxy(); /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Update a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ update(params: ChannelContextUpdateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Access the invites. */ invites(): InviteListInstance; /** * Access the members. */ members(): MemberListInstance; /** * Access the messages. */ messages(): MessageListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; uniqueName: string; attributes: string; type: ChannelChannelType; dateCreated: Date; dateUpdated: Date; createdBy: string; membersCount: number; messagesCount: number; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ChannelSolution { serviceSid: string; } export interface ChannelListInstance { _version: V1; _solution: ChannelSolution; _uri: string; (sid: string): ChannelContext; get(sid: string): ChannelContext; /** * Create a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ create(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Create a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ create(params: ChannelListInstanceCreateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Streams ChannelInstance 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 { ChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; each(params: ChannelListInstanceEachOptions, callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ChannelInstance 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: ChannelPage) => any): Promise<ChannelPage>; /** * Lists ChannelInstance 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 { ChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; list(params: ChannelListInstanceOptions, callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; /** * Retrieve a single page of ChannelInstance 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 { ChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; page(params: ChannelListInstancePageOptions, callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ChannelListInstance(version: V1, serviceSid: string): ChannelListInstance; export declare class ChannelPage extends Page<V1, ChannelPayload, ChannelResource, ChannelInstance> { /** * Initialize the ChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ChannelSolution); /** * Build an instance of ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: ChannelResource): ChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v1/service/channel/member.d.ts000064400000025240151677225100015437 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to update a MemberInstance */ export interface MemberContextUpdateOptions { /** */ roleSid?: string; /** */ lastConsumedMessageIndex?: number; } /** * Options to pass to create a MemberInstance */ export interface MemberListInstanceCreateOptions { /** */ identity: string; /** */ roleSid?: string; } /** * Options to pass to each */ export interface MemberListInstanceEachOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: MemberInstance, 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 MemberListInstanceOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface MemberListInstancePageOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface MemberContext { /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MemberContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class MemberContextImpl implements MemberContext { protected _version: V1; protected _solution: MemberContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; update(params?: MemberContextUpdateOptions | ((error: Error | null, item?: MemberInstance) => any), callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MemberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MemberPayload extends TwilioResponsePayload { members: MemberResource[]; } interface MemberResource { sid: string; account_sid: string; channel_sid: string; service_sid: string; identity: string; date_created: Date; date_updated: Date; role_sid: string; last_consumed_message_index: number; last_consumption_timestamp: Date; url: string; } export declare class MemberInstance { protected _version: V1; protected _solution: MemberContextSolution; protected _context?: MemberContext; constructor(_version: V1, payload: MemberResource, serviceSid: string, channelSid: string, sid?: string); sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; lastConsumedMessageIndex: number; lastConsumptionTimestamp: Date; url: string; private get _proxy(); /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; lastConsumedMessageIndex: number; lastConsumptionTimestamp: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MemberSolution { serviceSid: string; channelSid: string; } export interface MemberListInstance { _version: V1; _solution: MemberSolution; _uri: string; (sid: string): MemberContext; get(sid: string): MemberContext; /** * Create a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ create(params: MemberListInstanceCreateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Streams MemberInstance 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 { MemberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; each(params: MemberListInstanceEachOptions, callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MemberInstance 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: MemberPage) => any): Promise<MemberPage>; /** * Lists MemberInstance 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 { MemberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; list(params: MemberListInstanceOptions, callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; /** * Retrieve a single page of MemberInstance 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 { MemberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; page(params: MemberListInstancePageOptions, callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MemberListInstance(version: V1, serviceSid: string, channelSid: string): MemberListInstance; export declare class MemberPage extends Page<V1, MemberPayload, MemberResource, MemberInstance> { /** * Initialize the MemberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: MemberSolution); /** * Build an instance of MemberInstance * * @param payload - Payload response from the API */ getInstance(payload: MemberResource): MemberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v1/service/channel/message.js000064400000025405151677225100015363 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.MessagePage = exports.MessageListInstance = exports.MessageInstance = exports.MessageContextImpl = void 0; 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 MessageContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Messages/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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["body"] !== undefined) data["Body"] = params["body"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.MessageContextImpl = MessageContextImpl; class MessageInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.attributes = payload.attributes; this.serviceSid = payload.service_sid; this.to = payload.to; this.channelSid = payload.channel_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.wasEdited = payload.was_edited; this.from = payload.from; this.body = payload.body; this.index = deserialize.integer(payload.index); this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MessageContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, attributes: this.attributes, serviceSid: this.serviceSid, to: this.to, channelSid: this.channelSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, wasEdited: this.wasEdited, from: this.from, body: this.body, index: this.index, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessageInstance = MessageInstance; function MessageListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MessageContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Messages`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["body"] === null || params["body"] === undefined) { throw new Error("Required parameter \"params['body']\" missing."); } let data = {}; data["Body"] = params["body"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["order"] !== undefined) data["Order"] = params["order"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MessagePage(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 MessagePage(instance._version, payload, 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; } exports.MessageListInstance = MessageListInstance; class MessagePage extends Page_1.default { /** * Initialize the MessagePage * * @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 MessageInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MessageInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessagePage = MessagePage; rest/ipMessaging/v1/service/channel/invite.js000064400000022551151677225100015234 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.InvitePage = exports.InviteListInstance = exports.InviteInstance = exports.InviteContextImpl = void 0; 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 InviteContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Invites/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InviteInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.InviteContextImpl = InviteContextImpl; class InviteInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.channelSid = payload.channel_sid; this.serviceSid = payload.service_sid; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.roleSid = payload.role_sid; this.createdBy = payload.created_by; this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InviteContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, channelSid: this.channelSid, serviceSid: this.serviceSid, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, roleSid: this.roleSid, createdBy: this.createdBy, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InviteInstance = InviteInstance; function InviteListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InviteContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Invites`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InviteInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InvitePage(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 InvitePage(instance._version, payload, 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; } exports.InviteListInstance = InviteListInstance; class InvitePage extends Page_1.default { /** * Initialize the InvitePage * * @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 InviteInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InviteInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InvitePage = InvitePage; rest/ipMessaging/v1/service/channel/message.d.ts000064400000025510151677225100015614 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type MessageOrderType = "asc" | "desc"; /** * Options to pass to update a MessageInstance */ export interface MessageContextUpdateOptions { /** */ body?: string; /** */ attributes?: string; } /** * Options to pass to create a MessageInstance */ export interface MessageListInstanceCreateOptions { /** */ body: string; /** */ from?: string; /** */ attributes?: string; } /** * Options to pass to each */ export interface MessageListInstanceEachOptions { /** */ order?: MessageOrderType; /** 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: MessageInstance, 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 MessageListInstanceOptions { /** */ order?: MessageOrderType; /** 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 MessageListInstancePageOptions { /** */ order?: MessageOrderType; /** 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 MessageContext { /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MessageContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class MessageContextImpl implements MessageContext { protected _version: V1; protected _solution: MessageContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; update(params?: MessageContextUpdateOptions | ((error: Error | null, item?: MessageInstance) => any), callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MessageContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MessagePayload extends TwilioResponsePayload { messages: MessageResource[]; } interface MessageResource { sid: string; account_sid: string; attributes: string; service_sid: string; to: string; channel_sid: string; date_created: Date; date_updated: Date; was_edited: boolean; from: string; body: string; index: number; url: string; } export declare class MessageInstance { protected _version: V1; protected _solution: MessageContextSolution; protected _context?: MessageContext; constructor(_version: V1, payload: MessageResource, serviceSid: string, channelSid: string, sid?: string); sid: string; accountSid: string; attributes: string; serviceSid: string; to: string; channelSid: string; dateCreated: Date; dateUpdated: Date; wasEdited: boolean; from: string; body: string; index: number; url: string; private get _proxy(); /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; attributes: string; serviceSid: string; to: string; channelSid: string; dateCreated: Date; dateUpdated: Date; wasEdited: boolean; from: string; body: string; index: number; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MessageSolution { serviceSid: string; channelSid: string; } export interface MessageListInstance { _version: V1; _solution: MessageSolution; _uri: string; (sid: string): MessageContext; get(sid: string): MessageContext; /** * Create a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(params: MessageListInstanceCreateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Streams MessageInstance 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 { MessageListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; each(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MessageInstance 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: MessagePage) => any): Promise<MessagePage>; /** * Lists MessageInstance 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 { MessageListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; list(params: MessageListInstanceOptions, callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; /** * Retrieve a single page of MessageInstance 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 { MessageListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; page(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessageListInstance(version: V1, serviceSid: string, channelSid: string): MessageListInstance; export declare class MessagePage extends Page<V1, MessagePayload, MessageResource, MessageInstance> { /** * Initialize the MessagePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: MessageSolution); /** * Build an instance of MessageInstance * * @param payload - Payload response from the API */ getInstance(payload: MessageResource): MessageInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v1/service/channel/member.js000064400000025451151677225100015207 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.MemberPage = exports.MemberListInstance = exports.MemberInstance = exports.MemberContextImpl = void 0; 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 MemberContextImpl { constructor(_version, serviceSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, channelSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${channelSid}/Members/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["lastConsumedMessageIndex"] !== undefined) data["LastConsumedMessageIndex"] = params["lastConsumedMessageIndex"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid, 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.MemberContextImpl = MemberContextImpl; class MemberInstance { constructor(_version, payload, serviceSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.channelSid = payload.channel_sid; this.serviceSid = payload.service_sid; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.roleSid = payload.role_sid; this.lastConsumedMessageIndex = deserialize.integer(payload.last_consumed_message_index); this.lastConsumptionTimestamp = deserialize.iso8601DateTime(payload.last_consumption_timestamp); this.url = payload.url; this._solution = { serviceSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MemberContextImpl(this._version, this._solution.serviceSid, this._solution.channelSid, this._solution.sid); return this._context; } /** * Remove a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, channelSid: this.channelSid, serviceSid: this.serviceSid, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, roleSid: this.roleSid, lastConsumedMessageIndex: this.lastConsumedMessageIndex, lastConsumptionTimestamp: this.lastConsumptionTimestamp, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberInstance = MemberInstance; function MemberListInstance(version, serviceSid, channelSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MemberContextImpl(version, serviceSid, channelSid, sid); }; instance._version = version; instance._solution = { serviceSid, channelSid }; instance._uri = `/Services/${serviceSid}/Channels/${channelSid}/Members`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.channelSid)); 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["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MemberPage(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 MemberPage(instance._version, payload, 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; } exports.MemberListInstance = MemberListInstance; class MemberPage extends Page_1.default { /** * Initialize the MemberPage * * @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 MemberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MemberInstance(this._version, payload, this._solution.serviceSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberPage = MemberPage; rest/ipMessaging/v1/service/channel/invite.d.ts000064400000021620151677225100015464 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to create a InviteInstance */ export interface InviteListInstanceCreateOptions { /** */ identity: string; /** */ roleSid?: string; } /** * Options to pass to each */ export interface InviteListInstanceEachOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InviteInstance, 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 InviteListInstanceOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InviteListInstancePageOptions { /** */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InviteContext { /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InviteContextSolution { serviceSid: string; channelSid: string; sid: string; } export declare class InviteContextImpl implements InviteContext { protected _version: V1; protected _solution: InviteContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, channelSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InviteContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InvitePayload extends TwilioResponsePayload { invites: InviteResource[]; } interface InviteResource { sid: string; account_sid: string; channel_sid: string; service_sid: string; identity: string; date_created: Date; date_updated: Date; role_sid: string; created_by: string; url: string; } export declare class InviteInstance { protected _version: V1; protected _solution: InviteContextSolution; protected _context?: InviteContext; constructor(_version: V1, payload: InviteResource, serviceSid: string, channelSid: string, sid?: string); sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; createdBy: string; url: string; private get _proxy(); /** * Remove a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InviteInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ fetch(callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; channelSid: string; serviceSid: string; identity: string; dateCreated: Date; dateUpdated: Date; roleSid: string; createdBy: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InviteSolution { serviceSid: string; channelSid: string; } export interface InviteListInstance { _version: V1; _solution: InviteSolution; _uri: string; (sid: string): InviteContext; get(sid: string): InviteContext; /** * Create a InviteInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InviteInstance */ create(params: InviteListInstanceCreateOptions, callback?: (error: Error | null, item?: InviteInstance) => any): Promise<InviteInstance>; /** * Streams InviteInstance 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 { InviteListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InviteInstance, done: (err?: Error) => void) => void): void; each(params: InviteListInstanceEachOptions, callback?: (item: InviteInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InviteInstance 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: InvitePage) => any): Promise<InvitePage>; /** * Lists InviteInstance 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 { InviteListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InviteInstance[]) => any): Promise<InviteInstance[]>; list(params: InviteListInstanceOptions, callback?: (error: Error | null, items: InviteInstance[]) => any): Promise<InviteInstance[]>; /** * Retrieve a single page of InviteInstance 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 { InviteListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InvitePage) => any): Promise<InvitePage>; page(params: InviteListInstancePageOptions, callback?: (error: Error | null, items: InvitePage) => any): Promise<InvitePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InviteListInstance(version: V1, serviceSid: string, channelSid: string): InviteListInstance; export declare class InvitePage extends Page<V1, InvitePayload, InviteResource, InviteInstance> { /** * Initialize the InvitePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InviteSolution); /** * Build an instance of InviteInstance * * @param payload - Payload response from the API */ getInstance(payload: InviteResource): InviteInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v1/service/user.js000064400000025620151677225100013304 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.UserPage = exports.UserListInstance = exports.UserInstance = exports.UserContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const userChannel_1 = require("./user/userChannel"); class UserContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Users/${sid}`; } get userChannels() { this._userChannels = this._userChannels || (0, userChannel_1.UserChannelListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._userChannels; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid, 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["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid, 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.UserContextImpl = UserContextImpl; class UserInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.attributes = payload.attributes; this.friendlyName = payload.friendly_name; this.roleSid = payload.role_sid; this.identity = payload.identity; this.isOnline = payload.is_online; this.isNotifiable = payload.is_notifiable; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.joinedChannelsCount = deserialize.integer(payload.joined_channels_count); this.links = payload.links; this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the userChannels. */ userChannels() { return this._proxy.userChannels; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, attributes: this.attributes, friendlyName: this.friendlyName, roleSid: this.roleSid, identity: this.identity, isOnline: this.isOnline, isNotifiable: this.isNotifiable, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, joinedChannelsCount: this.joinedChannelsCount, links: this.links, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserInstance = UserInstance; function UserListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Users`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserPage(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 UserPage(instance._version, payload, 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; } exports.UserListInstance = UserListInstance; class UserPage extends Page_1.default { /** * Initialize the UserPage * * @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 UserInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserPage = UserPage; rest/ipMessaging/v1/service/role.d.ts000064400000023020151677225100013513 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type RoleRoleType = "channel" | "deployment"; /** * Options to pass to update a RoleInstance */ export interface RoleContextUpdateOptions { /** */ permission: Array<string>; } /** * Options to pass to create a RoleInstance */ export interface RoleListInstanceCreateOptions { /** */ friendlyName: string; /** */ type: RoleRoleType; /** */ permission: Array<string>; } /** * Options to pass to each */ export interface RoleListInstanceEachOptions { /** 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: RoleInstance, 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 RoleListInstanceOptions { /** 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 RoleListInstancePageOptions { /** 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 RoleContext { /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RoleContextSolution { serviceSid: string; sid: string; } export declare class RoleContextImpl implements RoleContext { protected _version: V1; protected _solution: RoleContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RoleContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RolePayload extends TwilioResponsePayload { roles: RoleResource[]; } interface RoleResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; type: RoleRoleType; permissions: Array<string>; date_created: Date; date_updated: Date; url: string; } export declare class RoleInstance { protected _version: V1; protected _solution: RoleContextSolution; protected _context?: RoleContext; constructor(_version: V1, payload: RoleResource, serviceSid: string, sid?: string); sid: string; accountSid: string; serviceSid: string; friendlyName: string; type: RoleRoleType; permissions: Array<string>; dateCreated: Date; dateUpdated: Date; url: string; private get _proxy(); /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; type: RoleRoleType; permissions: string[]; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RoleSolution { serviceSid: string; } export interface RoleListInstance { _version: V1; _solution: RoleSolution; _uri: string; (sid: string): RoleContext; get(sid: string): RoleContext; /** * Create a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ create(params: RoleListInstanceCreateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Streams RoleInstance 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 { RoleListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; each(params: RoleListInstanceEachOptions, callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RoleInstance 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: RolePage) => any): Promise<RolePage>; /** * Lists RoleInstance 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 { RoleListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; list(params: RoleListInstanceOptions, callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; /** * Retrieve a single page of RoleInstance 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 { RoleListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; page(params: RoleListInstancePageOptions, callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RoleListInstance(version: V1, serviceSid: string): RoleListInstance; export declare class RolePage extends Page<V1, RolePayload, RoleResource, RoleInstance> { /** * Initialize the RolePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RoleSolution); /** * Build an instance of RoleInstance * * @param payload - Payload response from the API */ getInstance(payload: RoleResource): RoleInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v1/service/user.d.ts000064400000025527151677225100013546 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { UserChannelListInstance } from "./user/userChannel"; /** * Options to pass to update a UserInstance */ export interface UserContextUpdateOptions { /** */ roleSid?: string; /** */ attributes?: string; /** */ friendlyName?: string; } /** * Options to pass to create a UserInstance */ export interface UserListInstanceCreateOptions { /** */ identity: string; /** */ roleSid?: string; /** */ attributes?: string; /** */ friendlyName?: string; } /** * Options to pass to each */ export interface UserListInstanceEachOptions { /** 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: UserInstance, 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 UserListInstanceOptions { /** 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 UserListInstancePageOptions { /** 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 UserContext { userChannels: UserChannelListInstance; /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserContextSolution { serviceSid: string; sid: string; } export declare class UserContextImpl implements UserContext { protected _version: V1; protected _solution: UserContextSolution; protected _uri: string; protected _userChannels?: UserChannelListInstance; constructor(_version: V1, serviceSid: string, sid: string); get userChannels(): UserChannelListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; update(params?: UserContextUpdateOptions | ((error: Error | null, item?: UserInstance) => any), callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserPayload extends TwilioResponsePayload { users: UserResource[]; } interface UserResource { sid: string; account_sid: string; service_sid: string; attributes: string; friendly_name: string; role_sid: string; identity: string; is_online: boolean; is_notifiable: boolean; date_created: Date; date_updated: Date; joined_channels_count: number; links: Record<string, string>; url: string; } export declare class UserInstance { protected _version: V1; protected _solution: UserContextSolution; protected _context?: UserContext; constructor(_version: V1, payload: UserResource, serviceSid: string, sid?: string); sid: string; accountSid: string; serviceSid: string; attributes: string; friendlyName: string; roleSid: string; identity: string; isOnline: boolean; isNotifiable: boolean; dateCreated: Date; dateUpdated: Date; joinedChannelsCount: number; links: Record<string, string>; url: string; private get _proxy(); /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Access the userChannels. */ userChannels(): UserChannelListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; attributes: string; friendlyName: string; roleSid: string; identity: string; isOnline: boolean; isNotifiable: boolean; dateCreated: Date; dateUpdated: Date; joinedChannelsCount: number; links: Record<string, string>; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserSolution { serviceSid: string; } export interface UserListInstance { _version: V1; _solution: UserSolution; _uri: string; (sid: string): UserContext; get(sid: string): UserContext; /** * Create a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ create(params: UserListInstanceCreateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Streams UserInstance 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 { UserListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; each(params: UserListInstanceEachOptions, callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserInstance 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: UserPage) => any): Promise<UserPage>; /** * Lists UserInstance 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 { UserListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; list(params: UserListInstanceOptions, callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; /** * Retrieve a single page of UserInstance 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 { UserListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; page(params: UserListInstancePageOptions, callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserListInstance(version: V1, serviceSid: string): UserListInstance; export declare class UserPage extends Page<V1, UserPayload, UserResource, UserInstance> { /** * Initialize the UserPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UserSolution); /** * Build an instance of UserInstance * * @param payload - Payload response from the API */ getInstance(payload: UserResource): UserInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/ipMessaging/v1/service/channel.js000064400000027274151677225100013745 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.ChannelPage = exports.ChannelListInstance = exports.ChannelInstance = exports.ChannelContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const invite_1 = require("./channel/invite"); const member_1 = require("./channel/member"); const message_1 = require("./channel/message"); class ChannelContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Channels/${sid}`; } get invites() { this._invites = this._invites || (0, invite_1.InviteListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._invites; } get members() { this._members = this._members || (0, member_1.MemberListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._members; } get messages() { this._messages = this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._messages; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid, 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.ChannelContextImpl = ChannelContextImpl; class ChannelInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.attributes = payload.attributes; this.type = payload.type; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this.membersCount = deserialize.integer(payload.members_count); this.messagesCount = deserialize.integer(payload.messages_count); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ChannelContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the invites. */ invites() { return this._proxy.invites; } /** * Access the members. */ members() { return this._proxy.members; } /** * Access the messages. */ messages() { return this._proxy.messages; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, uniqueName: this.uniqueName, attributes: this.attributes, type: this.type, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, membersCount: this.membersCount, messagesCount: this.messagesCount, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelInstance = ChannelInstance; function ChannelListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ChannelContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Channels`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["type"] !== undefined) data["Type"] = params["type"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, instance._solution.serviceSid)); 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["type"] !== undefined) data["Type"] = serialize.map(params["type"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelPage(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 ChannelPage(instance._version, payload, 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; } exports.ChannelListInstance = ChannelListInstance; class ChannelPage extends Page_1.default { /** * Initialize the ChannelPage * * @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 ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ChannelInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelPage = ChannelPage; rest/ipMessaging/v1/service/role.js000064400000024154151677225100013270 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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.RolePage = exports.RoleListInstance = exports.RoleInstance = exports.RoleContextImpl = void 0; 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 RoleContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Roles/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid, 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.RoleContextImpl = RoleContextImpl; class RoleInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.permissions = payload.permissions; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RoleContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, type: this.type, permissions: this.permissions, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoleInstance = RoleInstance; function RoleListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RoleContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Roles`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RolePage(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 RolePage(instance._version, payload, 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; } exports.RoleListInstance = RoleListInstance; class RolePage extends Page_1.default { /** * Initialize the RolePage * * @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 RoleInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RoleInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RolePage = RolePage; rest/ipMessaging/V1.js000064400000002753151677225100010630 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Ip_messaging * 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 credential_1 = require("./v1/credential"); const service_1 = require("./v1/service"); class V1 extends Version_1.default { /** * Initialize the V1 version of IpMessaging * * @param domain - The Twilio (Twilio.IpMessaging) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for credentials resource */ get credentials() { this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this); return this._credentials; } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } } exports.default = V1; rest/TaskrouterBase.js000064400000002064151677225100011025 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./taskrouter/V1")); class TaskrouterBase extends Domain_1.default { /** * Initialize taskrouter domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://taskrouter.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = TaskrouterBase; rest/lookups/V2.d.ts000064400000001104151677225100010300 0ustar00import LookupsBase from "../LookupsBase"; import Version from "../../base/Version"; import { PhoneNumberListInstance } from "./v2/phoneNumber"; export default class V2 extends Version { /** * Initialize the V2 version of Lookups * * @param domain - The Twilio (Twilio.Lookups) domain */ constructor(domain: LookupsBase); /** phoneNumbers - { Twilio.Lookups.V2.PhoneNumberListInstance } resource */ protected _phoneNumbers?: PhoneNumberListInstance; /** Getter for phoneNumbers resource */ get phoneNumbers(): PhoneNumberListInstance; } rest/lookups/V1.d.ts000064400000001104151677225100010277 0ustar00import LookupsBase from "../LookupsBase"; import Version from "../../base/Version"; import { PhoneNumberListInstance } from "./v1/phoneNumber"; export default class V1 extends Version { /** * Initialize the V1 version of Lookups * * @param domain - The Twilio (Twilio.Lookups) domain */ constructor(domain: LookupsBase); /** phoneNumbers - { Twilio.Lookups.V1.PhoneNumberListInstance } resource */ protected _phoneNumbers?: PhoneNumberListInstance; /** Getter for phoneNumbers resource */ get phoneNumbers(): PhoneNumberListInstance; } rest/lookups/V2.js000064400000002405151677225100010051 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const phoneNumber_1 = require("./v2/phoneNumber"); class V2 extends Version_1.default { /** * Initialize the V2 version of Lookups * * @param domain - The Twilio (Twilio.Lookups) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for phoneNumbers resource */ get phoneNumbers() { this._phoneNumbers = this._phoneNumbers || (0, phoneNumber_1.PhoneNumberListInstance)(this); return this._phoneNumbers; } } exports.default = V2; rest/lookups/v2/phoneNumber.js000064400000015302151677225100012373 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PhoneNumberListInstance = exports.PhoneNumberInstance = exports.PhoneNumberContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PhoneNumberContextImpl { constructor(_version, phoneNumber) { this._version = _version; if (!(0, utility_1.isValidPathParam)(phoneNumber)) { throw new Error("Parameter 'phoneNumber' is not valid."); } this._solution = { phoneNumber }; this._uri = `/PhoneNumbers/${phoneNumber}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["fields"] !== undefined) data["Fields"] = params["fields"]; if (params["countryCode"] !== undefined) data["CountryCode"] = params["countryCode"]; if (params["firstName"] !== undefined) data["FirstName"] = params["firstName"]; if (params["lastName"] !== undefined) data["LastName"] = params["lastName"]; if (params["addressLine1"] !== undefined) data["AddressLine1"] = params["addressLine1"]; if (params["addressLine2"] !== undefined) data["AddressLine2"] = params["addressLine2"]; if (params["city"] !== undefined) data["City"] = params["city"]; if (params["state"] !== undefined) data["State"] = params["state"]; if (params["postalCode"] !== undefined) data["PostalCode"] = params["postalCode"]; if (params["addressCountryCode"] !== undefined) data["AddressCountryCode"] = params["addressCountryCode"]; if (params["nationalId"] !== undefined) data["NationalId"] = params["nationalId"]; if (params["dateOfBirth"] !== undefined) data["DateOfBirth"] = params["dateOfBirth"]; if (params["lastVerifiedDate"] !== undefined) data["LastVerifiedDate"] = params["lastVerifiedDate"]; if (params["verificationSid"] !== undefined) data["VerificationSid"] = params["verificationSid"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.phoneNumber)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberContextImpl = PhoneNumberContextImpl; class PhoneNumberInstance { constructor(_version, payload, phoneNumber) { this._version = _version; this.callingCountryCode = payload.calling_country_code; this.countryCode = payload.country_code; this.phoneNumber = payload.phone_number; this.nationalFormat = payload.national_format; this.valid = payload.valid; this.validationErrors = payload.validation_errors; this.callerName = payload.caller_name; this.simSwap = payload.sim_swap; this.callForwarding = payload.call_forwarding; this.lineStatus = payload.line_status; this.lineTypeIntelligence = payload.line_type_intelligence; this.identityMatch = payload.identity_match; this.reassignedNumber = payload.reassigned_number; this.smsPumpingRisk = payload.sms_pumping_risk; this.phoneNumberQualityScore = payload.phone_number_quality_score; this.preFill = payload.pre_fill; this.url = payload.url; this._solution = { phoneNumber: phoneNumber || this.phoneNumber }; } get _proxy() { this._context = this._context || new PhoneNumberContextImpl(this._version, this._solution.phoneNumber); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { callingCountryCode: this.callingCountryCode, countryCode: this.countryCode, phoneNumber: this.phoneNumber, nationalFormat: this.nationalFormat, valid: this.valid, validationErrors: this.validationErrors, callerName: this.callerName, simSwap: this.simSwap, callForwarding: this.callForwarding, lineStatus: this.lineStatus, lineTypeIntelligence: this.lineTypeIntelligence, identityMatch: this.identityMatch, reassignedNumber: this.reassignedNumber, smsPumpingRisk: this.smsPumpingRisk, phoneNumberQualityScore: this.phoneNumberQualityScore, preFill: this.preFill, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberInstance = PhoneNumberInstance; function PhoneNumberListInstance(version) { const instance = ((phoneNumber) => instance.get(phoneNumber)); instance.get = function get(phoneNumber) { return new PhoneNumberContextImpl(version, phoneNumber); }; instance._version = version; instance._solution = {}; instance._uri = ``; instance.toJSON = function toJSON() { return instance._solution; }; instance[util_1.inspect.custom] = function inspectImpl(_depth, options) { return (0, util_1.inspect)(instance.toJSON(), options); }; return instance; } exports.PhoneNumberListInstance = PhoneNumberListInstance; rest/lookups/v2/phoneNumber.d.ts000064400000023745151677225100012641 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; export type PhoneNumberValidationError = "TOO_SHORT" | "TOO_LONG" | "INVALID_BUT_POSSIBLE" | "INVALID_COUNTRY_CODE" | "INVALID_LENGTH" | "NOT_A_NUMBER"; /** * Options to pass to fetch a PhoneNumberInstance */ export interface PhoneNumberContextFetchOptions { /** A comma-separated list of fields to return. Possible values are validation, caller_name, sim_swap, call_forwarding, line_status, line_type_intelligence, identity_match, reassigned_number, sms_pumping_risk, phone_number_quality_score, pre_fill. */ fields?: string; /** The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. */ countryCode?: string; /** User’s first name. This query parameter is only used (optionally) for identity_match package requests. */ firstName?: string; /** User’s last name. This query parameter is only used (optionally) for identity_match package requests. */ lastName?: string; /** User’s first address line. This query parameter is only used (optionally) for identity_match package requests. */ addressLine1?: string; /** User’s second address line. This query parameter is only used (optionally) for identity_match package requests. */ addressLine2?: string; /** User’s city. This query parameter is only used (optionally) for identity_match package requests. */ city?: string; /** User’s country subdivision, such as state, province, or locality. This query parameter is only used (optionally) for identity_match package requests. */ state?: string; /** User’s postal zip code. This query parameter is only used (optionally) for identity_match package requests. */ postalCode?: string; /** User’s country, up to two characters. This query parameter is only used (optionally) for identity_match package requests. */ addressCountryCode?: string; /** User’s national ID, such as SSN or Passport ID. This query parameter is only used (optionally) for identity_match package requests. */ nationalId?: string; /** User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. */ dateOfBirth?: string; /** The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. */ lastVerifiedDate?: string; /** The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. */ verificationSid?: string; } export interface PhoneNumberContext { /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Fetch a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PhoneNumberContextSolution { phoneNumber: string; } export declare class PhoneNumberContextImpl implements PhoneNumberContext { protected _version: V2; protected _solution: PhoneNumberContextSolution; protected _uri: string; constructor(_version: V2, phoneNumber: string); fetch(params?: PhoneNumberContextFetchOptions | ((error: Error | null, item?: PhoneNumberInstance) => any), callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PhoneNumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PhoneNumberResource { calling_country_code: string; country_code: string; phone_number: string; national_format: string; valid: boolean; validation_errors: Array<PhoneNumberValidationError>; caller_name: any; sim_swap: any; call_forwarding: any; line_status: any; line_type_intelligence: any; identity_match: any; reassigned_number: any; sms_pumping_risk: any; phone_number_quality_score: any; pre_fill: any; url: string; } export declare class PhoneNumberInstance { protected _version: V2; protected _solution: PhoneNumberContextSolution; protected _context?: PhoneNumberContext; constructor(_version: V2, payload: PhoneNumberResource, phoneNumber?: string); /** * International dialing prefix of the phone number defined in the E.164 standard. */ callingCountryCode: string; /** * The phone number\'s [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). */ countryCode: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The phone number in [national format](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers). */ nationalFormat: string; /** * Boolean which indicates if the phone number is in a valid range that can be freely assigned by a carrier to a user. */ valid: boolean; /** * Contains reasons why a phone number is invalid. Possible values: TOO_SHORT, TOO_LONG, INVALID_BUT_POSSIBLE, INVALID_COUNTRY_CODE, INVALID_LENGTH, NOT_A_NUMBER. */ validationErrors: Array<PhoneNumberValidationError>; /** * An object that contains caller name information based on [CNAM](https://support.twilio.com/hc/en-us/articles/360051670533-Getting-Started-with-CNAM-Caller-ID). */ callerName: any; /** * An object that contains information on the last date the subscriber identity module (SIM) was changed for a mobile phone number. */ simSwap: any; /** * An object that contains information on the unconditional call forwarding status of mobile phone number. */ callForwarding: any; /** * An object that contains line status information for a mobile phone number. */ lineStatus: any; /** * An object that contains line type information including the carrier name, mobile country code, and mobile network code. */ lineTypeIntelligence: any; /** * An object that contains identity match information. The result of comparing user-provided information including name, address, date of birth, national ID, against authoritative phone-based data sources */ identityMatch: any; /** * An object that contains reassigned number information. Reassigned Numbers will return a phone number\'s reassignment status given a phone number and date */ reassignedNumber: any; /** * An object that contains information on if a phone number has been currently or previously blocked by Verify Fraud Guard for receiving malicious SMS pumping traffic as well as other signals associated with risky carriers and low conversion rates. */ smsPumpingRisk: any; /** * An object that contains information of a mobile phone number quality score. Quality score will return a risk score about the phone number. */ phoneNumberQualityScore: any; /** * An object that contains pre fill information. pre_fill will return PII information associated with the phone number like first name, last name, address line, country code, state and postal code. */ preFill: any; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Fetch a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { callingCountryCode: string; countryCode: string; phoneNumber: string; nationalFormat: string; valid: boolean; validationErrors: PhoneNumberValidationError[]; callerName: any; simSwap: any; callForwarding: any; lineStatus: any; lineTypeIntelligence: any; identityMatch: any; reassignedNumber: any; smsPumpingRisk: any; phoneNumberQualityScore: any; preFill: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PhoneNumberSolution { } export interface PhoneNumberListInstance { _version: V2; _solution: PhoneNumberSolution; _uri: string; (phoneNumber: string): PhoneNumberContext; get(phoneNumber: string): PhoneNumberContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PhoneNumberListInstance(version: V2): PhoneNumberListInstance; export {}; rest/lookups/v1/phoneNumber.js000064400000011334151677225100012373 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PhoneNumberListInstance = exports.PhoneNumberInstance = exports.PhoneNumberContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PhoneNumberContextImpl { constructor(_version, phoneNumber) { this._version = _version; if (!(0, utility_1.isValidPathParam)(phoneNumber)) { throw new Error("Parameter 'phoneNumber' is not valid."); } this._solution = { phoneNumber }; this._uri = `/PhoneNumbers/${phoneNumber}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["countryCode"] !== undefined) data["CountryCode"] = params["countryCode"]; if (params["type"] !== undefined) data["Type"] = serialize.map(params["type"], (e) => e); if (params["addOns"] !== undefined) data["AddOns"] = serialize.map(params["addOns"], (e) => e); if (params["addOnsData"] !== undefined) data = { ...data, ...serialize.prefixedCollapsibleMap(params["addOnsData"], "AddOns"), }; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.phoneNumber)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberContextImpl = PhoneNumberContextImpl; class PhoneNumberInstance { constructor(_version, payload, phoneNumber) { this._version = _version; this.callerName = payload.caller_name; this.countryCode = payload.country_code; this.phoneNumber = payload.phone_number; this.nationalFormat = payload.national_format; this.carrier = payload.carrier; this.addOns = payload.add_ons; this.url = payload.url; this._solution = { phoneNumber: phoneNumber || this.phoneNumber }; } get _proxy() { this._context = this._context || new PhoneNumberContextImpl(this._version, this._solution.phoneNumber); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { callerName: this.callerName, countryCode: this.countryCode, phoneNumber: this.phoneNumber, nationalFormat: this.nationalFormat, carrier: this.carrier, addOns: this.addOns, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberInstance = PhoneNumberInstance; function PhoneNumberListInstance(version) { const instance = ((phoneNumber) => instance.get(phoneNumber)); instance.get = function get(phoneNumber) { return new PhoneNumberContextImpl(version, phoneNumber); }; instance._version = version; instance._solution = {}; instance._uri = ``; instance.toJSON = function toJSON() { return instance._solution; }; instance[util_1.inspect.custom] = function inspectImpl(_depth, options) { return (0, util_1.inspect)(instance.toJSON(), options); }; return instance; } exports.PhoneNumberListInstance = PhoneNumberListInstance; rest/lookups/v1/phoneNumber.d.ts000064400000013463151677225100012634 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to fetch a PhoneNumberInstance */ export interface PhoneNumberContextFetchOptions { /** The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format. */ countryCode?: string; /** The type of information to return. Can be: `carrier` or `caller-name`. The default is null. Carrier information costs $0.005 per phone number looked up. Caller Name information is currently available only in the US and costs $0.01 per phone number looked up. To retrieve both types on information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. */ type?: Array<string>; /** The `unique_name` of an Add-on you would like to invoke. Can be the `unique_name` of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the [Add-ons documentation](https://www.twilio.com/docs/add-ons). */ addOns?: Array<string>; /** Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on. */ addOnsData?: Record<string, object>; } export interface PhoneNumberContext { /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Fetch a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PhoneNumberContextSolution { phoneNumber: string; } export declare class PhoneNumberContextImpl implements PhoneNumberContext { protected _version: V1; protected _solution: PhoneNumberContextSolution; protected _uri: string; constructor(_version: V1, phoneNumber: string); fetch(params?: PhoneNumberContextFetchOptions | ((error: Error | null, item?: PhoneNumberInstance) => any), callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PhoneNumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PhoneNumberResource { caller_name: any; country_code: string; phone_number: string; national_format: string; carrier: any; add_ons: any; url: string; } export declare class PhoneNumberInstance { protected _version: V1; protected _solution: PhoneNumberContextSolution; protected _context?: PhoneNumberContext; constructor(_version: V1, payload: PhoneNumberResource, phoneNumber?: string); /** * The name of the phone number\'s owner. If `null`, that information was not available. */ callerName: any; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) for the phone number. */ countryCode: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The phone number, in national format. */ nationalFormat: string; /** * The telecom company that provides the phone number. */ carrier: any; /** * A JSON string with the results of the Add-ons you specified in the `add_ons` parameters. For the format of the object, see [Using Add-ons](https://www.twilio.com/docs/add-ons). */ addOns: any; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Fetch a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(params: PhoneNumberContextFetchOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { callerName: any; countryCode: string; phoneNumber: string; nationalFormat: string; carrier: any; addOns: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PhoneNumberSolution { } export interface PhoneNumberListInstance { _version: V1; _solution: PhoneNumberSolution; _uri: string; (phoneNumber: string): PhoneNumberContext; get(phoneNumber: string): PhoneNumberContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PhoneNumberListInstance(version: V1): PhoneNumberListInstance; export {}; rest/lookups/V1.js000064400000002405151677225100010050 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const phoneNumber_1 = require("./v1/phoneNumber"); class V1 extends Version_1.default { /** * Initialize the V1 version of Lookups * * @param domain - The Twilio (Twilio.Lookups) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for phoneNumbers resource */ get phoneNumbers() { this._phoneNumbers = this._phoneNumbers || (0, phoneNumber_1.PhoneNumberListInstance)(this); return this._phoneNumbers; } } exports.default = V1; rest/Lookups.js000064400000000773151677225100007530 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const LookupsBase_1 = __importDefault(require("./LookupsBase")); class Lookups extends LookupsBase_1.default { /** * @deprecated - Use v1.phoneNumbers instead */ get phoneNumbers() { console.warn("phoneNumbers is deprecated. Use v1.phoneNumbers instead."); return this.v1.phoneNumbers; } } module.exports = Lookups; rest/supersim/V1.d.ts000064400000005411151677225100010457 0ustar00import SupersimBase from "../SupersimBase"; import Version from "../../base/Version"; import { EsimProfileListInstance } from "./v1/esimProfile"; import { FleetListInstance } from "./v1/fleet"; import { IpCommandListInstance } from "./v1/ipCommand"; import { NetworkListInstance } from "./v1/network"; import { NetworkAccessProfileListInstance } from "./v1/networkAccessProfile"; import { SettingsUpdateListInstance } from "./v1/settingsUpdate"; import { SimListInstance } from "./v1/sim"; import { SmsCommandListInstance } from "./v1/smsCommand"; import { UsageRecordListInstance } from "./v1/usageRecord"; export default class V1 extends Version { /** * Initialize the V1 version of Supersim * * @param domain - The Twilio (Twilio.Supersim) domain */ constructor(domain: SupersimBase); /** esimProfiles - { Twilio.Supersim.V1.EsimProfileListInstance } resource */ protected _esimProfiles?: EsimProfileListInstance; /** fleets - { Twilio.Supersim.V1.FleetListInstance } resource */ protected _fleets?: FleetListInstance; /** ipCommands - { Twilio.Supersim.V1.IpCommandListInstance } resource */ protected _ipCommands?: IpCommandListInstance; /** networks - { Twilio.Supersim.V1.NetworkListInstance } resource */ protected _networks?: NetworkListInstance; /** networkAccessProfiles - { Twilio.Supersim.V1.NetworkAccessProfileListInstance } resource */ protected _networkAccessProfiles?: NetworkAccessProfileListInstance; /** settingsUpdates - { Twilio.Supersim.V1.SettingsUpdateListInstance } resource */ protected _settingsUpdates?: SettingsUpdateListInstance; /** sims - { Twilio.Supersim.V1.SimListInstance } resource */ protected _sims?: SimListInstance; /** smsCommands - { Twilio.Supersim.V1.SmsCommandListInstance } resource */ protected _smsCommands?: SmsCommandListInstance; /** usageRecords - { Twilio.Supersim.V1.UsageRecordListInstance } resource */ protected _usageRecords?: UsageRecordListInstance; /** Getter for esimProfiles resource */ get esimProfiles(): EsimProfileListInstance; /** Getter for fleets resource */ get fleets(): FleetListInstance; /** Getter for ipCommands resource */ get ipCommands(): IpCommandListInstance; /** Getter for networks resource */ get networks(): NetworkListInstance; /** Getter for networkAccessProfiles resource */ get networkAccessProfiles(): NetworkAccessProfileListInstance; /** Getter for settingsUpdates resource */ get settingsUpdates(): SettingsUpdateListInstance; /** Getter for sims resource */ get sims(): SimListInstance; /** Getter for smsCommands resource */ get smsCommands(): SmsCommandListInstance; /** Getter for usageRecords resource */ get usageRecords(): UsageRecordListInstance; } rest/supersim/v1/sim.js000064400000024277151677225100011066 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimPage = exports.SimListInstance = exports.SimInstance = exports.SimContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const billingPeriod_1 = require("./sim/billingPeriod"); const simIpAddress_1 = require("./sim/simIpAddress"); class SimContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/Sims/${sid}`; } get billingPeriods() { this._billingPeriods = this._billingPeriods || (0, billingPeriod_1.BillingPeriodListInstance)(this._version, this._solution.sid); return this._billingPeriods; } get simIpAddresses() { this._simIpAddresses = this._simIpAddresses || (0, simIpAddress_1.SimIpAddressListInstance)(this._version, this._solution.sid); return this._simIpAddresses; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SimInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["fleet"] !== undefined) data["Fleet"] = params["fleet"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; if (params["accountSid"] !== undefined) data["AccountSid"] = params["accountSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SimInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimContextImpl = SimContextImpl; class SimInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.iccid = payload.iccid; this.status = payload.status; this.fleetSid = payload.fleet_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SimContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the billingPeriods. */ billingPeriods() { return this._proxy.billingPeriods; } /** * Access the simIpAddresses. */ simIpAddresses() { return this._proxy.simIpAddresses; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, iccid: this.iccid, status: this.status, fleetSid: this.fleetSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimInstance = SimInstance; function SimListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SimContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Sims`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["iccid"] === null || params["iccid"] === undefined) { throw new Error("Required parameter \"params['iccid']\" missing."); } if (params["registrationCode"] === null || params["registrationCode"] === undefined) { throw new Error("Required parameter \"params['registrationCode']\" missing."); } let data = {}; data["Iccid"] = params["iccid"]; data["RegistrationCode"] = params["registrationCode"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SimInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["fleet"] !== undefined) data["Fleet"] = params["fleet"]; if (params["iccid"] !== undefined) data["Iccid"] = params["iccid"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SimPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new SimPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.SimListInstance = SimListInstance; class SimPage extends Page_1.default { /** * Initialize the SimPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of SimInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SimInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimPage = SimPage; rest/supersim/v1/network.d.ts000064400000021717151677225100012217 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface NetworkListInstanceEachOptions { /** The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read. */ isoCountry?: string; /** The \'mobile country code\' of a country. Network resources with this `mcc` in their `identifiers` will be read. */ mcc?: string; /** The \'mobile network code\' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read. */ mnc?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: NetworkInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface NetworkListInstanceOptions { /** The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read. */ isoCountry?: string; /** The \'mobile country code\' of a country. Network resources with this `mcc` in their `identifiers` will be read. */ mcc?: string; /** The \'mobile network code\' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read. */ mnc?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface NetworkListInstancePageOptions { /** The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read. */ isoCountry?: string; /** The \'mobile country code\' of a country. Network resources with this `mcc` in their `identifiers` will be read. */ mcc?: string; /** The \'mobile network code\' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read. */ mnc?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface NetworkContext { /** * Fetch a NetworkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkInstance */ fetch(callback?: (error: Error | null, item?: NetworkInstance) => any): Promise<NetworkInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface NetworkContextSolution { sid: string; } export declare class NetworkContextImpl implements NetworkContext { protected _version: V1; protected _solution: NetworkContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: NetworkInstance) => any): Promise<NetworkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): NetworkContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface NetworkPayload extends TwilioResponsePayload { networks: NetworkResource[]; } interface NetworkResource { sid: string; friendly_name: string; url: string; iso_country: string; identifiers: Array<any>; } export declare class NetworkInstance { protected _version: V1; protected _solution: NetworkContextSolution; protected _context?: NetworkContext; constructor(_version: V1, payload: NetworkResource, sid?: string); /** * The unique string that we created to identify the Network resource. */ sid: string; /** * A human readable identifier of this resource. */ friendlyName: string; /** * The absolute URL of the Network resource. */ url: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. */ isoCountry: string; /** * Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. */ identifiers: Array<any>; private get _proxy(); /** * Fetch a NetworkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkInstance */ fetch(callback?: (error: Error | null, item?: NetworkInstance) => any): Promise<NetworkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; url: string; isoCountry: string; identifiers: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface NetworkSolution { } export interface NetworkListInstance { _version: V1; _solution: NetworkSolution; _uri: string; (sid: string): NetworkContext; get(sid: string): NetworkContext; /** * Streams NetworkInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { NetworkListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: NetworkInstance, done: (err?: Error) => void) => void): void; each(params: NetworkListInstanceEachOptions, callback?: (item: NetworkInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of NetworkInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: NetworkPage) => any): Promise<NetworkPage>; /** * Lists NetworkInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { NetworkListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: NetworkInstance[]) => any): Promise<NetworkInstance[]>; list(params: NetworkListInstanceOptions, callback?: (error: Error | null, items: NetworkInstance[]) => any): Promise<NetworkInstance[]>; /** * Retrieve a single page of NetworkInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { NetworkListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: NetworkPage) => any): Promise<NetworkPage>; page(params: NetworkListInstancePageOptions, callback?: (error: Error | null, items: NetworkPage) => any): Promise<NetworkPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NetworkListInstance(version: V1): NetworkListInstance; export declare class NetworkPage extends Page<V1, NetworkPayload, NetworkResource, NetworkInstance> { /** * Initialize the NetworkPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: NetworkSolution); /** * Build an instance of NetworkInstance * * @param payload - Payload response from the API */ getInstance(payload: NetworkResource): NetworkInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/usageRecord.d.ts000064400000032367151677225100012774 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type UsageRecordGranularity = "hour" | "day" | "all"; export type UsageRecordGroup = "sim" | "fleet" | "network" | "isoCountry"; /** * Options to pass to each */ export interface UsageRecordListInstanceEachOptions { /** SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. */ sim?: string; /** SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. */ fleet?: string; /** SID of a Network resource. Only show UsageRecords representing usage on this network. */ network?: string; /** Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. */ isoCountry?: string; /** Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. */ group?: UsageRecordGroup; /** Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. */ granularity?: UsageRecordGranularity; /** Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. */ startTime?: Date; /** Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. */ endTime?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface UsageRecordListInstanceOptions { /** SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. */ sim?: string; /** SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. */ fleet?: string; /** SID of a Network resource. Only show UsageRecords representing usage on this network. */ network?: string; /** Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. */ isoCountry?: string; /** Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. */ group?: UsageRecordGroup; /** Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. */ granularity?: UsageRecordGranularity; /** Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. */ startTime?: Date; /** Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. */ endTime?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface UsageRecordListInstancePageOptions { /** SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. */ sim?: string; /** SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. */ fleet?: string; /** SID of a Network resource. Only show UsageRecords representing usage on this network. */ network?: string; /** Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. */ isoCountry?: string; /** Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. */ group?: UsageRecordGroup; /** Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. */ granularity?: UsageRecordGranularity; /** Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. */ startTime?: Date; /** Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. */ endTime?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface UsageRecordSolution { } export interface UsageRecordListInstance { _version: V1; _solution: UsageRecordSolution; _uri: string; /** * Streams UsageRecordInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { UsageRecordListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void; each(params: UsageRecordListInstanceEachOptions, callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UsageRecordInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>; /** * Lists UsageRecordInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { UsageRecordListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UsageRecordInstance[]) => any): Promise<UsageRecordInstance[]>; list(params: UsageRecordListInstanceOptions, callback?: (error: Error | null, items: UsageRecordInstance[]) => any): Promise<UsageRecordInstance[]>; /** * Retrieve a single page of UsageRecordInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { UsageRecordListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>; page(params: UsageRecordListInstancePageOptions, callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UsageRecordListInstance(version: V1): UsageRecordListInstance; interface UsageRecordPayload extends TwilioResponsePayload { usage_records: UsageRecordResource[]; } interface UsageRecordResource { account_sid: string; sim_sid: string; network_sid: string; fleet_sid: string; iso_country: string; period: any; data_upload: number; data_download: number; data_total: number; data_total_billed: number; billed_unit: string; } export declare class UsageRecordInstance { protected _version: V1; constructor(_version: V1, payload: UsageRecordResource); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that incurred the usage. */ accountSid: string; /** * SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the `Sim` query parameter is provided or when UsageRecords are grouped by `sim`. Otherwise, the value will be `null`. */ simSid: string; /** * SID of the Network resource the usage occurred on. Value will only be present when either a value for the `Network` query parameter is provided or when UsageRecords are grouped by `network`. Otherwise, the value will be `null`. */ networkSid: string; /** * SID of the Fleet resource the usage occurred on. Value will only be present when either a value for the `Fleet` query parameter is provided or when UsageRecords are grouped by `fleet`. Otherwise, the value will be `null`. */ fleetSid: string; /** * Alpha-2 ISO Country Code that the usage occurred in. Value will only be present when either a value for the `IsoCountry` query parameter is provided or when UsageRecords are grouped by `isoCountry`. Otherwise, the value will be `null`. */ isoCountry: string; /** * The time period for which the usage is reported. The period is represented as a pair of `start_time` and `end_time` timestamps specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ period: any; /** * Total data uploaded in bytes, aggregated by the query parameters. */ dataUpload: number; /** * Total data downloaded in bytes, aggregated by the query parameters. */ dataDownload: number; /** * Total of data_upload and data_download. */ dataTotal: number; /** * Total amount in the `billed_unit` that was charged for the data uploaded or downloaded. Will return 0 for usage prior to February 1, 2022. Value may be 0 despite `data_total` being greater than 0 if the data usage is still being processed by Twilio\'s billing system. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. */ dataTotalBilled: number; /** * The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`). This can be null when data_toal_billed is 0 and we do not yet have billing information for the corresponding data usage. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. */ billedUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; simSid: string; networkSid: string; fleetSid: string; isoCountry: string; period: any; dataUpload: number; dataDownload: number; dataTotal: number; dataTotalBilled: number; billedUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class UsageRecordPage extends Page<V1, UsageRecordPayload, UsageRecordResource, UsageRecordInstance> { /** * Initialize the UsageRecordPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UsageRecordSolution); /** * Build an instance of UsageRecordInstance * * @param payload - Payload response from the API */ getInstance(payload: UsageRecordResource): UsageRecordInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/smsCommand.d.ts000064400000027000151677225100012616 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type SmsCommandDirection = "to_sim" | "from_sim"; export type SmsCommandStatus = "queued" | "sent" | "delivered" | "received" | "failed"; /** * Options to pass to create a SmsCommandInstance */ export interface SmsCommandListInstanceCreateOptions { /** The `sid` or `unique_name` of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the SMS Command to. */ sim: string; /** The message body of the SMS Command. */ payload: string; /** The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. */ callbackMethod?: string; /** The URL we should call using the `callback_method` after we have sent the command. */ callbackUrl?: string; } /** * Options to pass to each */ export interface SmsCommandListInstanceEachOptions { /** The SID or unique name of the Sim resource that SMS Command was sent to or from. */ sim?: string; /** The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/iot/supersim/api/smscommand-resource#status-values) for a description of each. */ status?: SmsCommandStatus; /** The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */ direction?: SmsCommandDirection; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: SmsCommandInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface SmsCommandListInstanceOptions { /** The SID or unique name of the Sim resource that SMS Command was sent to or from. */ sim?: string; /** The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/iot/supersim/api/smscommand-resource#status-values) for a description of each. */ status?: SmsCommandStatus; /** The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */ direction?: SmsCommandDirection; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface SmsCommandListInstancePageOptions { /** The SID or unique name of the Sim resource that SMS Command was sent to or from. */ sim?: string; /** The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/iot/supersim/api/smscommand-resource#status-values) for a description of each. */ status?: SmsCommandStatus; /** The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */ direction?: SmsCommandDirection; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface SmsCommandContext { /** * Fetch a SmsCommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SmsCommandInstance */ fetch(callback?: (error: Error | null, item?: SmsCommandInstance) => any): Promise<SmsCommandInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SmsCommandContextSolution { sid: string; } export declare class SmsCommandContextImpl implements SmsCommandContext { protected _version: V1; protected _solution: SmsCommandContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: SmsCommandInstance) => any): Promise<SmsCommandInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SmsCommandContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SmsCommandPayload extends TwilioResponsePayload { sms_commands: SmsCommandResource[]; } interface SmsCommandResource { sid: string; account_sid: string; sim_sid: string; payload: string; status: SmsCommandStatus; direction: SmsCommandDirection; date_created: Date; date_updated: Date; url: string; } export declare class SmsCommandInstance { protected _version: V1; protected _solution: SmsCommandContextSolution; protected _context?: SmsCommandContext; constructor(_version: V1, payload: SmsCommandResource, sid?: string); /** * The unique string that we created to identify the SMS Command resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SMS Command resource. */ accountSid: string; /** * The SID of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this SMS Command was sent to or from. */ simSid: string; /** * The message body of the SMS Command sent to or from the SIM. For text mode messages, this can be up to 160 characters. */ payload: string; status: SmsCommandStatus; direction: SmsCommandDirection; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the SMS Command resource. */ url: string; private get _proxy(); /** * Fetch a SmsCommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SmsCommandInstance */ fetch(callback?: (error: Error | null, item?: SmsCommandInstance) => any): Promise<SmsCommandInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; simSid: string; payload: string; status: SmsCommandStatus; direction: SmsCommandDirection; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SmsCommandSolution { } export interface SmsCommandListInstance { _version: V1; _solution: SmsCommandSolution; _uri: string; (sid: string): SmsCommandContext; get(sid: string): SmsCommandContext; /** * Create a SmsCommandInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SmsCommandInstance */ create(params: SmsCommandListInstanceCreateOptions, callback?: (error: Error | null, item?: SmsCommandInstance) => any): Promise<SmsCommandInstance>; /** * Streams SmsCommandInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SmsCommandListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SmsCommandInstance, done: (err?: Error) => void) => void): void; each(params: SmsCommandListInstanceEachOptions, callback?: (item: SmsCommandInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SmsCommandInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: SmsCommandPage) => any): Promise<SmsCommandPage>; /** * Lists SmsCommandInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SmsCommandListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SmsCommandInstance[]) => any): Promise<SmsCommandInstance[]>; list(params: SmsCommandListInstanceOptions, callback?: (error: Error | null, items: SmsCommandInstance[]) => any): Promise<SmsCommandInstance[]>; /** * Retrieve a single page of SmsCommandInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SmsCommandListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SmsCommandPage) => any): Promise<SmsCommandPage>; page(params: SmsCommandListInstancePageOptions, callback?: (error: Error | null, items: SmsCommandPage) => any): Promise<SmsCommandPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SmsCommandListInstance(version: V1): SmsCommandListInstance; export declare class SmsCommandPage extends Page<V1, SmsCommandPayload, SmsCommandResource, SmsCommandInstance> { /** * Initialize the SmsCommandPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SmsCommandSolution); /** * Build an instance of SmsCommandInstance * * @param payload - Payload response from the API */ getInstance(payload: SmsCommandResource): SmsCommandInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/ipCommand.js000064400000021711151677225100012173 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.IpCommandPage = exports.IpCommandListInstance = exports.IpCommandInstance = exports.IpCommandContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class IpCommandContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/IpCommands/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new IpCommandInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpCommandContextImpl = IpCommandContextImpl; class IpCommandInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.simSid = payload.sim_sid; this.simIccid = payload.sim_iccid; this.status = payload.status; this.direction = payload.direction; this.deviceIp = payload.device_ip; this.devicePort = deserialize.integer(payload.device_port); this.payloadType = payload.payload_type; this.payload = payload.payload; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new IpCommandContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a IpCommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpCommandInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, simSid: this.simSid, simIccid: this.simIccid, status: this.status, direction: this.direction, deviceIp: this.deviceIp, devicePort: this.devicePort, payloadType: this.payloadType, payload: this.payload, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpCommandInstance = IpCommandInstance; function IpCommandListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new IpCommandContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/IpCommands`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["sim"] === null || params["sim"] === undefined) { throw new Error("Required parameter \"params['sim']\" missing."); } if (params["payload"] === null || params["payload"] === undefined) { throw new Error("Required parameter \"params['payload']\" missing."); } if (params["devicePort"] === null || params["devicePort"] === undefined) { throw new Error("Required parameter \"params['devicePort']\" missing."); } let data = {}; data["Sim"] = params["sim"]; data["Payload"] = params["payload"]; data["DevicePort"] = params["devicePort"]; if (params["payloadType"] !== undefined) data["PayloadType"] = params["payloadType"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IpCommandInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["sim"] !== undefined) data["Sim"] = params["sim"]; if (params["simIccid"] !== undefined) data["SimIccid"] = params["simIccid"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["direction"] !== undefined) data["Direction"] = params["direction"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new IpCommandPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new IpCommandPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.IpCommandListInstance = IpCommandListInstance; class IpCommandPage extends Page_1.default { /** * Initialize the IpCommandPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of IpCommandInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new IpCommandInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpCommandPage = IpCommandPage; rest/supersim/v1/networkAccessProfile.d.ts000064400000030705151677225100014657 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { NetworkAccessProfileNetworkListInstance } from "./networkAccessProfile/networkAccessProfileNetwork"; /** * Options to pass to update a NetworkAccessProfileInstance */ export interface NetworkAccessProfileContextUpdateOptions { /** The new unique name of the Network Access Profile. */ uniqueName?: string; } /** * Options to pass to create a NetworkAccessProfileInstance */ export interface NetworkAccessProfileListInstanceCreateOptions { /** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */ uniqueName?: string; /** List of Network SIDs that this Network Access Profile will allow connections to. */ networks?: Array<string>; } /** * Options to pass to each */ export interface NetworkAccessProfileListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: NetworkAccessProfileInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface NetworkAccessProfileListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface NetworkAccessProfileListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface NetworkAccessProfileContext { networks: NetworkAccessProfileNetworkListInstance; /** * Fetch a NetworkAccessProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileInstance */ fetch(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; /** * Update a NetworkAccessProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileInstance */ update(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; /** * Update a NetworkAccessProfileInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileInstance */ update(params: NetworkAccessProfileContextUpdateOptions, callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface NetworkAccessProfileContextSolution { sid: string; } export declare class NetworkAccessProfileContextImpl implements NetworkAccessProfileContext { protected _version: V1; protected _solution: NetworkAccessProfileContextSolution; protected _uri: string; protected _networks?: NetworkAccessProfileNetworkListInstance; constructor(_version: V1, sid: string); get networks(): NetworkAccessProfileNetworkListInstance; fetch(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; update(params?: NetworkAccessProfileContextUpdateOptions | ((error: Error | null, item?: NetworkAccessProfileInstance) => any), callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): NetworkAccessProfileContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface NetworkAccessProfilePayload extends TwilioResponsePayload { network_access_profiles: NetworkAccessProfileResource[]; } interface NetworkAccessProfileResource { sid: string; unique_name: string; account_sid: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class NetworkAccessProfileInstance { protected _version: V1; protected _solution: NetworkAccessProfileContextSolution; protected _context?: NetworkAccessProfileContext; constructor(_version: V1, payload: NetworkAccessProfileResource, sid?: string); /** * The unique string that identifies the Network Access Profile resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Network Access Profile belongs to. */ accountSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Network Access Profile resource. */ url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a NetworkAccessProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileInstance */ fetch(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; /** * Update a NetworkAccessProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileInstance */ update(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; /** * Update a NetworkAccessProfileInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileInstance */ update(params: NetworkAccessProfileContextUpdateOptions, callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; /** * Access the networks. */ networks(): NetworkAccessProfileNetworkListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface NetworkAccessProfileSolution { } export interface NetworkAccessProfileListInstance { _version: V1; _solution: NetworkAccessProfileSolution; _uri: string; (sid: string): NetworkAccessProfileContext; get(sid: string): NetworkAccessProfileContext; /** * Create a NetworkAccessProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileInstance */ create(callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; /** * Create a NetworkAccessProfileInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileInstance */ create(params: NetworkAccessProfileListInstanceCreateOptions, callback?: (error: Error | null, item?: NetworkAccessProfileInstance) => any): Promise<NetworkAccessProfileInstance>; /** * Streams NetworkAccessProfileInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { NetworkAccessProfileListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: NetworkAccessProfileInstance, done: (err?: Error) => void) => void): void; each(params: NetworkAccessProfileListInstanceEachOptions, callback?: (item: NetworkAccessProfileInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of NetworkAccessProfileInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: NetworkAccessProfilePage) => any): Promise<NetworkAccessProfilePage>; /** * Lists NetworkAccessProfileInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { NetworkAccessProfileListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: NetworkAccessProfileInstance[]) => any): Promise<NetworkAccessProfileInstance[]>; list(params: NetworkAccessProfileListInstanceOptions, callback?: (error: Error | null, items: NetworkAccessProfileInstance[]) => any): Promise<NetworkAccessProfileInstance[]>; /** * Retrieve a single page of NetworkAccessProfileInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { NetworkAccessProfileListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: NetworkAccessProfilePage) => any): Promise<NetworkAccessProfilePage>; page(params: NetworkAccessProfileListInstancePageOptions, callback?: (error: Error | null, items: NetworkAccessProfilePage) => any): Promise<NetworkAccessProfilePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NetworkAccessProfileListInstance(version: V1): NetworkAccessProfileListInstance; export declare class NetworkAccessProfilePage extends Page<V1, NetworkAccessProfilePayload, NetworkAccessProfileResource, NetworkAccessProfileInstance> { /** * Initialize the NetworkAccessProfilePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: NetworkAccessProfileSolution); /** * Build an instance of NetworkAccessProfileInstance * * @param payload - Payload response from the API */ getInstance(payload: NetworkAccessProfileResource): NetworkAccessProfileInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/sim/billingPeriod.js000064400000012170151677225100013636 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BillingPeriodPage = exports.BillingPeriodInstance = exports.BillingPeriodListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function BillingPeriodListInstance(version, simSid) { if (!(0, utility_1.isValidPathParam)(simSid)) { throw new Error("Parameter 'simSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { simSid }; instance._uri = `/Sims/${simSid}/BillingPeriods`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BillingPeriodPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new BillingPeriodPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.BillingPeriodListInstance = BillingPeriodListInstance; class BillingPeriodInstance { constructor(_version, payload, simSid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.simSid = payload.sim_sid; this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.periodType = payload.period_type; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, simSid: this.simSid, startTime: this.startTime, endTime: this.endTime, periodType: this.periodType, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BillingPeriodInstance = BillingPeriodInstance; class BillingPeriodPage extends Page_1.default { /** * Initialize the BillingPeriodPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of BillingPeriodInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BillingPeriodInstance(this._version, payload, this._solution.simSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BillingPeriodPage = BillingPeriodPage; rest/supersim/v1/sim/simIpAddress.d.ts000064400000013732151677225100013703 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type SimIpAddressIpAddressVersion = "IPv4" | "IPv6"; /** * Options to pass to each */ export interface SimIpAddressListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: SimIpAddressInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface SimIpAddressListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface SimIpAddressListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface SimIpAddressSolution { simSid: string; } export interface SimIpAddressListInstance { _version: V1; _solution: SimIpAddressSolution; _uri: string; /** * Streams SimIpAddressInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimIpAddressListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SimIpAddressInstance, done: (err?: Error) => void) => void): void; each(params: SimIpAddressListInstanceEachOptions, callback?: (item: SimIpAddressInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SimIpAddressInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: SimIpAddressPage) => any): Promise<SimIpAddressPage>; /** * Lists SimIpAddressInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimIpAddressListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SimIpAddressInstance[]) => any): Promise<SimIpAddressInstance[]>; list(params: SimIpAddressListInstanceOptions, callback?: (error: Error | null, items: SimIpAddressInstance[]) => any): Promise<SimIpAddressInstance[]>; /** * Retrieve a single page of SimIpAddressInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimIpAddressListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SimIpAddressPage) => any): Promise<SimIpAddressPage>; page(params: SimIpAddressListInstancePageOptions, callback?: (error: Error | null, items: SimIpAddressPage) => any): Promise<SimIpAddressPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SimIpAddressListInstance(version: V1, simSid: string): SimIpAddressListInstance; interface SimIpAddressPayload extends TwilioResponsePayload { ip_addresses: SimIpAddressResource[]; } interface SimIpAddressResource { ip_address: string; ip_address_version: SimIpAddressIpAddressVersion; } export declare class SimIpAddressInstance { protected _version: V1; constructor(_version: V1, payload: SimIpAddressResource, simSid: string); /** * IP address assigned to the given Super SIM */ ipAddress: string; ipAddressVersion: SimIpAddressIpAddressVersion; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { ipAddress: string; ipAddressVersion: SimIpAddressIpAddressVersion; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class SimIpAddressPage extends Page<V1, SimIpAddressPayload, SimIpAddressResource, SimIpAddressInstance> { /** * Initialize the SimIpAddressPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SimIpAddressSolution); /** * Build an instance of SimIpAddressInstance * * @param payload - Payload response from the API */ getInstance(payload: SimIpAddressResource): SimIpAddressInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/sim/billingPeriod.d.ts000064400000016130151677225100014072 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type BillingPeriodBpType = "ready" | "active"; /** * Options to pass to each */ export interface BillingPeriodListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: BillingPeriodInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface BillingPeriodListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface BillingPeriodListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface BillingPeriodSolution { simSid: string; } export interface BillingPeriodListInstance { _version: V1; _solution: BillingPeriodSolution; _uri: string; /** * Streams BillingPeriodInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { BillingPeriodListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BillingPeriodInstance, done: (err?: Error) => void) => void): void; each(params: BillingPeriodListInstanceEachOptions, callback?: (item: BillingPeriodInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BillingPeriodInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: BillingPeriodPage) => any): Promise<BillingPeriodPage>; /** * Lists BillingPeriodInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { BillingPeriodListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BillingPeriodInstance[]) => any): Promise<BillingPeriodInstance[]>; list(params: BillingPeriodListInstanceOptions, callback?: (error: Error | null, items: BillingPeriodInstance[]) => any): Promise<BillingPeriodInstance[]>; /** * Retrieve a single page of BillingPeriodInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { BillingPeriodListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BillingPeriodPage) => any): Promise<BillingPeriodPage>; page(params: BillingPeriodListInstancePageOptions, callback?: (error: Error | null, items: BillingPeriodPage) => any): Promise<BillingPeriodPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BillingPeriodListInstance(version: V1, simSid: string): BillingPeriodListInstance; interface BillingPeriodPayload extends TwilioResponsePayload { billing_periods: BillingPeriodResource[]; } interface BillingPeriodResource { sid: string; account_sid: string; sim_sid: string; start_time: Date; end_time: Date; period_type: BillingPeriodBpType; date_created: Date; date_updated: Date; } export declare class BillingPeriodInstance { protected _version: V1; constructor(_version: V1, payload: BillingPeriodResource, simSid: string); /** * The SID of the Billing Period. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) the Super SIM belongs to. */ accountSid: string; /** * The SID of the Super SIM the Billing Period belongs to. */ simSid: string; /** * The start time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startTime: Date; /** * The end time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ endTime: Date; periodType: BillingPeriodBpType; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; simSid: string; startTime: Date; endTime: Date; periodType: BillingPeriodBpType; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class BillingPeriodPage extends Page<V1, BillingPeriodPayload, BillingPeriodResource, BillingPeriodInstance> { /** * Initialize the BillingPeriodPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: BillingPeriodSolution); /** * Build an instance of BillingPeriodInstance * * @param payload - Payload response from the API */ getInstance(payload: BillingPeriodResource): BillingPeriodInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/sim/simIpAddress.js000064400000011052151677225100013440 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimIpAddressPage = exports.SimIpAddressInstance = exports.SimIpAddressListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function SimIpAddressListInstance(version, simSid) { if (!(0, utility_1.isValidPathParam)(simSid)) { throw new Error("Parameter 'simSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { simSid }; instance._uri = `/Sims/${simSid}/IpAddresses`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SimIpAddressPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new SimIpAddressPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.SimIpAddressListInstance = SimIpAddressListInstance; class SimIpAddressInstance { constructor(_version, payload, simSid) { this._version = _version; this.ipAddress = payload.ip_address; this.ipAddressVersion = payload.ip_address_version; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { ipAddress: this.ipAddress, ipAddressVersion: this.ipAddressVersion, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimIpAddressInstance = SimIpAddressInstance; class SimIpAddressPage extends Page_1.default { /** * Initialize the SimIpAddressPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of SimIpAddressInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SimIpAddressInstance(this._version, payload, this._solution.simSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimIpAddressPage = SimIpAddressPage; rest/supersim/v1/fleet.js000064400000025676151677225100011401 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.FleetPage = exports.FleetListInstance = exports.FleetInstance = exports.FleetContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class FleetContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/Fleets/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FleetInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["networkAccessProfile"] !== undefined) data["NetworkAccessProfile"] = params["networkAccessProfile"]; if (params["ipCommandsUrl"] !== undefined) data["IpCommandsUrl"] = params["ipCommandsUrl"]; if (params["ipCommandsMethod"] !== undefined) data["IpCommandsMethod"] = params["ipCommandsMethod"]; if (params["smsCommandsUrl"] !== undefined) data["SmsCommandsUrl"] = params["smsCommandsUrl"]; if (params["smsCommandsMethod"] !== undefined) data["SmsCommandsMethod"] = params["smsCommandsMethod"]; if (params["dataLimit"] !== undefined) data["DataLimit"] = params["dataLimit"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FleetInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FleetContextImpl = FleetContextImpl; class FleetInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.dataEnabled = payload.data_enabled; this.dataLimit = deserialize.integer(payload.data_limit); this.dataMetering = payload.data_metering; this.smsCommandsEnabled = payload.sms_commands_enabled; this.smsCommandsUrl = payload.sms_commands_url; this.smsCommandsMethod = payload.sms_commands_method; this.networkAccessProfileSid = payload.network_access_profile_sid; this.ipCommandsUrl = payload.ip_commands_url; this.ipCommandsMethod = payload.ip_commands_method; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new FleetContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, uniqueName: this.uniqueName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, dataEnabled: this.dataEnabled, dataLimit: this.dataLimit, dataMetering: this.dataMetering, smsCommandsEnabled: this.smsCommandsEnabled, smsCommandsUrl: this.smsCommandsUrl, smsCommandsMethod: this.smsCommandsMethod, networkAccessProfileSid: this.networkAccessProfileSid, ipCommandsUrl: this.ipCommandsUrl, ipCommandsMethod: this.ipCommandsMethod, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FleetInstance = FleetInstance; function FleetListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new FleetContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Fleets`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["networkAccessProfile"] === null || params["networkAccessProfile"] === undefined) { throw new Error("Required parameter \"params['networkAccessProfile']\" missing."); } let data = {}; data["NetworkAccessProfile"] = params["networkAccessProfile"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["dataEnabled"] !== undefined) data["DataEnabled"] = serialize.bool(params["dataEnabled"]); if (params["dataLimit"] !== undefined) data["DataLimit"] = params["dataLimit"]; if (params["ipCommandsUrl"] !== undefined) data["IpCommandsUrl"] = params["ipCommandsUrl"]; if (params["ipCommandsMethod"] !== undefined) data["IpCommandsMethod"] = params["ipCommandsMethod"]; if (params["smsCommandsEnabled"] !== undefined) data["SmsCommandsEnabled"] = serialize.bool(params["smsCommandsEnabled"]); if (params["smsCommandsUrl"] !== undefined) data["SmsCommandsUrl"] = params["smsCommandsUrl"]; if (params["smsCommandsMethod"] !== undefined) data["SmsCommandsMethod"] = params["smsCommandsMethod"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FleetInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["networkAccessProfile"] !== undefined) data["NetworkAccessProfile"] = params["networkAccessProfile"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new FleetPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new FleetPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.FleetListInstance = FleetListInstance; class FleetPage extends Page_1.default { /** * Initialize the FleetPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of FleetInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new FleetInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FleetPage = FleetPage; rest/supersim/v1/settingsUpdate.js000064400000012022151677225100013262 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SettingsUpdatePage = exports.SettingsUpdateInstance = exports.SettingsUpdateListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function SettingsUpdateListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/SettingsUpdates`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["sim"] !== undefined) data["Sim"] = params["sim"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SettingsUpdatePage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new SettingsUpdatePage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.SettingsUpdateListInstance = SettingsUpdateListInstance; class SettingsUpdateInstance { constructor(_version, payload) { this._version = _version; this.sid = payload.sid; this.iccid = payload.iccid; this.simSid = payload.sim_sid; this.status = payload.status; this.packages = payload.packages; this.dateCompleted = deserialize.iso8601DateTime(payload.date_completed); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, iccid: this.iccid, simSid: this.simSid, status: this.status, packages: this.packages, dateCompleted: this.dateCompleted, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SettingsUpdateInstance = SettingsUpdateInstance; class SettingsUpdatePage extends Page_1.default { /** * Initialize the SettingsUpdatePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of SettingsUpdateInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SettingsUpdateInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SettingsUpdatePage = SettingsUpdatePage; rest/supersim/v1/esimProfile.js000064400000021015151677225100012537 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.EsimProfilePage = exports.EsimProfileListInstance = exports.EsimProfileInstance = exports.EsimProfileContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class EsimProfileContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/ESimProfiles/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EsimProfileInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EsimProfileContextImpl = EsimProfileContextImpl; class EsimProfileInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.iccid = payload.iccid; this.simSid = payload.sim_sid; this.status = payload.status; this.eid = payload.eid; this.smdpPlusAddress = payload.smdp_plus_address; this.matchingId = payload.matching_id; this.activationCode = payload.activation_code; this.errorCode = payload.error_code; this.errorMessage = payload.error_message; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new EsimProfileContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a EsimProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EsimProfileInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, iccid: this.iccid, simSid: this.simSid, status: this.status, eid: this.eid, smdpPlusAddress: this.smdpPlusAddress, matchingId: this.matchingId, activationCode: this.activationCode, errorCode: this.errorCode, errorMessage: this.errorMessage, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EsimProfileInstance = EsimProfileInstance; function EsimProfileListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EsimProfileContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/ESimProfiles`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; if (params["generateMatchingId"] !== undefined) data["GenerateMatchingId"] = serialize.bool(params["generateMatchingId"]); if (params["eid"] !== undefined) data["Eid"] = params["eid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new EsimProfileInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["eid"] !== undefined) data["Eid"] = params["eid"]; if (params["simSid"] !== undefined) data["SimSid"] = params["simSid"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EsimProfilePage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new EsimProfilePage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.EsimProfileListInstance = EsimProfileListInstance; class EsimProfilePage extends Page_1.default { /** * Initialize the EsimProfilePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of EsimProfileInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EsimProfileInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EsimProfilePage = EsimProfilePage; rest/supersim/v1/esimProfile.d.ts000064400000031531151677225100012777 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type EsimProfileStatus = "new" | "reserving" | "available" | "downloaded" | "installed" | "failed"; /** * Options to pass to create a EsimProfileInstance */ export interface EsimProfileListInstanceCreateOptions { /** The URL we should call using the `callback_method` when the status of the eSIM Profile changes. At this stage of the eSIM Profile pilot, the a request to the URL will only be called when the ESimProfile resource changes from `reserving` to `available`. */ callbackUrl?: string; /** The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. */ callbackMethod?: string; /** When set to `true`, a value for `Eid` does not need to be provided. Instead, when the eSIM profile is reserved, a matching ID will be generated and returned via the `matching_id` property. This identifies the specific eSIM profile that can be used by any capable device to claim and download the profile. */ generateMatchingId?: boolean; /** Identifier of the eUICC that will claim the eSIM Profile. */ eid?: string; } /** * Options to pass to each */ export interface EsimProfileListInstanceEachOptions { /** List the eSIM Profiles that have been associated with an EId. */ eid?: string; /** Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. */ simSid?: string; /** List the eSIM Profiles that are in a given status. */ status?: EsimProfileStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: EsimProfileInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface EsimProfileListInstanceOptions { /** List the eSIM Profiles that have been associated with an EId. */ eid?: string; /** Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. */ simSid?: string; /** List the eSIM Profiles that are in a given status. */ status?: EsimProfileStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface EsimProfileListInstancePageOptions { /** List the eSIM Profiles that have been associated with an EId. */ eid?: string; /** Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. */ simSid?: string; /** List the eSIM Profiles that are in a given status. */ status?: EsimProfileStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface EsimProfileContext { /** * Fetch a EsimProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EsimProfileInstance */ fetch(callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EsimProfileContextSolution { sid: string; } export declare class EsimProfileContextImpl implements EsimProfileContext { protected _version: V1; protected _solution: EsimProfileContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EsimProfileContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EsimProfilePayload extends TwilioResponsePayload { esim_profiles: EsimProfileResource[]; } interface EsimProfileResource { sid: string; account_sid: string; iccid: string; sim_sid: string; status: EsimProfileStatus; eid: string; smdp_plus_address: string; matching_id: string; activation_code: string; error_code: string; error_message: string; date_created: Date; date_updated: Date; url: string; } export declare class EsimProfileInstance { protected _version: V1; protected _solution: EsimProfileContextSolution; protected _context?: EsimProfileContext; constructor(_version: V1, payload: EsimProfileResource, sid?: string); /** * The unique string that we created to identify the eSIM Profile resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the eSIM Profile resource belongs. */ accountSid: string; /** * The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the Sim resource. */ iccid: string; /** * The SID of the [Sim](https://www.twilio.com/docs/iot/supersim/api/sim-resource) resource that this eSIM Profile controls. */ simSid: string; status: EsimProfileStatus; /** * Identifier of the eUICC that can claim the eSIM Profile. */ eid: string; /** * Address of the SM-DP+ server from which the Profile will be downloaded. The URL will appear once the eSIM Profile reaches the status `available`. */ smdpPlusAddress: string; /** * Unique identifier of the eSIM profile that can be used to identify and download the eSIM profile from the SM-DP+ server. Populated if `generate_matching_id` is set to `true` when creating the eSIM profile reservation. */ matchingId: string; /** * Combined machine-readable activation code for acquiring an eSIM Profile with the Activation Code download method. Can be used in a QR code to download an eSIM profile. */ activationCode: string; /** * Code indicating the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. */ errorCode: string; /** * Error message describing the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. */ errorMessage: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the eSIM Profile resource. */ url: string; private get _proxy(); /** * Fetch a EsimProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EsimProfileInstance */ fetch(callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; iccid: string; simSid: string; status: EsimProfileStatus; eid: string; smdpPlusAddress: string; matchingId: string; activationCode: string; errorCode: string; errorMessage: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EsimProfileSolution { } export interface EsimProfileListInstance { _version: V1; _solution: EsimProfileSolution; _uri: string; (sid: string): EsimProfileContext; get(sid: string): EsimProfileContext; /** * Create a EsimProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EsimProfileInstance */ create(callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>; /** * Create a EsimProfileInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EsimProfileInstance */ create(params: EsimProfileListInstanceCreateOptions, callback?: (error: Error | null, item?: EsimProfileInstance) => any): Promise<EsimProfileInstance>; /** * Streams EsimProfileInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { EsimProfileListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EsimProfileInstance, done: (err?: Error) => void) => void): void; each(params: EsimProfileListInstanceEachOptions, callback?: (item: EsimProfileInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EsimProfileInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: EsimProfilePage) => any): Promise<EsimProfilePage>; /** * Lists EsimProfileInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { EsimProfileListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EsimProfileInstance[]) => any): Promise<EsimProfileInstance[]>; list(params: EsimProfileListInstanceOptions, callback?: (error: Error | null, items: EsimProfileInstance[]) => any): Promise<EsimProfileInstance[]>; /** * Retrieve a single page of EsimProfileInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { EsimProfileListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EsimProfilePage) => any): Promise<EsimProfilePage>; page(params: EsimProfileListInstancePageOptions, callback?: (error: Error | null, items: EsimProfilePage) => any): Promise<EsimProfilePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EsimProfileListInstance(version: V1): EsimProfileListInstance; export declare class EsimProfilePage extends Page<V1, EsimProfilePayload, EsimProfileResource, EsimProfileInstance> { /** * Initialize the EsimProfilePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: EsimProfileSolution); /** * Build an instance of EsimProfileInstance * * @param payload - Payload response from the API */ getInstance(payload: EsimProfileResource): EsimProfileInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/ipCommand.d.ts000064400000033112151677225100012425 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type IpCommandDirection = "to_sim" | "from_sim"; export type IpCommandPayloadType = "text" | "binary"; export type IpCommandStatus = "queued" | "sent" | "received" | "failed"; /** * Options to pass to create a IpCommandInstance */ export interface IpCommandListInstanceCreateOptions { /** The `sid` or `unique_name` of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the IP Command to. */ sim: string; /** The data that will be sent to the device. The payload cannot exceed 1300 bytes. If the PayloadType is set to text, the payload is encoded in UTF-8. If PayloadType is set to binary, the payload is encoded in Base64. */ payload: string; /** The device port to which the IP Command will be sent. */ devicePort: number; /** */ payloadType?: IpCommandPayloadType; /** The URL we should call using the `callback_method` after we have sent the IP Command. */ callbackUrl?: string; /** The HTTP method we should use to call `callback_url`. Can be `GET` or `POST`, and the default is `POST`. */ callbackMethod?: string; } /** * Options to pass to each */ export interface IpCommandListInstanceEachOptions { /** The SID or unique name of the Sim resource that IP Command was sent to or from. */ sim?: string; /** The ICCID of the Sim resource that IP Command was sent to or from. */ simIccid?: string; /** The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each. */ status?: IpCommandStatus; /** The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */ direction?: IpCommandDirection; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: IpCommandInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface IpCommandListInstanceOptions { /** The SID or unique name of the Sim resource that IP Command was sent to or from. */ sim?: string; /** The ICCID of the Sim resource that IP Command was sent to or from. */ simIccid?: string; /** The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each. */ status?: IpCommandStatus; /** The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */ direction?: IpCommandDirection; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface IpCommandListInstancePageOptions { /** The SID or unique name of the Sim resource that IP Command was sent to or from. */ sim?: string; /** The ICCID of the Sim resource that IP Command was sent to or from. */ simIccid?: string; /** The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each. */ status?: IpCommandStatus; /** The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. */ direction?: IpCommandDirection; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface IpCommandContext { /** * Fetch a IpCommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpCommandInstance */ fetch(callback?: (error: Error | null, item?: IpCommandInstance) => any): Promise<IpCommandInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface IpCommandContextSolution { sid: string; } export declare class IpCommandContextImpl implements IpCommandContext { protected _version: V1; protected _solution: IpCommandContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: IpCommandInstance) => any): Promise<IpCommandInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): IpCommandContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface IpCommandPayload extends TwilioResponsePayload { ip_commands: IpCommandResource[]; } interface IpCommandResource { sid: string; account_sid: string; sim_sid: string; sim_iccid: string; status: IpCommandStatus; direction: IpCommandDirection; device_ip: string; device_port: number; payload_type: IpCommandPayloadType; payload: string; date_created: Date; date_updated: Date; url: string; } export declare class IpCommandInstance { protected _version: V1; protected _solution: IpCommandContextSolution; protected _context?: IpCommandContext; constructor(_version: V1, payload: IpCommandResource, sid?: string); /** * The unique string that we created to identify the IP Command resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Command resource. */ accountSid: string; /** * The SID of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. */ simSid: string; /** * The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. */ simIccid: string; status: IpCommandStatus; direction: IpCommandDirection; /** * The IP address of the device that the IP Command was sent to or received from. For an IP Command sent to a Super SIM, `device_ip` starts out as `null`, and once the IP Command is “sent”, the `device_ip` will be filled out. An IP Command sent from a Super SIM have its `device_ip` always set. */ deviceIp: string; /** * For an IP Command sent to a Super SIM, it would be the destination port of the IP message. For an IP Command sent from a Super SIM, it would be the source port of the IP message. */ devicePort: number; payloadType: IpCommandPayloadType; /** * The payload that is carried in the IP/UDP message. The payload can be encoded in either text or binary format. For text payload, UTF-8 encoding must be used. For an IP Command sent to a Super SIM, the payload is appended to the IP/UDP message “as is”. The payload should not exceed 1300 bytes. For an IP Command sent from a Super SIM, the payload from the received IP/UDP message is extracted and sent in binary encoding. For an IP Command sent from a Super SIM, the payload should not exceed 1300 bytes. If it is larger than 1300 bytes, there might be fragmentation on the upstream and the message may appear truncated. */ payload: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the IP Command resource. */ url: string; private get _proxy(); /** * Fetch a IpCommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpCommandInstance */ fetch(callback?: (error: Error | null, item?: IpCommandInstance) => any): Promise<IpCommandInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; simSid: string; simIccid: string; status: IpCommandStatus; direction: IpCommandDirection; deviceIp: string; devicePort: number; payloadType: IpCommandPayloadType; payload: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface IpCommandSolution { } export interface IpCommandListInstance { _version: V1; _solution: IpCommandSolution; _uri: string; (sid: string): IpCommandContext; get(sid: string): IpCommandContext; /** * Create a IpCommandInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpCommandInstance */ create(params: IpCommandListInstanceCreateOptions, callback?: (error: Error | null, item?: IpCommandInstance) => any): Promise<IpCommandInstance>; /** * Streams IpCommandInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { IpCommandListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: IpCommandInstance, done: (err?: Error) => void) => void): void; each(params: IpCommandListInstanceEachOptions, callback?: (item: IpCommandInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of IpCommandInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: IpCommandPage) => any): Promise<IpCommandPage>; /** * Lists IpCommandInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { IpCommandListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: IpCommandInstance[]) => any): Promise<IpCommandInstance[]>; list(params: IpCommandListInstanceOptions, callback?: (error: Error | null, items: IpCommandInstance[]) => any): Promise<IpCommandInstance[]>; /** * Retrieve a single page of IpCommandInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { IpCommandListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: IpCommandPage) => any): Promise<IpCommandPage>; page(params: IpCommandListInstancePageOptions, callback?: (error: Error | null, items: IpCommandPage) => any): Promise<IpCommandPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function IpCommandListInstance(version: V1): IpCommandListInstance; export declare class IpCommandPage extends Page<V1, IpCommandPayload, IpCommandResource, IpCommandInstance> { /** * Initialize the IpCommandPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: IpCommandSolution); /** * Build an instance of IpCommandInstance * * @param payload - Payload response from the API */ getInstance(payload: IpCommandResource): IpCommandInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/usageRecord.js000064400000013501151677225100012525 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.UsageRecordPage = exports.UsageRecordInstance = exports.UsageRecordListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function UsageRecordListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/UsageRecords`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["sim"] !== undefined) data["Sim"] = params["sim"]; if (params["fleet"] !== undefined) data["Fleet"] = params["fleet"]; if (params["network"] !== undefined) data["Network"] = params["network"]; if (params["isoCountry"] !== undefined) data["IsoCountry"] = params["isoCountry"]; if (params["group"] !== undefined) data["Group"] = params["group"]; if (params["granularity"] !== undefined) data["Granularity"] = params["granularity"]; if (params["startTime"] !== undefined) data["StartTime"] = serialize.iso8601DateTime(params["startTime"]); if (params["endTime"] !== undefined) data["EndTime"] = serialize.iso8601DateTime(params["endTime"]); if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UsageRecordPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new UsageRecordPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.UsageRecordListInstance = UsageRecordListInstance; class UsageRecordInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.simSid = payload.sim_sid; this.networkSid = payload.network_sid; this.fleetSid = payload.fleet_sid; this.isoCountry = payload.iso_country; this.period = payload.period; this.dataUpload = payload.data_upload; this.dataDownload = payload.data_download; this.dataTotal = payload.data_total; this.dataTotalBilled = payload.data_total_billed; this.billedUnit = payload.billed_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, simSid: this.simSid, networkSid: this.networkSid, fleetSid: this.fleetSid, isoCountry: this.isoCountry, period: this.period, dataUpload: this.dataUpload, dataDownload: this.dataDownload, dataTotal: this.dataTotal, dataTotalBilled: this.dataTotalBilled, billedUnit: this.billedUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsageRecordInstance = UsageRecordInstance; class UsageRecordPage extends Page_1.default { /** * Initialize the UsageRecordPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of UsageRecordInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UsageRecordInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsageRecordPage = UsageRecordPage; rest/supersim/v1/networkAccessProfile.js000064400000022236151677225100014423 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.NetworkAccessProfilePage = exports.NetworkAccessProfileListInstance = exports.NetworkAccessProfileInstance = exports.NetworkAccessProfileContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const networkAccessProfileNetwork_1 = require("./networkAccessProfile/networkAccessProfileNetwork"); class NetworkAccessProfileContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/NetworkAccessProfiles/${sid}`; } get networks() { this._networks = this._networks || (0, networkAccessProfileNetwork_1.NetworkAccessProfileNetworkListInstance)(this._version, this._solution.sid); return this._networks; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new NetworkAccessProfileInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new NetworkAccessProfileInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NetworkAccessProfileContextImpl = NetworkAccessProfileContextImpl; class NetworkAccessProfileInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new NetworkAccessProfileContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a NetworkAccessProfileInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the networks. */ networks() { return this._proxy.networks; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NetworkAccessProfileInstance = NetworkAccessProfileInstance; function NetworkAccessProfileListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new NetworkAccessProfileContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/NetworkAccessProfiles`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["networks"] !== undefined) data["Networks"] = serialize.map(params["networks"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new NetworkAccessProfileInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new NetworkAccessProfilePage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new NetworkAccessProfilePage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.NetworkAccessProfileListInstance = NetworkAccessProfileListInstance; class NetworkAccessProfilePage extends Page_1.default { /** * Initialize the NetworkAccessProfilePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of NetworkAccessProfileInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new NetworkAccessProfileInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NetworkAccessProfilePage = NetworkAccessProfilePage; rest/supersim/v1/settingsUpdate.d.ts000064400000017772151677225100013537 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type SettingsUpdateStatus = "scheduled" | "in-progress" | "successful" | "failed"; /** * Options to pass to each */ export interface SettingsUpdateListInstanceEachOptions { /** Filter the Settings Updates by a Super SIM\'s SID or UniqueName. */ sim?: string; /** Filter the Settings Updates by status. Can be `scheduled`, `in-progress`, `successful`, or `failed`. */ status?: SettingsUpdateStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: SettingsUpdateInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface SettingsUpdateListInstanceOptions { /** Filter the Settings Updates by a Super SIM\'s SID or UniqueName. */ sim?: string; /** Filter the Settings Updates by status. Can be `scheduled`, `in-progress`, `successful`, or `failed`. */ status?: SettingsUpdateStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface SettingsUpdateListInstancePageOptions { /** Filter the Settings Updates by a Super SIM\'s SID or UniqueName. */ sim?: string; /** Filter the Settings Updates by status. Can be `scheduled`, `in-progress`, `successful`, or `failed`. */ status?: SettingsUpdateStatus; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface SettingsUpdateSolution { } export interface SettingsUpdateListInstance { _version: V1; _solution: SettingsUpdateSolution; _uri: string; /** * Streams SettingsUpdateInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SettingsUpdateListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SettingsUpdateInstance, done: (err?: Error) => void) => void): void; each(params: SettingsUpdateListInstanceEachOptions, callback?: (item: SettingsUpdateInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SettingsUpdateInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: SettingsUpdatePage) => any): Promise<SettingsUpdatePage>; /** * Lists SettingsUpdateInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SettingsUpdateListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SettingsUpdateInstance[]) => any): Promise<SettingsUpdateInstance[]>; list(params: SettingsUpdateListInstanceOptions, callback?: (error: Error | null, items: SettingsUpdateInstance[]) => any): Promise<SettingsUpdateInstance[]>; /** * Retrieve a single page of SettingsUpdateInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SettingsUpdateListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SettingsUpdatePage) => any): Promise<SettingsUpdatePage>; page(params: SettingsUpdateListInstancePageOptions, callback?: (error: Error | null, items: SettingsUpdatePage) => any): Promise<SettingsUpdatePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SettingsUpdateListInstance(version: V1): SettingsUpdateListInstance; interface SettingsUpdatePayload extends TwilioResponsePayload { settings_updates: SettingsUpdateResource[]; } interface SettingsUpdateResource { sid: string; iccid: string; sim_sid: string; status: SettingsUpdateStatus; packages: Array<any>; date_completed: Date; date_created: Date; date_updated: Date; } export declare class SettingsUpdateInstance { protected _version: V1; constructor(_version: V1, payload: SettingsUpdateResource); /** * The unique identifier of this Settings Update. */ sid: string; /** * The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. */ iccid: string; /** * The SID of the Super SIM to which this Settings Update was applied. */ simSid: string; status: SettingsUpdateStatus; /** * Array containing the different Settings Packages that will be applied to the SIM after the update completes. Each object within the array indicates the name and the version of the Settings Package that will be on the SIM if the update is successful. */ packages: Array<any>; /** * The time, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, when the update successfully completed and the new settings were applied to the SIM. */ dateCompleted: Date; /** * The date that this Settings Update was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date that this Settings Update was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; iccid: string; simSid: string; status: SettingsUpdateStatus; packages: any[]; dateCompleted: Date; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class SettingsUpdatePage extends Page<V1, SettingsUpdatePayload, SettingsUpdateResource, SettingsUpdateInstance> { /** * Initialize the SettingsUpdatePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SettingsUpdateSolution); /** * Build an instance of SettingsUpdateInstance * * @param payload - Payload response from the API */ getInstance(payload: SettingsUpdateResource): SettingsUpdateInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/sim.d.ts000064400000032555151677225100011320 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { BillingPeriodListInstance } from "./sim/billingPeriod"; import { SimIpAddressListInstance } from "./sim/simIpAddress"; export type SimStatus = "new" | "ready" | "active" | "inactive" | "scheduled"; export type SimStatusUpdate = "ready" | "active" | "inactive"; /** * Options to pass to update a SimInstance */ export interface SimContextUpdateOptions { /** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */ uniqueName?: string; /** */ status?: SimStatusUpdate; /** The SID or unique name of the Fleet to which the SIM resource should be assigned. */ fleet?: string; /** The URL we should call using the `callback_method` after an asynchronous update has finished. */ callbackUrl?: string; /** The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. */ callbackMethod?: string; /** The SID of the Account to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a Subaccount of the requesting Account. Only valid when the Sim resource\\\'s status is new. */ accountSid?: string; } /** * Options to pass to create a SimInstance */ export interface SimListInstanceCreateOptions { /** The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the Super SIM to be added to your Account. */ iccid: string; /** The 10-digit code required to claim the Super SIM for your Account. */ registrationCode: string; } /** * Options to pass to each */ export interface SimListInstanceEachOptions { /** The status of the Sim resources to read. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. */ status?: SimStatus; /** The SID or unique name of the Fleet to which a list of Sims are assigned. */ fleet?: string; /** The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with a Super SIM to filter the list by. Passing this parameter will always return a list containing zero or one SIMs. */ iccid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: SimInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface SimListInstanceOptions { /** The status of the Sim resources to read. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. */ status?: SimStatus; /** The SID or unique name of the Fleet to which a list of Sims are assigned. */ fleet?: string; /** The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with a Super SIM to filter the list by. Passing this parameter will always return a list containing zero or one SIMs. */ iccid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface SimListInstancePageOptions { /** The status of the Sim resources to read. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. */ status?: SimStatus; /** The SID or unique name of the Fleet to which a list of Sims are assigned. */ fleet?: string; /** The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with a Super SIM to filter the list by. Passing this parameter will always return a list containing zero or one SIMs. */ iccid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface SimContext { billingPeriods: BillingPeriodListInstance; simIpAddresses: SimIpAddressListInstance; /** * Fetch a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SimContextSolution { sid: string; } export declare class SimContextImpl implements SimContext { protected _version: V1; protected _solution: SimContextSolution; protected _uri: string; protected _billingPeriods?: BillingPeriodListInstance; protected _simIpAddresses?: SimIpAddressListInstance; constructor(_version: V1, sid: string); get billingPeriods(): BillingPeriodListInstance; get simIpAddresses(): SimIpAddressListInstance; fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; update(params?: SimContextUpdateOptions | ((error: Error | null, item?: SimInstance) => any), callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SimContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SimPayload extends TwilioResponsePayload { sims: SimResource[]; } interface SimResource { sid: string; unique_name: string; account_sid: string; iccid: string; status: SimStatus; fleet_sid: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class SimInstance { protected _version: V1; protected _solution: SimContextSolution; protected _context?: SimContext; constructor(_version: V1, payload: SimResource, sid?: string); /** * The unique string that identifies the Sim resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Super SIM belongs to. */ accountSid: string; /** * The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the SIM. */ iccid: string; status: SimStatus; /** * The unique ID of the Fleet configured for this SIM. */ fleetSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Sim Resource. */ url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Access the billingPeriods. */ billingPeriods(): BillingPeriodListInstance; /** * Access the simIpAddresses. */ simIpAddresses(): SimIpAddressListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; iccid: string; status: SimStatus; fleetSid: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SimSolution { } export interface SimListInstance { _version: V1; _solution: SimSolution; _uri: string; (sid: string): SimContext; get(sid: string): SimContext; /** * Create a SimInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ create(params: SimListInstanceCreateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Streams SimInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SimInstance, done: (err?: Error) => void) => void): void; each(params: SimListInstanceEachOptions, callback?: (item: SimInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SimInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>; /** * Lists SimInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SimInstance[]) => any): Promise<SimInstance[]>; list(params: SimListInstanceOptions, callback?: (error: Error | null, items: SimInstance[]) => any): Promise<SimInstance[]>; /** * Retrieve a single page of SimInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>; page(params: SimListInstancePageOptions, callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SimListInstance(version: V1): SimListInstance; export declare class SimPage extends Page<V1, SimPayload, SimResource, SimInstance> { /** * Initialize the SimPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SimSolution); /** * Build an instance of SimInstance * * @param payload - Payload response from the API */ getInstance(payload: SimResource): SimInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.d.ts000064400000025265151677225100022372 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a NetworkAccessProfileNetworkInstance */ export interface NetworkAccessProfileNetworkListInstanceCreateOptions { /** The SID of the Network resource to be added to the Network Access Profile resource. */ network: string; } /** * Options to pass to each */ export interface NetworkAccessProfileNetworkListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: NetworkAccessProfileNetworkInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface NetworkAccessProfileNetworkListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface NetworkAccessProfileNetworkListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface NetworkAccessProfileNetworkContext { /** * Remove a NetworkAccessProfileNetworkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a NetworkAccessProfileNetworkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileNetworkInstance */ fetch(callback?: (error: Error | null, item?: NetworkAccessProfileNetworkInstance) => any): Promise<NetworkAccessProfileNetworkInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface NetworkAccessProfileNetworkContextSolution { networkAccessProfileSid: string; sid: string; } export declare class NetworkAccessProfileNetworkContextImpl implements NetworkAccessProfileNetworkContext { protected _version: V1; protected _solution: NetworkAccessProfileNetworkContextSolution; protected _uri: string; constructor(_version: V1, networkAccessProfileSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: NetworkAccessProfileNetworkInstance) => any): Promise<NetworkAccessProfileNetworkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): NetworkAccessProfileNetworkContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface NetworkAccessProfileNetworkPayload extends TwilioResponsePayload { networks: NetworkAccessProfileNetworkResource[]; } interface NetworkAccessProfileNetworkResource { sid: string; network_access_profile_sid: string; friendly_name: string; iso_country: string; identifiers: Array<any>; url: string; } export declare class NetworkAccessProfileNetworkInstance { protected _version: V1; protected _solution: NetworkAccessProfileNetworkContextSolution; protected _context?: NetworkAccessProfileNetworkContext; constructor(_version: V1, payload: NetworkAccessProfileNetworkResource, networkAccessProfileSid: string, sid?: string); /** * The unique string that identifies the Network resource. */ sid: string; /** * The unique string that identifies the Network resource\'s Network Access Profile resource. */ networkAccessProfileSid: string; /** * A human readable identifier of the Network this resource refers to. */ friendlyName: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. */ isoCountry: string; /** * Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. */ identifiers: Array<any>; /** * The absolute URL of the Network resource. */ url: string; private get _proxy(); /** * Remove a NetworkAccessProfileNetworkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a NetworkAccessProfileNetworkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileNetworkInstance */ fetch(callback?: (error: Error | null, item?: NetworkAccessProfileNetworkInstance) => any): Promise<NetworkAccessProfileNetworkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; networkAccessProfileSid: string; friendlyName: string; isoCountry: string; identifiers: any[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface NetworkAccessProfileNetworkSolution { networkAccessProfileSid: string; } export interface NetworkAccessProfileNetworkListInstance { _version: V1; _solution: NetworkAccessProfileNetworkSolution; _uri: string; (sid: string): NetworkAccessProfileNetworkContext; get(sid: string): NetworkAccessProfileNetworkContext; /** * Create a NetworkAccessProfileNetworkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileNetworkInstance */ create(params: NetworkAccessProfileNetworkListInstanceCreateOptions, callback?: (error: Error | null, item?: NetworkAccessProfileNetworkInstance) => any): Promise<NetworkAccessProfileNetworkInstance>; /** * Streams NetworkAccessProfileNetworkInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { NetworkAccessProfileNetworkListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: NetworkAccessProfileNetworkInstance, done: (err?: Error) => void) => void): void; each(params: NetworkAccessProfileNetworkListInstanceEachOptions, callback?: (item: NetworkAccessProfileNetworkInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of NetworkAccessProfileNetworkInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: NetworkAccessProfileNetworkPage) => any): Promise<NetworkAccessProfileNetworkPage>; /** * Lists NetworkAccessProfileNetworkInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { NetworkAccessProfileNetworkListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: NetworkAccessProfileNetworkInstance[]) => any): Promise<NetworkAccessProfileNetworkInstance[]>; list(params: NetworkAccessProfileNetworkListInstanceOptions, callback?: (error: Error | null, items: NetworkAccessProfileNetworkInstance[]) => any): Promise<NetworkAccessProfileNetworkInstance[]>; /** * Retrieve a single page of NetworkAccessProfileNetworkInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { NetworkAccessProfileNetworkListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: NetworkAccessProfileNetworkPage) => any): Promise<NetworkAccessProfileNetworkPage>; page(params: NetworkAccessProfileNetworkListInstancePageOptions, callback?: (error: Error | null, items: NetworkAccessProfileNetworkPage) => any): Promise<NetworkAccessProfileNetworkPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NetworkAccessProfileNetworkListInstance(version: V1, networkAccessProfileSid: string): NetworkAccessProfileNetworkListInstance; export declare class NetworkAccessProfileNetworkPage extends Page<V1, NetworkAccessProfileNetworkPayload, NetworkAccessProfileNetworkResource, NetworkAccessProfileNetworkInstance> { /** * Initialize the NetworkAccessProfileNetworkPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: NetworkAccessProfileNetworkSolution); /** * Build an instance of NetworkAccessProfileNetworkInstance * * @param payload - Payload response from the API */ getInstance(payload: NetworkAccessProfileNetworkResource): NetworkAccessProfileNetworkInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/v1/networkAccessProfile/networkAccessProfileNetwork.js000064400000022171151677225100022127 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.NetworkAccessProfileNetworkPage = exports.NetworkAccessProfileNetworkListInstance = exports.NetworkAccessProfileNetworkInstance = exports.NetworkAccessProfileNetworkContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class NetworkAccessProfileNetworkContextImpl { constructor(_version, networkAccessProfileSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(networkAccessProfileSid)) { throw new Error("Parameter 'networkAccessProfileSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { networkAccessProfileSid, sid }; this._uri = `/NetworkAccessProfiles/${networkAccessProfileSid}/Networks/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new NetworkAccessProfileNetworkInstance(operationVersion, payload, instance._solution.networkAccessProfileSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NetworkAccessProfileNetworkContextImpl = NetworkAccessProfileNetworkContextImpl; class NetworkAccessProfileNetworkInstance { constructor(_version, payload, networkAccessProfileSid, sid) { this._version = _version; this.sid = payload.sid; this.networkAccessProfileSid = payload.network_access_profile_sid; this.friendlyName = payload.friendly_name; this.isoCountry = payload.iso_country; this.identifiers = payload.identifiers; this.url = payload.url; this._solution = { networkAccessProfileSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new NetworkAccessProfileNetworkContextImpl(this._version, this._solution.networkAccessProfileSid, this._solution.sid); return this._context; } /** * Remove a NetworkAccessProfileNetworkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a NetworkAccessProfileNetworkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkAccessProfileNetworkInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, networkAccessProfileSid: this.networkAccessProfileSid, friendlyName: this.friendlyName, isoCountry: this.isoCountry, identifiers: this.identifiers, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NetworkAccessProfileNetworkInstance = NetworkAccessProfileNetworkInstance; function NetworkAccessProfileNetworkListInstance(version, networkAccessProfileSid) { if (!(0, utility_1.isValidPathParam)(networkAccessProfileSid)) { throw new Error("Parameter 'networkAccessProfileSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new NetworkAccessProfileNetworkContextImpl(version, networkAccessProfileSid, sid); }; instance._version = version; instance._solution = { networkAccessProfileSid }; instance._uri = `/NetworkAccessProfiles/${networkAccessProfileSid}/Networks`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["network"] === null || params["network"] === undefined) { throw new Error("Required parameter \"params['network']\" missing."); } let data = {}; data["Network"] = params["network"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new NetworkAccessProfileNetworkInstance(operationVersion, payload, instance._solution.networkAccessProfileSid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new NetworkAccessProfileNetworkPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new NetworkAccessProfileNetworkPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.NetworkAccessProfileNetworkListInstance = NetworkAccessProfileNetworkListInstance; class NetworkAccessProfileNetworkPage extends Page_1.default { /** * Initialize the NetworkAccessProfileNetworkPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of NetworkAccessProfileNetworkInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new NetworkAccessProfileNetworkInstance(this._version, payload, this._solution.networkAccessProfileSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NetworkAccessProfileNetworkPage = NetworkAccessProfileNetworkPage; rest/supersim/v1/network.js000064400000014645151677225100011765 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.NetworkPage = exports.NetworkListInstance = exports.NetworkInstance = exports.NetworkContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class NetworkContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/Networks/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new NetworkInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NetworkContextImpl = NetworkContextImpl; class NetworkInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.url = payload.url; this.isoCountry = payload.iso_country; this.identifiers = payload.identifiers; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new NetworkContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a NetworkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NetworkInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, url: this.url, isoCountry: this.isoCountry, identifiers: this.identifiers, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NetworkInstance = NetworkInstance; function NetworkListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new NetworkContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Networks`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["isoCountry"] !== undefined) data["IsoCountry"] = params["isoCountry"]; if (params["mcc"] !== undefined) data["Mcc"] = params["mcc"]; if (params["mnc"] !== undefined) data["Mnc"] = params["mnc"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new NetworkPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new NetworkPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.NetworkListInstance = NetworkListInstance; class NetworkPage extends Page_1.default { /** * Initialize the NetworkPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of NetworkInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new NetworkInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NetworkPage = NetworkPage; rest/supersim/v1/smsCommand.js000064400000020315151677225100012364 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SmsCommandPage = exports.SmsCommandListInstance = exports.SmsCommandInstance = exports.SmsCommandContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class SmsCommandContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/SmsCommands/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SmsCommandInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SmsCommandContextImpl = SmsCommandContextImpl; class SmsCommandInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.simSid = payload.sim_sid; this.payload = payload.payload; this.status = payload.status; this.direction = payload.direction; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SmsCommandContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a SmsCommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SmsCommandInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, simSid: this.simSid, payload: this.payload, status: this.status, direction: this.direction, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SmsCommandInstance = SmsCommandInstance; function SmsCommandListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SmsCommandContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/SmsCommands`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["sim"] === null || params["sim"] === undefined) { throw new Error("Required parameter \"params['sim']\" missing."); } if (params["payload"] === null || params["payload"] === undefined) { throw new Error("Required parameter \"params['payload']\" missing."); } let data = {}; data["Sim"] = params["sim"]; data["Payload"] = params["payload"]; if (params["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SmsCommandInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["sim"] !== undefined) data["Sim"] = params["sim"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["direction"] !== undefined) data["Direction"] = params["direction"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SmsCommandPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new SmsCommandPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.SmsCommandListInstance = SmsCommandListInstance; class SmsCommandPage extends Page_1.default { /** * Initialize the SmsCommandPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of SmsCommandInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SmsCommandInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SmsCommandPage = SmsCommandPage; rest/supersim/v1/fleet.d.ts000064400000040052151677225100011616 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type FleetDataMetering = "payg"; /** * Options to pass to update a FleetInstance */ export interface FleetContextUpdateOptions { /** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */ uniqueName?: string; /** The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet\\\'s SIMs can connect to. */ networkAccessProfile?: string; /** The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */ ipCommandsUrl?: string; /** A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */ ipCommandsMethod?: string; /** The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */ smsCommandsUrl?: string; /** A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */ smsCommandsMethod?: string; /** The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). */ dataLimit?: number; } /** * Options to pass to create a FleetInstance */ export interface FleetListInstanceCreateOptions { /** The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet\\\'s SIMs can connect to. */ networkAccessProfile: string; /** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */ uniqueName?: string; /** Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. */ dataEnabled?: boolean; /** The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). */ dataLimit?: number; /** The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */ ipCommandsUrl?: string; /** A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */ ipCommandsMethod?: string; /** Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`. */ smsCommandsEnabled?: boolean; /** The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */ smsCommandsUrl?: string; /** A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */ smsCommandsMethod?: string; } /** * Options to pass to each */ export interface FleetListInstanceEachOptions { /** The SID or unique name of the Network Access Profile that controls which cellular networks the Fleet\'s SIMs can connect to. */ networkAccessProfile?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: FleetInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface FleetListInstanceOptions { /** The SID or unique name of the Network Access Profile that controls which cellular networks the Fleet\'s SIMs can connect to. */ networkAccessProfile?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface FleetListInstancePageOptions { /** The SID or unique name of the Network Access Profile that controls which cellular networks the Fleet\'s SIMs can connect to. */ networkAccessProfile?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface FleetContext { /** * Fetch a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ fetch(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Update a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ update(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Update a FleetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ update(params: FleetContextUpdateOptions, callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FleetContextSolution { sid: string; } export declare class FleetContextImpl implements FleetContext { protected _version: V1; protected _solution: FleetContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; update(params?: FleetContextUpdateOptions | ((error: Error | null, item?: FleetInstance) => any), callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FleetContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FleetPayload extends TwilioResponsePayload { fleets: FleetResource[]; } interface FleetResource { account_sid: string; sid: string; unique_name: string; date_created: Date; date_updated: Date; url: string; data_enabled: boolean; data_limit: number; data_metering: FleetDataMetering; sms_commands_enabled: boolean; sms_commands_url: string; sms_commands_method: string; network_access_profile_sid: string; ip_commands_url: string; ip_commands_method: string; } export declare class FleetInstance { protected _version: V1; protected _solution: FleetContextSolution; protected _context?: FleetContext; constructor(_version: V1, payload: FleetResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Fleet resource. */ accountSid: string; /** * The unique string that we created to identify the Fleet resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Fleet resource. */ url: string; /** * Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. */ dataEnabled: boolean; /** * The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 250MB. */ dataLimit: number; dataMetering: FleetDataMetering; /** * Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `false`. */ smsCommandsEnabled: boolean; /** * The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */ smsCommandsUrl: string; /** * A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */ smsCommandsMethod: string; /** * The SID of the Network Access Profile that controls which cellular networks the Fleet\'s SIMs can connect to. */ networkAccessProfileSid: string; /** * The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */ ipCommandsUrl: string; /** * A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. */ ipCommandsMethod: string; private get _proxy(); /** * Fetch a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ fetch(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Update a FleetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ update(callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Update a FleetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ update(params: FleetContextUpdateOptions, callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; uniqueName: string; dateCreated: Date; dateUpdated: Date; url: string; dataEnabled: boolean; dataLimit: number; dataMetering: "payg"; smsCommandsEnabled: boolean; smsCommandsUrl: string; smsCommandsMethod: string; networkAccessProfileSid: string; ipCommandsUrl: string; ipCommandsMethod: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FleetSolution { } export interface FleetListInstance { _version: V1; _solution: FleetSolution; _uri: string; (sid: string): FleetContext; get(sid: string): FleetContext; /** * Create a FleetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FleetInstance */ create(params: FleetListInstanceCreateOptions, callback?: (error: Error | null, item?: FleetInstance) => any): Promise<FleetInstance>; /** * Streams FleetInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { FleetListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: FleetInstance, done: (err?: Error) => void) => void): void; each(params: FleetListInstanceEachOptions, callback?: (item: FleetInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of FleetInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: FleetPage) => any): Promise<FleetPage>; /** * Lists FleetInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { FleetListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: FleetInstance[]) => any): Promise<FleetInstance[]>; list(params: FleetListInstanceOptions, callback?: (error: Error | null, items: FleetInstance[]) => any): Promise<FleetInstance[]>; /** * Retrieve a single page of FleetInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { FleetListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: FleetPage) => any): Promise<FleetPage>; page(params: FleetListInstancePageOptions, callback?: (error: Error | null, items: FleetPage) => any): Promise<FleetPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FleetListInstance(version: V1): FleetListInstance; export declare class FleetPage extends Page<V1, FleetPayload, FleetResource, FleetInstance> { /** * Initialize the FleetPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: FleetSolution); /** * Build an instance of FleetInstance * * @param payload - Payload response from the API */ getInstance(payload: FleetResource): FleetInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/supersim/V1.js000064400000006377151677225100010237 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Supersim * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const esimProfile_1 = require("./v1/esimProfile"); const fleet_1 = require("./v1/fleet"); const ipCommand_1 = require("./v1/ipCommand"); const network_1 = require("./v1/network"); const networkAccessProfile_1 = require("./v1/networkAccessProfile"); const settingsUpdate_1 = require("./v1/settingsUpdate"); const sim_1 = require("./v1/sim"); const smsCommand_1 = require("./v1/smsCommand"); const usageRecord_1 = require("./v1/usageRecord"); class V1 extends Version_1.default { /** * Initialize the V1 version of Supersim * * @param domain - The Twilio (Twilio.Supersim) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for esimProfiles resource */ get esimProfiles() { this._esimProfiles = this._esimProfiles || (0, esimProfile_1.EsimProfileListInstance)(this); return this._esimProfiles; } /** Getter for fleets resource */ get fleets() { this._fleets = this._fleets || (0, fleet_1.FleetListInstance)(this); return this._fleets; } /** Getter for ipCommands resource */ get ipCommands() { this._ipCommands = this._ipCommands || (0, ipCommand_1.IpCommandListInstance)(this); return this._ipCommands; } /** Getter for networks resource */ get networks() { this._networks = this._networks || (0, network_1.NetworkListInstance)(this); return this._networks; } /** Getter for networkAccessProfiles resource */ get networkAccessProfiles() { this._networkAccessProfiles = this._networkAccessProfiles || (0, networkAccessProfile_1.NetworkAccessProfileListInstance)(this); return this._networkAccessProfiles; } /** Getter for settingsUpdates resource */ get settingsUpdates() { this._settingsUpdates = this._settingsUpdates || (0, settingsUpdate_1.SettingsUpdateListInstance)(this); return this._settingsUpdates; } /** Getter for sims resource */ get sims() { this._sims = this._sims || (0, sim_1.SimListInstance)(this); return this._sims; } /** Getter for smsCommands resource */ get smsCommands() { this._smsCommands = this._smsCommands || (0, smsCommand_1.SmsCommandListInstance)(this); return this._smsCommands; } /** Getter for usageRecords resource */ get usageRecords() { this._usageRecords = this._usageRecords || (0, usageRecord_1.UsageRecordListInstance)(this); return this._usageRecords; } } exports.default = V1; rest/proxy/V1.d.ts000064400000001024151677225100007765 0ustar00import ProxyBase from "../ProxyBase"; import Version from "../../base/Version"; import { ServiceListInstance } from "./v1/service"; export default class V1 extends Version { /** * Initialize the V1 version of Proxy * * @param domain - The Twilio (Twilio.Proxy) domain */ constructor(domain: ProxyBase); /** services - { Twilio.Proxy.V1.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** Getter for services resource */ get services(): ServiceListInstance; } rest/proxy/v1/service.d.ts000064400000042561151677225100011500 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { PhoneNumberListInstance } from "./service/phoneNumber"; import { SessionListInstance } from "./service/session"; import { ShortCodeListInstance } from "./service/shortCode"; export type ServiceGeoMatchLevel = "area-code" | "overlay" | "radius" | "country"; export type ServiceNumberSelectionBehavior = "avoid-sticky" | "prefer-sticky"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** */ uniqueName?: string; /** The default `ttl` value to set for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session\\\'s last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session\\\'s default TTL value by setting its `ttl` value. */ defaultTtl?: number; /** The URL we should call when the interaction status changes. */ callbackUrl?: string; /** */ geoMatchLevel?: ServiceGeoMatchLevel; /** */ numberSelectionBehavior?: ServiceNumberSelectionBehavior; /** The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. */ interceptCallbackUrl?: string; /** The URL we should call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/en-us/serverless/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. */ outOfSessionCallbackUrl?: string; /** The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. */ chatInstanceSid?: string; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** */ uniqueName: string; /** The default `ttl` value to set for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session\\\'s last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session\\\'s default TTL value by setting its `ttl` value. */ defaultTtl?: number; /** The URL we should call when the interaction status changes. */ callbackUrl?: string; /** */ geoMatchLevel?: ServiceGeoMatchLevel; /** */ numberSelectionBehavior?: ServiceNumberSelectionBehavior; /** The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. */ interceptCallbackUrl?: string; /** The URL we should call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/en-us/serverless/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. */ outOfSessionCallbackUrl?: string; /** The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. */ chatInstanceSid?: string; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { phoneNumbers: PhoneNumberListInstance; sessions: SessionListInstance; shortCodes: ShortCodeListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V1; protected _solution: ServiceContextSolution; protected _uri: string; protected _phoneNumbers?: PhoneNumberListInstance; protected _sessions?: SessionListInstance; protected _shortCodes?: ShortCodeListInstance; constructor(_version: V1, sid: string); get phoneNumbers(): PhoneNumberListInstance; get sessions(): SessionListInstance; get shortCodes(): ShortCodeListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; unique_name: string; account_sid: string; chat_instance_sid: string; callback_url: string; default_ttl: number; number_selection_behavior: ServiceNumberSelectionBehavior; geo_match_level: ServiceGeoMatchLevel; intercept_callback_url: string; out_of_session_callback_url: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ServiceInstance { protected _version: V1; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V1, payload: ServiceResource, sid?: string); /** * The unique string that we created to identify the Service resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. */ accountSid: string; /** * The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. */ chatInstanceSid: string; /** * The URL we call when the interaction status changes. */ callbackUrl: string; /** * The default `ttl` value for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session\'s last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session\'s default TTL value by setting its `ttl` value. */ defaultTtl: number; numberSelectionBehavior: ServiceNumberSelectionBehavior; geoMatchLevel: ServiceGeoMatchLevel; /** * The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. */ interceptCallbackUrl: string; /** * The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/en-us/serverless/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. */ outOfSessionCallbackUrl: string; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. */ dateCreated: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. */ dateUpdated: Date; /** * The absolute URL of the Service resource. */ url: string; /** * The URLs of resources related to the Service. */ links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the phoneNumbers. */ phoneNumbers(): PhoneNumberListInstance; /** * Access the sessions. */ sessions(): SessionListInstance; /** * Access the shortCodes. */ shortCodes(): ShortCodeListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; chatInstanceSid: string; callbackUrl: string; defaultTtl: number; numberSelectionBehavior: ServiceNumberSelectionBehavior; geoMatchLevel: ServiceGeoMatchLevel; interceptCallbackUrl: string; outOfSessionCallbackUrl: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V1; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V1): ServiceListInstance; export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/proxy/v1/service.js000064400000030712151677225100011237 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Proxy * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const phoneNumber_1 = require("./service/phoneNumber"); const session_1 = require("./service/session"); const shortCode_1 = require("./service/shortCode"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get phoneNumbers() { this._phoneNumbers = this._phoneNumbers || (0, phoneNumber_1.PhoneNumberListInstance)(this._version, this._solution.sid); return this._phoneNumbers; } get sessions() { this._sessions = this._sessions || (0, session_1.SessionListInstance)(this._version, this._solution.sid); return this._sessions; } get shortCodes() { this._shortCodes = this._shortCodes || (0, shortCode_1.ShortCodeListInstance)(this._version, this._solution.sid); return this._shortCodes; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["defaultTtl"] !== undefined) data["DefaultTtl"] = params["defaultTtl"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["geoMatchLevel"] !== undefined) data["GeoMatchLevel"] = params["geoMatchLevel"]; if (params["numberSelectionBehavior"] !== undefined) data["NumberSelectionBehavior"] = params["numberSelectionBehavior"]; if (params["interceptCallbackUrl"] !== undefined) data["InterceptCallbackUrl"] = params["interceptCallbackUrl"]; if (params["outOfSessionCallbackUrl"] !== undefined) data["OutOfSessionCallbackUrl"] = params["outOfSessionCallbackUrl"]; if (params["chatInstanceSid"] !== undefined) data["ChatInstanceSid"] = params["chatInstanceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.chatInstanceSid = payload.chat_instance_sid; this.callbackUrl = payload.callback_url; this.defaultTtl = deserialize.integer(payload.default_ttl); this.numberSelectionBehavior = payload.number_selection_behavior; this.geoMatchLevel = payload.geo_match_level; this.interceptCallbackUrl = payload.intercept_callback_url; this.outOfSessionCallbackUrl = payload.out_of_session_callback_url; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the phoneNumbers. */ phoneNumbers() { return this._proxy.phoneNumbers; } /** * Access the sessions. */ sessions() { return this._proxy.sessions; } /** * Access the shortCodes. */ shortCodes() { return this._proxy.shortCodes; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, chatInstanceSid: this.chatInstanceSid, callbackUrl: this.callbackUrl, defaultTtl: this.defaultTtl, numberSelectionBehavior: this.numberSelectionBehavior, geoMatchLevel: this.geoMatchLevel, interceptCallbackUrl: this.interceptCallbackUrl, outOfSessionCallbackUrl: this.outOfSessionCallbackUrl, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["uniqueName"] === null || params["uniqueName"] === undefined) { throw new Error("Required parameter \"params['uniqueName']\" missing."); } let data = {}; data["UniqueName"] = params["uniqueName"]; if (params["defaultTtl"] !== undefined) data["DefaultTtl"] = params["defaultTtl"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["geoMatchLevel"] !== undefined) data["GeoMatchLevel"] = params["geoMatchLevel"]; if (params["numberSelectionBehavior"] !== undefined) data["NumberSelectionBehavior"] = params["numberSelectionBehavior"]; if (params["interceptCallbackUrl"] !== undefined) data["InterceptCallbackUrl"] = params["interceptCallbackUrl"]; if (params["outOfSessionCallbackUrl"] !== undefined) data["OutOfSessionCallbackUrl"] = params["outOfSessionCallbackUrl"]; if (params["chatInstanceSid"] !== undefined) data["ChatInstanceSid"] = params["chatInstanceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/proxy/v1/service/session.js000064400000027430151677225100012725 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Proxy * 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.SessionPage = exports.SessionListInstance = exports.SessionInstance = exports.SessionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const interaction_1 = require("./session/interaction"); const participant_1 = require("./session/participant"); class SessionContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Sessions/${sid}`; } get interactions() { this._interactions = this._interactions || (0, interaction_1.InteractionListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._interactions; } get participants() { this._participants = this._participants || (0, participant_1.ParticipantListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._participants; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SessionInstance(operationVersion, payload, instance._solution.serviceSid, 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["dateExpiry"] !== undefined) data["DateExpiry"] = serialize.iso8601DateTime(params["dateExpiry"]); if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["status"] !== undefined) data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SessionInstance(operationVersion, payload, instance._solution.serviceSid, 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.SessionContextImpl = SessionContextImpl; class SessionInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.serviceSid = payload.service_sid; this.accountSid = payload.account_sid; this.dateStarted = deserialize.iso8601DateTime(payload.date_started); this.dateEnded = deserialize.iso8601DateTime(payload.date_ended); this.dateLastInteraction = deserialize.iso8601DateTime(payload.date_last_interaction); this.dateExpiry = deserialize.iso8601DateTime(payload.date_expiry); this.uniqueName = payload.unique_name; this.status = payload.status; this.closedReason = payload.closed_reason; this.ttl = deserialize.integer(payload.ttl); this.mode = payload.mode; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SessionContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a SessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SessionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the interactions. */ interactions() { return this._proxy.interactions; } /** * Access the participants. */ participants() { return this._proxy.participants; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, serviceSid: this.serviceSid, accountSid: this.accountSid, dateStarted: this.dateStarted, dateEnded: this.dateEnded, dateLastInteraction: this.dateLastInteraction, dateExpiry: this.dateExpiry, uniqueName: this.uniqueName, status: this.status, closedReason: this.closedReason, ttl: this.ttl, mode: this.mode, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SessionInstance = SessionInstance; function SessionListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SessionContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Sessions`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["dateExpiry"] !== undefined) data["DateExpiry"] = serialize.iso8601DateTime(params["dateExpiry"]); if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["mode"] !== undefined) data["Mode"] = params["mode"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["participants"] !== undefined) data["Participants"] = serialize.map(params["participants"], (e) => serialize.object(e)); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SessionInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SessionPage(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 SessionPage(instance._version, payload, 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; } exports.SessionListInstance = SessionListInstance; class SessionPage extends Page_1.default { /** * Initialize the SessionPage * * @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 SessionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SessionInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SessionPage = SessionPage; rest/proxy/v1/service/session/interaction.d.ts000064400000030155151677225100015476 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type InteractionResourceStatus = "accepted" | "answered" | "busy" | "canceled" | "completed" | "deleted" | "delivered" | "delivery-unknown" | "failed" | "in-progress" | "initiated" | "no-answer" | "queued" | "received" | "receiving" | "ringing" | "scheduled" | "sending" | "sent" | "undelivered" | "unknown"; export type InteractionType = "message" | "voice" | "unknown"; /** * Options to pass to each */ export interface InteractionListInstanceEachOptions { /** 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: InteractionInstance, 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 InteractionListInstanceOptions { /** 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 InteractionListInstancePageOptions { /** 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 InteractionContext { /** * Remove a InteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionInstance */ fetch(callback?: (error: Error | null, item?: InteractionInstance) => any): Promise<InteractionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InteractionContextSolution { serviceSid: string; sessionSid: string; sid: string; } export declare class InteractionContextImpl implements InteractionContext { protected _version: V1; protected _solution: InteractionContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sessionSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: InteractionInstance) => any): Promise<InteractionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InteractionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InteractionPayload extends TwilioResponsePayload { interactions: InteractionResource[]; } interface InteractionResource { sid: string; session_sid: string; service_sid: string; account_sid: string; data: string; type: InteractionType; inbound_participant_sid: string; inbound_resource_sid: string; inbound_resource_status: InteractionResourceStatus; inbound_resource_type: string; inbound_resource_url: string; outbound_participant_sid: string; outbound_resource_sid: string; outbound_resource_status: InteractionResourceStatus; outbound_resource_type: string; outbound_resource_url: string; date_created: Date; date_updated: Date; url: string; } export declare class InteractionInstance { protected _version: V1; protected _solution: InteractionContextSolution; protected _context?: InteractionContext; constructor(_version: V1, payload: InteractionResource, serviceSid: string, sessionSid: string, sid?: string); /** * The unique string that we created to identify the Interaction resource. */ sid: string; /** * The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. */ sessionSid: string; /** * The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. */ serviceSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Interaction resource. */ accountSid: string; /** * A JSON string that includes the message body of message interactions (e.g. `{\"body\": \"hello\"}`) or the call duration (when available) of a call (e.g. `{\"duration\": \"5\"}`). */ data: string; type: InteractionType; /** * The SID of the inbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. */ inboundParticipantSid: string; /** * The SID of the inbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). */ inboundResourceSid: string; inboundResourceStatus: InteractionResourceStatus; /** * The inbound resource type. Can be [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). */ inboundResourceType: string; /** * The URL of the Twilio inbound resource */ inboundResourceUrl: string; /** * The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant)). */ outboundParticipantSid: string; /** * The SID of the outbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). */ outboundResourceSid: string; outboundResourceStatus: InteractionResourceStatus; /** * The outbound resource type. Can be: [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). */ outboundResourceType: string; /** * The URL of the Twilio outbound resource. */ outboundResourceUrl: string; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Interaction was created. */ dateCreated: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. */ dateUpdated: Date; /** * The absolute URL of the Interaction resource. */ url: string; private get _proxy(); /** * Remove a InteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionInstance */ fetch(callback?: (error: Error | null, item?: InteractionInstance) => any): Promise<InteractionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; sessionSid: string; serviceSid: string; accountSid: string; data: string; type: InteractionType; inboundParticipantSid: string; inboundResourceSid: string; inboundResourceStatus: InteractionResourceStatus; inboundResourceType: string; inboundResourceUrl: string; outboundParticipantSid: string; outboundResourceSid: string; outboundResourceStatus: InteractionResourceStatus; outboundResourceType: string; outboundResourceUrl: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InteractionSolution { serviceSid: string; sessionSid: string; } export interface InteractionListInstance { _version: V1; _solution: InteractionSolution; _uri: string; (sid: string): InteractionContext; get(sid: string): InteractionContext; /** * Streams InteractionInstance 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 { InteractionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InteractionInstance, done: (err?: Error) => void) => void): void; each(params: InteractionListInstanceEachOptions, callback?: (item: InteractionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InteractionInstance 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: InteractionPage) => any): Promise<InteractionPage>; /** * Lists InteractionInstance 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 { InteractionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InteractionInstance[]) => any): Promise<InteractionInstance[]>; list(params: InteractionListInstanceOptions, callback?: (error: Error | null, items: InteractionInstance[]) => any): Promise<InteractionInstance[]>; /** * Retrieve a single page of InteractionInstance 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 { InteractionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InteractionPage) => any): Promise<InteractionPage>; page(params: InteractionListInstancePageOptions, callback?: (error: Error | null, items: InteractionPage) => any): Promise<InteractionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InteractionListInstance(version: V1, serviceSid: string, sessionSid: string): InteractionListInstance; export declare class InteractionPage extends Page<V1, InteractionPayload, InteractionResource, InteractionInstance> { /** * Initialize the InteractionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InteractionSolution); /** * Build an instance of InteractionInstance * * @param payload - Payload response from the API */ getInstance(payload: InteractionResource): InteractionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/proxy/v1/service/session/interaction.js000064400000022646151677225100015250 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Proxy * 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.InteractionPage = exports.InteractionListInstance = exports.InteractionInstance = exports.InteractionContextImpl = void 0; 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 InteractionContextImpl { constructor(_version, serviceSid, sessionSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sessionSid)) { throw new Error("Parameter 'sessionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sessionSid, sid }; this._uri = `/Services/${serviceSid}/Sessions/${sessionSid}/Interactions/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InteractionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sessionSid, 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.InteractionContextImpl = InteractionContextImpl; class InteractionInstance { constructor(_version, payload, serviceSid, sessionSid, sid) { this._version = _version; this.sid = payload.sid; this.sessionSid = payload.session_sid; this.serviceSid = payload.service_sid; this.accountSid = payload.account_sid; this.data = payload.data; this.type = payload.type; this.inboundParticipantSid = payload.inbound_participant_sid; this.inboundResourceSid = payload.inbound_resource_sid; this.inboundResourceStatus = payload.inbound_resource_status; this.inboundResourceType = payload.inbound_resource_type; this.inboundResourceUrl = payload.inbound_resource_url; this.outboundParticipantSid = payload.outbound_participant_sid; this.outboundResourceSid = payload.outbound_resource_sid; this.outboundResourceStatus = payload.outbound_resource_status; this.outboundResourceType = payload.outbound_resource_type; this.outboundResourceUrl = payload.outbound_resource_url; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, sessionSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InteractionContextImpl(this._version, this._solution.serviceSid, this._solution.sessionSid, this._solution.sid); return this._context; } /** * Remove a InteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a InteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, sessionSid: this.sessionSid, serviceSid: this.serviceSid, accountSid: this.accountSid, data: this.data, type: this.type, inboundParticipantSid: this.inboundParticipantSid, inboundResourceSid: this.inboundResourceSid, inboundResourceStatus: this.inboundResourceStatus, inboundResourceType: this.inboundResourceType, inboundResourceUrl: this.inboundResourceUrl, outboundParticipantSid: this.outboundParticipantSid, outboundResourceSid: this.outboundResourceSid, outboundResourceStatus: this.outboundResourceStatus, outboundResourceType: this.outboundResourceType, outboundResourceUrl: this.outboundResourceUrl, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InteractionInstance = InteractionInstance; function InteractionListInstance(version, serviceSid, sessionSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sessionSid)) { throw new Error("Parameter 'sessionSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InteractionContextImpl(version, serviceSid, sessionSid, sid); }; instance._version = version; instance._solution = { serviceSid, sessionSid }; instance._uri = `/Services/${serviceSid}/Sessions/${sessionSid}/Interactions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InteractionPage(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 InteractionPage(instance._version, payload, 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; } exports.InteractionListInstance = InteractionListInstance; class InteractionPage extends Page_1.default { /** * Initialize the InteractionPage * * @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 InteractionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InteractionInstance(this._version, payload, this._solution.serviceSid, this._solution.sessionSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InteractionPage = InteractionPage; rest/proxy/v1/service/session/participant/messageInteraction.js000064400000025465151677225100021075 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Proxy * 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.MessageInteractionPage = exports.MessageInteractionListInstance = exports.MessageInteractionInstance = exports.MessageInteractionContextImpl = void 0; 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 MessageInteractionContextImpl { constructor(_version, serviceSid, sessionSid, participantSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sessionSid)) { throw new Error("Parameter 'sessionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(participantSid)) { throw new Error("Parameter 'participantSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sessionSid, participantSid, sid }; this._uri = `/Services/${serviceSid}/Sessions/${sessionSid}/Participants/${participantSid}/MessageInteractions/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MessageInteractionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sessionSid, instance._solution.participantSid, 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.MessageInteractionContextImpl = MessageInteractionContextImpl; class MessageInteractionInstance { constructor(_version, payload, serviceSid, sessionSid, participantSid, sid) { this._version = _version; this.sid = payload.sid; this.sessionSid = payload.session_sid; this.serviceSid = payload.service_sid; this.accountSid = payload.account_sid; this.data = payload.data; this.type = payload.type; this.participantSid = payload.participant_sid; this.inboundParticipantSid = payload.inbound_participant_sid; this.inboundResourceSid = payload.inbound_resource_sid; this.inboundResourceStatus = payload.inbound_resource_status; this.inboundResourceType = payload.inbound_resource_type; this.inboundResourceUrl = payload.inbound_resource_url; this.outboundParticipantSid = payload.outbound_participant_sid; this.outboundResourceSid = payload.outbound_resource_sid; this.outboundResourceStatus = payload.outbound_resource_status; this.outboundResourceType = payload.outbound_resource_type; this.outboundResourceUrl = payload.outbound_resource_url; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, sessionSid, participantSid, sid: sid || this.sid, }; } get _proxy() { this._context = this._context || new MessageInteractionContextImpl(this._version, this._solution.serviceSid, this._solution.sessionSid, this._solution.participantSid, this._solution.sid); return this._context; } /** * Fetch a MessageInteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInteractionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, sessionSid: this.sessionSid, serviceSid: this.serviceSid, accountSid: this.accountSid, data: this.data, type: this.type, participantSid: this.participantSid, inboundParticipantSid: this.inboundParticipantSid, inboundResourceSid: this.inboundResourceSid, inboundResourceStatus: this.inboundResourceStatus, inboundResourceType: this.inboundResourceType, inboundResourceUrl: this.inboundResourceUrl, outboundParticipantSid: this.outboundParticipantSid, outboundResourceSid: this.outboundResourceSid, outboundResourceStatus: this.outboundResourceStatus, outboundResourceType: this.outboundResourceType, outboundResourceUrl: this.outboundResourceUrl, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessageInteractionInstance = MessageInteractionInstance; function MessageInteractionListInstance(version, serviceSid, sessionSid, participantSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sessionSid)) { throw new Error("Parameter 'sessionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(participantSid)) { throw new Error("Parameter 'participantSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MessageInteractionContextImpl(version, serviceSid, sessionSid, participantSid, sid); }; instance._version = version; instance._solution = { serviceSid, sessionSid, participantSid }; instance._uri = `/Services/${serviceSid}/Sessions/${sessionSid}/Participants/${participantSid}/MessageInteractions`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["body"] !== undefined) data["Body"] = params["body"]; if (params["mediaUrl"] !== undefined) data["MediaUrl"] = serialize.map(params["mediaUrl"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInteractionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sessionSid, instance._solution.participantSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInteractionPage(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 MessageInteractionPage(instance._version, payload, 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; } exports.MessageInteractionListInstance = MessageInteractionListInstance; class MessageInteractionPage extends Page_1.default { /** * Initialize the MessageInteractionPage * * @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 MessageInteractionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MessageInteractionInstance(this._version, payload, this._solution.serviceSid, this._solution.sessionSid, this._solution.participantSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessageInteractionPage = MessageInteractionPage; rest/proxy/v1/service/session/participant/messageInteraction.d.ts000064400000031557151677225100021330 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V1 from "../../../../V1"; export type MessageInteractionResourceStatus = "accepted" | "answered" | "busy" | "canceled" | "completed" | "deleted" | "delivered" | "delivery-unknown" | "failed" | "in-progress" | "initiated" | "no-answer" | "queued" | "received" | "receiving" | "ringing" | "scheduled" | "sending" | "sent" | "undelivered" | "unknown"; export type MessageInteractionType = "message" | "voice" | "unknown"; /** * Options to pass to create a MessageInteractionInstance */ export interface MessageInteractionListInstanceCreateOptions { /** The message to send to the participant */ body?: string; /** Reserved. Not currently supported. */ mediaUrl?: Array<string>; } /** * Options to pass to each */ export interface MessageInteractionListInstanceEachOptions { /** 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: MessageInteractionInstance, 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 MessageInteractionListInstanceOptions { /** 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 MessageInteractionListInstancePageOptions { /** 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 MessageInteractionContext { /** * Fetch a MessageInteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInteractionInstance */ fetch(callback?: (error: Error | null, item?: MessageInteractionInstance) => any): Promise<MessageInteractionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MessageInteractionContextSolution { serviceSid: string; sessionSid: string; participantSid: string; sid: string; } export declare class MessageInteractionContextImpl implements MessageInteractionContext { protected _version: V1; protected _solution: MessageInteractionContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sessionSid: string, participantSid: string, sid: string); fetch(callback?: (error: Error | null, item?: MessageInteractionInstance) => any): Promise<MessageInteractionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MessageInteractionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MessageInteractionPayload extends TwilioResponsePayload { interactions: MessageInteractionResource[]; } interface MessageInteractionResource { sid: string; session_sid: string; service_sid: string; account_sid: string; data: string; type: MessageInteractionType; participant_sid: string; inbound_participant_sid: string; inbound_resource_sid: string; inbound_resource_status: MessageInteractionResourceStatus; inbound_resource_type: string; inbound_resource_url: string; outbound_participant_sid: string; outbound_resource_sid: string; outbound_resource_status: MessageInteractionResourceStatus; outbound_resource_type: string; outbound_resource_url: string; date_created: Date; date_updated: Date; url: string; } export declare class MessageInteractionInstance { protected _version: V1; protected _solution: MessageInteractionContextSolution; protected _context?: MessageInteractionContext; constructor(_version: V1, payload: MessageInteractionResource, serviceSid: string, sessionSid: string, participantSid: string, sid?: string); /** * The unique string that we created to identify the MessageInteraction resource. */ sid: string; /** * The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. */ sessionSid: string; /** * The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. */ serviceSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MessageInteraction resource. */ accountSid: string; /** * A JSON string that includes the message body sent to the participant. (e.g. `{\"body\": \"hello\"}`) */ data: string; type: MessageInteractionType; /** * The SID of the [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. */ participantSid: string; /** * Always empty for created Message Interactions. */ inboundParticipantSid: string; /** * Always empty for created Message Interactions. */ inboundResourceSid: string; inboundResourceStatus: MessageInteractionResourceStatus; /** * Always empty for created Message Interactions. */ inboundResourceType: string; /** * Always empty for created Message Interactions. */ inboundResourceUrl: string; /** * The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. */ outboundParticipantSid: string; /** * The SID of the outbound [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. */ outboundResourceSid: string; outboundResourceStatus: MessageInteractionResourceStatus; /** * The outbound resource type. This value is always `Message`. */ outboundResourceType: string; /** * The URL of the Twilio message resource. */ outboundResourceUrl: string; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. */ dateCreated: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. */ dateUpdated: Date; /** * The absolute URL of the MessageInteraction resource. */ url: string; private get _proxy(); /** * Fetch a MessageInteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInteractionInstance */ fetch(callback?: (error: Error | null, item?: MessageInteractionInstance) => any): Promise<MessageInteractionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; sessionSid: string; serviceSid: string; accountSid: string; data: string; type: MessageInteractionType; participantSid: string; inboundParticipantSid: string; inboundResourceSid: string; inboundResourceStatus: MessageInteractionResourceStatus; inboundResourceType: string; inboundResourceUrl: string; outboundParticipantSid: string; outboundResourceSid: string; outboundResourceStatus: MessageInteractionResourceStatus; outboundResourceType: string; outboundResourceUrl: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MessageInteractionSolution { serviceSid: string; sessionSid: string; participantSid: string; } export interface MessageInteractionListInstance { _version: V1; _solution: MessageInteractionSolution; _uri: string; (sid: string): MessageInteractionContext; get(sid: string): MessageInteractionContext; /** * Create a MessageInteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInteractionInstance */ create(callback?: (error: Error | null, item?: MessageInteractionInstance) => any): Promise<MessageInteractionInstance>; /** * Create a MessageInteractionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInteractionInstance */ create(params: MessageInteractionListInstanceCreateOptions, callback?: (error: Error | null, item?: MessageInteractionInstance) => any): Promise<MessageInteractionInstance>; /** * Streams MessageInteractionInstance 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 { MessageInteractionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MessageInteractionInstance, done: (err?: Error) => void) => void): void; each(params: MessageInteractionListInstanceEachOptions, callback?: (item: MessageInteractionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MessageInteractionInstance 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: MessageInteractionPage) => any): Promise<MessageInteractionPage>; /** * Lists MessageInteractionInstance 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 { MessageInteractionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MessageInteractionInstance[]) => any): Promise<MessageInteractionInstance[]>; list(params: MessageInteractionListInstanceOptions, callback?: (error: Error | null, items: MessageInteractionInstance[]) => any): Promise<MessageInteractionInstance[]>; /** * Retrieve a single page of MessageInteractionInstance 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 { MessageInteractionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MessageInteractionPage) => any): Promise<MessageInteractionPage>; page(params: MessageInteractionListInstancePageOptions, callback?: (error: Error | null, items: MessageInteractionPage) => any): Promise<MessageInteractionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessageInteractionListInstance(version: V1, serviceSid: string, sessionSid: string, participantSid: string): MessageInteractionListInstance; export declare class MessageInteractionPage extends Page<V1, MessageInteractionPayload, MessageInteractionResource, MessageInteractionInstance> { /** * Initialize the MessageInteractionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: MessageInteractionSolution); /** * Build an instance of MessageInteractionInstance * * @param payload - Payload response from the API */ getInstance(payload: MessageInteractionResource): MessageInteractionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/proxy/v1/service/session/participant.js000064400000025010151677225100015233 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Proxy * 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.ParticipantPage = exports.ParticipantListInstance = exports.ParticipantInstance = exports.ParticipantContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const messageInteraction_1 = require("./participant/messageInteraction"); class ParticipantContextImpl { constructor(_version, serviceSid, sessionSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sessionSid)) { throw new Error("Parameter 'sessionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sessionSid, sid }; this._uri = `/Services/${serviceSid}/Sessions/${sessionSid}/Participants/${sid}`; } get messageInteractions() { this._messageInteractions = this._messageInteractions || (0, messageInteraction_1.MessageInteractionListInstance)(this._version, this._solution.serviceSid, this._solution.sessionSid, this._solution.sid); return this._messageInteractions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sessionSid, 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.ParticipantContextImpl = ParticipantContextImpl; class ParticipantInstance { constructor(_version, payload, serviceSid, sessionSid, sid) { this._version = _version; this.sid = payload.sid; this.sessionSid = payload.session_sid; this.serviceSid = payload.service_sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.identifier = payload.identifier; this.proxyIdentifier = payload.proxy_identifier; this.proxyIdentifierSid = payload.proxy_identifier_sid; this.dateDeleted = deserialize.iso8601DateTime(payload.date_deleted); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sessionSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ParticipantContextImpl(this._version, this._solution.serviceSid, this._solution.sessionSid, this._solution.sid); return this._context; } /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the messageInteractions. */ messageInteractions() { return this._proxy.messageInteractions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, sessionSid: this.sessionSid, serviceSid: this.serviceSid, accountSid: this.accountSid, friendlyName: this.friendlyName, identifier: this.identifier, proxyIdentifier: this.proxyIdentifier, proxyIdentifierSid: this.proxyIdentifierSid, dateDeleted: this.dateDeleted, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantInstance = ParticipantInstance; function ParticipantListInstance(version, serviceSid, sessionSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sessionSid)) { throw new Error("Parameter 'sessionSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ParticipantContextImpl(version, serviceSid, sessionSid, sid); }; instance._version = version; instance._solution = { serviceSid, sessionSid }; instance._uri = `/Services/${serviceSid}/Sessions/${sessionSid}/Participants`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identifier"] === null || params["identifier"] === undefined) { throw new Error("Required parameter \"params['identifier']\" missing."); } let data = {}; data["Identifier"] = params["identifier"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["proxyIdentifier"] !== undefined) data["ProxyIdentifier"] = params["proxyIdentifier"]; if (params["proxyIdentifierSid"] !== undefined) data["ProxyIdentifierSid"] = params["proxyIdentifierSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sessionSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantPage(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 ParticipantPage(instance._version, payload, 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; } exports.ParticipantListInstance = ParticipantListInstance; class ParticipantPage extends Page_1.default { /** * Initialize the ParticipantPage * * @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 ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ParticipantInstance(this._version, payload, this._solution.serviceSid, this._solution.sessionSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantPage = ParticipantPage; rest/proxy/v1/service/session/participant.d.ts000064400000027511151677225100015477 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; import { MessageInteractionListInstance } from "./participant/messageInteraction"; /** * Options to pass to create a ParticipantInstance */ export interface ParticipantListInstanceCreateOptions { /** The phone number of the Participant. */ identifier: string; /** The string that you assigned to describe the participant. This value must be 255 characters or fewer. **This value should not have PII.** */ friendlyName?: string; /** The proxy phone number to use for the Participant. If not specified, Proxy will select a number from the pool. */ proxyIdentifier?: string; /** The SID of the Proxy Identifier to assign to the Participant. */ proxyIdentifierSid?: string; } /** * Options to pass to each */ export interface ParticipantListInstanceEachOptions { /** 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: ParticipantInstance, 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 ParticipantListInstanceOptions { /** 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 ParticipantListInstancePageOptions { /** 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 ParticipantContext { messageInteractions: MessageInteractionListInstance; /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ParticipantContextSolution { serviceSid: string; sessionSid: string; sid: string; } export declare class ParticipantContextImpl implements ParticipantContext { protected _version: V1; protected _solution: ParticipantContextSolution; protected _uri: string; protected _messageInteractions?: MessageInteractionListInstance; constructor(_version: V1, serviceSid: string, sessionSid: string, sid: string); get messageInteractions(): MessageInteractionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ParticipantContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ParticipantPayload extends TwilioResponsePayload { participants: ParticipantResource[]; } interface ParticipantResource { sid: string; session_sid: string; service_sid: string; account_sid: string; friendly_name: string; identifier: string; proxy_identifier: string; proxy_identifier_sid: string; date_deleted: Date; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ParticipantInstance { protected _version: V1; protected _solution: ParticipantContextSolution; protected _context?: ParticipantContext; constructor(_version: V1, payload: ParticipantResource, serviceSid: string, sessionSid: string, sid?: string); /** * The unique string that we created to identify the Participant resource. */ sid: string; /** * The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. */ sessionSid: string; /** * The SID of the resource\'s parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. */ serviceSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. */ accountSid: string; /** * The string that you assigned to describe the participant. This value must be 255 characters or fewer. Supports UTF-8 characters. **This value should not have PII.** */ friendlyName: string; /** * The phone number or channel identifier of the Participant. This value must be 191 characters or fewer. Supports UTF-8 characters. */ identifier: string; /** * The phone number or short code (masked number) of the participant\'s partner. The participant will call or message the partner participant at this number. */ proxyIdentifier: string; /** * The SID of the Proxy Identifier assigned to the Participant. */ proxyIdentifierSid: string; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Participant was removed from the session. */ dateDeleted: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. */ dateCreated: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. */ dateUpdated: Date; /** * The absolute URL of the Participant resource. */ url: string; /** * The URLs to resources related the participant. */ links: Record<string, string>; private get _proxy(); /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Access the messageInteractions. */ messageInteractions(): MessageInteractionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; sessionSid: string; serviceSid: string; accountSid: string; friendlyName: string; identifier: string; proxyIdentifier: string; proxyIdentifierSid: string; dateDeleted: Date; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ParticipantSolution { serviceSid: string; sessionSid: string; } export interface ParticipantListInstance { _version: V1; _solution: ParticipantSolution; _uri: string; (sid: string): ParticipantContext; get(sid: string): ParticipantContext; /** * Create a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ create(params: ParticipantListInstanceCreateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Streams ParticipantInstance 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 { ParticipantListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; each(params: ParticipantListInstanceEachOptions, callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ParticipantInstance 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: ParticipantPage) => any): Promise<ParticipantPage>; /** * Lists ParticipantInstance 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 { ParticipantListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; list(params: ParticipantListInstanceOptions, callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; /** * Retrieve a single page of ParticipantInstance 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 { ParticipantListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; page(params: ParticipantListInstancePageOptions, callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ParticipantListInstance(version: V1, serviceSid: string, sessionSid: string): ParticipantListInstance; export declare class ParticipantPage extends Page<V1, ParticipantPayload, ParticipantResource, ParticipantInstance> { /** * Initialize the ParticipantPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ParticipantSolution); /** * Build an instance of ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload: ParticipantResource): ParticipantInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/proxy/v1/service/phoneNumber.js000064400000024230151677225100013517 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Proxy * 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.PhoneNumberPage = exports.PhoneNumberListInstance = exports.PhoneNumberInstance = exports.PhoneNumberContextImpl = void 0; 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 PhoneNumberContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/PhoneNumbers/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.serviceSid, 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["isReserved"] !== undefined) data["IsReserved"] = serialize.bool(params["isReserved"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.serviceSid, 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.PhoneNumberContextImpl = PhoneNumberContextImpl; class PhoneNumberInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.phoneNumber = payload.phone_number; this.friendlyName = payload.friendly_name; this.isoCountry = payload.iso_country; this.capabilities = payload.capabilities; this.url = payload.url; this.isReserved = payload.is_reserved; this.inUse = deserialize.integer(payload.in_use); this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PhoneNumberContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, phoneNumber: this.phoneNumber, friendlyName: this.friendlyName, isoCountry: this.isoCountry, capabilities: this.capabilities, url: this.url, isReserved: this.isReserved, inUse: this.inUse, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberInstance = PhoneNumberInstance; function PhoneNumberListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PhoneNumberContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/PhoneNumbers`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["sid"] !== undefined) data["Sid"] = params["sid"]; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["isReserved"] !== undefined) data["IsReserved"] = serialize.bool(params["isReserved"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberPage(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 PhoneNumberPage(instance._version, payload, 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; } exports.PhoneNumberListInstance = PhoneNumberListInstance; class PhoneNumberPage extends Page_1.default { /** * Initialize the PhoneNumberPage * * @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 PhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PhoneNumberInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberPage = PhoneNumberPage; rest/proxy/v1/service/session.d.ts000064400000034771151677225100013167 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { InteractionListInstance } from "./session/interaction"; import { ParticipantListInstance } from "./session/participant"; export type SessionMode = "message-only" | "voice-only" | "voice-and-message"; export type SessionStatus = "open" | "in-progress" | "closed" | "failed" | "unknown"; /** * Options to pass to update a SessionInstance */ export interface SessionContextUpdateOptions { /** The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. */ dateExpiry?: Date; /** The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session\\\'s last Interaction. */ ttl?: number; /** */ status?: SessionStatus; } /** * Options to pass to create a SessionInstance */ export interface SessionListInstanceCreateOptions { /** An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** */ uniqueName?: string; /** The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. */ dateExpiry?: Date; /** The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session\\\'s last Interaction. */ ttl?: number; /** */ mode?: SessionMode; /** */ status?: SessionStatus; /** The Participant objects to include in the new session. */ participants?: Array<any>; } /** * Options to pass to each */ export interface SessionListInstanceEachOptions { /** 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: SessionInstance, 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 SessionListInstanceOptions { /** 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 SessionListInstancePageOptions { /** 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 SessionContext { interactions: InteractionListInstance; participants: ParticipantListInstance; /** * Remove a SessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SessionInstance */ fetch(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; /** * Update a SessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SessionInstance */ update(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; /** * Update a SessionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SessionInstance */ update(params: SessionContextUpdateOptions, callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SessionContextSolution { serviceSid: string; sid: string; } export declare class SessionContextImpl implements SessionContext { protected _version: V1; protected _solution: SessionContextSolution; protected _uri: string; protected _interactions?: InteractionListInstance; protected _participants?: ParticipantListInstance; constructor(_version: V1, serviceSid: string, sid: string); get interactions(): InteractionListInstance; get participants(): ParticipantListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; update(params?: SessionContextUpdateOptions | ((error: Error | null, item?: SessionInstance) => any), callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SessionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SessionPayload extends TwilioResponsePayload { sessions: SessionResource[]; } interface SessionResource { sid: string; service_sid: string; account_sid: string; date_started: Date; date_ended: Date; date_last_interaction: Date; date_expiry: Date; unique_name: string; status: SessionStatus; closed_reason: string; ttl: number; mode: SessionMode; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class SessionInstance { protected _version: V1; protected _solution: SessionContextSolution; protected _context?: SessionContext; constructor(_version: V1, payload: SessionResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Session resource. */ sid: string; /** * The SID of the [Service](https://www.twilio.com/docs/proxy/api/service) the session is associated with. */ serviceSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Session resource. */ accountSid: string; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session started. */ dateStarted: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session ended. */ dateEnded: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session last had an interaction. */ dateLastInteraction: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. */ dateExpiry: Date; /** * An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** */ uniqueName: string; status: SessionStatus; /** * The reason the Session ended. */ closedReason: string; /** * The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session\'s last Interaction. */ ttl: number; mode: SessionMode; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. */ dateCreated: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. */ dateUpdated: Date; /** * The absolute URL of the Session resource. */ url: string; /** * The URLs of resources related to the Session. */ links: Record<string, string>; private get _proxy(); /** * Remove a SessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SessionInstance */ fetch(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; /** * Update a SessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SessionInstance */ update(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; /** * Update a SessionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SessionInstance */ update(params: SessionContextUpdateOptions, callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; /** * Access the interactions. */ interactions(): InteractionListInstance; /** * Access the participants. */ participants(): ParticipantListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; serviceSid: string; accountSid: string; dateStarted: Date; dateEnded: Date; dateLastInteraction: Date; dateExpiry: Date; uniqueName: string; status: SessionStatus; closedReason: string; ttl: number; mode: SessionMode; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SessionSolution { serviceSid: string; } export interface SessionListInstance { _version: V1; _solution: SessionSolution; _uri: string; (sid: string): SessionContext; get(sid: string): SessionContext; /** * Create a SessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SessionInstance */ create(callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; /** * Create a SessionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SessionInstance */ create(params: SessionListInstanceCreateOptions, callback?: (error: Error | null, item?: SessionInstance) => any): Promise<SessionInstance>; /** * Streams SessionInstance 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 { SessionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SessionInstance, done: (err?: Error) => void) => void): void; each(params: SessionListInstanceEachOptions, callback?: (item: SessionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SessionInstance 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: SessionPage) => any): Promise<SessionPage>; /** * Lists SessionInstance 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 { SessionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SessionInstance[]) => any): Promise<SessionInstance[]>; list(params: SessionListInstanceOptions, callback?: (error: Error | null, items: SessionInstance[]) => any): Promise<SessionInstance[]>; /** * Retrieve a single page of SessionInstance 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 { SessionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SessionPage) => any): Promise<SessionPage>; page(params: SessionListInstancePageOptions, callback?: (error: Error | null, items: SessionPage) => any): Promise<SessionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SessionListInstance(version: V1, serviceSid: string): SessionListInstance; export declare class SessionPage extends Page<V1, SessionPayload, SessionResource, SessionInstance> { /** * Initialize the SessionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SessionSolution); /** * Build an instance of SessionInstance * * @param payload - Payload response from the API */ getInstance(payload: SessionResource): SessionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/proxy/v1/service/phoneNumber.d.ts000064400000033127151677225100013760 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { PhoneNumberCapabilities } from "../../../../interfaces"; /** * Options to pass to update a PhoneNumberInstance */ export interface PhoneNumberContextUpdateOptions { /** Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. */ isReserved?: boolean; } /** * Options to pass to create a PhoneNumberInstance */ export interface PhoneNumberListInstanceCreateOptions { /** The SID of a Twilio [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the Twilio Number you would like to assign to your Proxy Service. */ sid?: string; /** The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. */ phoneNumber?: string; /** Whether the new phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. */ isReserved?: boolean; } /** * Options to pass to each */ export interface PhoneNumberListInstanceEachOptions { /** 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: PhoneNumberInstance, 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 PhoneNumberListInstanceOptions { /** 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 PhoneNumberListInstancePageOptions { /** 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 PhoneNumberContext { /** * Remove a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Update a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ update(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Update a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ update(params: PhoneNumberContextUpdateOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PhoneNumberContextSolution { serviceSid: string; sid: string; } export declare class PhoneNumberContextImpl implements PhoneNumberContext { protected _version: V1; protected _solution: PhoneNumberContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; update(params?: PhoneNumberContextUpdateOptions | ((error: Error | null, item?: PhoneNumberInstance) => any), callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PhoneNumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PhoneNumberPayload extends TwilioResponsePayload { phone_numbers: PhoneNumberResource[]; } interface PhoneNumberResource { sid: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; phone_number: string; friendly_name: string; iso_country: string; capabilities: PhoneNumberCapabilities; url: string; is_reserved: boolean; in_use: number; } export declare class PhoneNumberInstance { protected _version: V1; protected _solution: PhoneNumberContextSolution; protected _context?: PhoneNumberContext; constructor(_version: V1, payload: PhoneNumberResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the PhoneNumber resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. */ accountSid: string; /** * The SID of the PhoneNumber resource\'s parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. */ serviceSid: string; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. */ dateCreated: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. */ dateUpdated: Date; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The ISO Country Code for the phone number. */ isoCountry: string; capabilities: PhoneNumberCapabilities; /** * The absolute URL of the PhoneNumber resource. */ url: string; /** * Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. */ isReserved: boolean; /** * The number of open session assigned to the number. See the [How many Phone Numbers do I need?](https://www.twilio.com/docs/proxy/phone-numbers-needed) guide for more information. */ inUse: number; private get _proxy(); /** * Remove a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Update a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ update(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Update a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ update(params: PhoneNumberContextUpdateOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; phoneNumber: string; friendlyName: string; isoCountry: string; capabilities: PhoneNumberCapabilities; url: string; isReserved: boolean; inUse: number; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PhoneNumberSolution { serviceSid: string; } export interface PhoneNumberListInstance { _version: V1; _solution: PhoneNumberSolution; _uri: string; (sid: string): PhoneNumberContext; get(sid: string): PhoneNumberContext; /** * Create a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ create(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Create a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ create(params: PhoneNumberListInstanceCreateOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Streams PhoneNumberInstance 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 { PhoneNumberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void; each(params: PhoneNumberListInstanceEachOptions, callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PhoneNumberInstance 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: PhoneNumberPage) => any): Promise<PhoneNumberPage>; /** * Lists PhoneNumberInstance 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 { PhoneNumberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>; list(params: PhoneNumberListInstanceOptions, callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>; /** * Retrieve a single page of PhoneNumberInstance 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 { PhoneNumberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>; page(params: PhoneNumberListInstancePageOptions, callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PhoneNumberListInstance(version: V1, serviceSid: string): PhoneNumberListInstance; export declare class PhoneNumberPage extends Page<V1, PhoneNumberPayload, PhoneNumberResource, PhoneNumberInstance> { /** * Initialize the PhoneNumberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: PhoneNumberSolution); /** * Build an instance of PhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload: PhoneNumberResource): PhoneNumberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/proxy/v1/service/shortCode.d.ts000064400000030005151677225100013420 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { PhoneNumberCapabilities } from "../../../../interfaces"; /** * Options to pass to update a ShortCodeInstance */ export interface ShortCodeContextUpdateOptions { /** Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. */ isReserved?: boolean; } /** * Options to pass to create a ShortCodeInstance */ export interface ShortCodeListInstanceCreateOptions { /** The SID of a Twilio [ShortCode](https://www.twilio.com/en-us/messaging/channels/sms/short-codes) resource that represents the short code you would like to assign to your Proxy Service. */ sid: string; } /** * Options to pass to each */ export interface ShortCodeListInstanceEachOptions { /** 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: ShortCodeInstance, 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 ShortCodeListInstanceOptions { /** 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 ShortCodeListInstancePageOptions { /** 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 ShortCodeContext { /** * Remove a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Update a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ update(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Update a ShortCodeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ update(params: ShortCodeContextUpdateOptions, callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ShortCodeContextSolution { serviceSid: string; sid: string; } export declare class ShortCodeContextImpl implements ShortCodeContext { protected _version: V1; protected _solution: ShortCodeContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; update(params?: ShortCodeContextUpdateOptions | ((error: Error | null, item?: ShortCodeInstance) => any), callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ShortCodeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ShortCodePayload extends TwilioResponsePayload { short_codes: ShortCodeResource[]; } interface ShortCodeResource { sid: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; short_code: string; iso_country: string; capabilities: PhoneNumberCapabilities; url: string; is_reserved: boolean; } export declare class ShortCodeInstance { protected _version: V1; protected _solution: ShortCodeContextSolution; protected _context?: ShortCodeContext; constructor(_version: V1, payload: ShortCodeResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the ShortCode resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. */ accountSid: string; /** * The SID of the ShortCode resource\'s parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. */ serviceSid: string; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. */ dateCreated: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. */ dateUpdated: Date; /** * The short code\'s number. */ shortCode: string; /** * The ISO Country Code for the short code. */ isoCountry: string; capabilities: PhoneNumberCapabilities; /** * The absolute URL of the ShortCode resource. */ url: string; /** * Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. */ isReserved: boolean; private get _proxy(); /** * Remove a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Update a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ update(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Update a ShortCodeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ update(params: ShortCodeContextUpdateOptions, callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; shortCode: string; isoCountry: string; capabilities: PhoneNumberCapabilities; url: string; isReserved: boolean; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ShortCodeSolution { serviceSid: string; } export interface ShortCodeListInstance { _version: V1; _solution: ShortCodeSolution; _uri: string; (sid: string): ShortCodeContext; get(sid: string): ShortCodeContext; /** * Create a ShortCodeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ create(params: ShortCodeListInstanceCreateOptions, callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Streams ShortCodeInstance 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 { ShortCodeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void; each(params: ShortCodeListInstanceEachOptions, callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ShortCodeInstance 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: ShortCodePage) => any): Promise<ShortCodePage>; /** * Lists ShortCodeInstance 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 { ShortCodeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ShortCodeInstance[]) => any): Promise<ShortCodeInstance[]>; list(params: ShortCodeListInstanceOptions, callback?: (error: Error | null, items: ShortCodeInstance[]) => any): Promise<ShortCodeInstance[]>; /** * Retrieve a single page of ShortCodeInstance 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 { ShortCodeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ShortCodePage) => any): Promise<ShortCodePage>; page(params: ShortCodeListInstancePageOptions, callback?: (error: Error | null, items: ShortCodePage) => any): Promise<ShortCodePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ShortCodeListInstance(version: V1, serviceSid: string): ShortCodeListInstance; export declare class ShortCodePage extends Page<V1, ShortCodePayload, ShortCodeResource, ShortCodeInstance> { /** * Initialize the ShortCodePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ShortCodeSolution); /** * Build an instance of ShortCodeInstance * * @param payload - Payload response from the API */ getInstance(payload: ShortCodeResource): ShortCodeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/proxy/v1/service/shortCode.js000064400000023406151677225100013173 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Proxy * 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.ShortCodePage = exports.ShortCodeListInstance = exports.ShortCodeInstance = exports.ShortCodeContextImpl = void 0; 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 ShortCodeContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/ShortCodes/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ShortCodeInstance(operationVersion, payload, instance._solution.serviceSid, 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["isReserved"] !== undefined) data["IsReserved"] = serialize.bool(params["isReserved"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ShortCodeInstance(operationVersion, payload, instance._solution.serviceSid, 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.ShortCodeContextImpl = ShortCodeContextImpl; class ShortCodeInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.shortCode = payload.short_code; this.isoCountry = payload.iso_country; this.capabilities = payload.capabilities; this.url = payload.url; this.isReserved = payload.is_reserved; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ShortCodeContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, shortCode: this.shortCode, isoCountry: this.isoCountry, capabilities: this.capabilities, url: this.url, isReserved: this.isReserved, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ShortCodeInstance = ShortCodeInstance; function ShortCodeListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ShortCodeContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/ShortCodes`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["sid"] === null || params["sid"] === undefined) { throw new Error("Required parameter \"params['sid']\" missing."); } let data = {}; data["Sid"] = params["sid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ShortCodeInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ShortCodePage(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 ShortCodePage(instance._version, payload, 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; } exports.ShortCodeListInstance = ShortCodeListInstance; class ShortCodePage extends Page_1.default { /** * Initialize the ShortCodePage * * @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 ShortCodeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ShortCodeInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ShortCodePage = ShortCodePage; rest/proxy/V1.js000064400000002333151677225100007535 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Proxy * 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 service_1 = require("./v1/service"); class V1 extends Version_1.default { /** * Initialize the V1 version of Proxy * * @param domain - The Twilio (Twilio.Proxy) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } } exports.default = V1; rest/Pricing.d.ts000064400000001640151677225100007715 0ustar00import { MessagingListInstance } from "./pricing/v1/messaging"; import { PhoneNumberListInstance } from "./pricing/v1/phoneNumber"; import { VoiceListInstance } from "./pricing/v2/voice"; import { CountryListInstance } from "./pricing/v2/country"; import { NumberListInstance } from "./pricing/v2/number"; import PricingBase from "./PricingBase"; declare class Pricing extends PricingBase { /** * @deprecated - Use v1.messaging instead */ get messaging(): MessagingListInstance; /** * @deprecated - Use v1.phoneNumbers instead */ get phoneNumbers(): PhoneNumberListInstance; /** * @deprecated - Use v2.voice instead */ get voice(): VoiceListInstance; /** * @deprecated - Use v2.countries instead */ get countries(): CountryListInstance; /** * @deprecated - Use v2.numbers instead */ get numbers(): NumberListInstance; } export = Pricing; rest/FrontlineApi.d.ts000064400000000432151677225100010712 0ustar00import { UserListInstance } from "./frontlineApi/v1/user"; import FrontlineApiBase from "./FrontlineApiBase"; declare class FrontlineApi extends FrontlineApiBase { /** * @deprecated - Use v1.users instead */ get users(): UserListInstance; } export = FrontlineApi; rest/Accounts.js000064400000001753151677225100007652 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const AccountsBase_1 = __importDefault(require("./AccountsBase")); class Accounts extends AccountsBase_1.default { /** * @deprecated - Use v1.authTokenPromotion; instead */ get authTokenPromotion() { console.warn("authTokenPromotion is deprecated. Use v1.authTokenPromotion; instead."); return this.v1.authTokenPromotion; } /** * @deprecated - Use v1.credentials; instead */ get credentials() { console.warn("credentials is deprecated. Use v1.credentials; instead."); return this.v1.credentials; } /** * @deprecated - Use v1.secondaryAuthToken; instead */ get secondaryAuthToken() { console.warn("secondaryAuthToken is deprecated. Use v1.secondaryAuthToken; instead."); return this.v1.secondaryAuthToken; } } module.exports = Accounts; rest/studio/V2.d.ts000064400000001444151677225100010122 0ustar00import StudioBase from "../StudioBase"; import Version from "../../base/Version"; import { FlowListInstance } from "./v2/flow"; import { FlowValidateListInstance } from "./v2/flowValidate"; export default class V2 extends Version { /** * Initialize the V2 version of Studio * * @param domain - The Twilio (Twilio.Studio) domain */ constructor(domain: StudioBase); /** flows - { Twilio.Studio.V2.FlowListInstance } resource */ protected _flows?: FlowListInstance; /** flowValidate - { Twilio.Studio.V2.FlowValidateListInstance } resource */ protected _flowValidate?: FlowValidateListInstance; /** Getter for flows resource */ get flows(): FlowListInstance; /** Getter for flowValidate resource */ get flowValidate(): FlowValidateListInstance; } rest/studio/V1.d.ts000064400000000777151677225100010131 0ustar00import StudioBase from "../StudioBase"; import Version from "../../base/Version"; import { FlowListInstance } from "./v1/flow"; export default class V1 extends Version { /** * Initialize the V1 version of Studio * * @param domain - The Twilio (Twilio.Studio) domain */ constructor(domain: StudioBase); /** flows - { Twilio.Studio.V1.FlowListInstance } resource */ protected _flows?: FlowListInstance; /** Getter for flows resource */ get flows(): FlowListInstance; } rest/studio/V2.js000064400000002715151677225100007670 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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 flow_1 = require("./v2/flow"); const flowValidate_1 = require("./v2/flowValidate"); class V2 extends Version_1.default { /** * Initialize the V2 version of Studio * * @param domain - The Twilio (Twilio.Studio) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for flows resource */ get flows() { this._flows = this._flows || (0, flow_1.FlowListInstance)(this); return this._flows; } /** Getter for flowValidate resource */ get flowValidate() { this._flowValidate = this._flowValidate || (0, flowValidate_1.FlowValidateListInstance)(this); return this._flowValidate; } } exports.default = V2; rest/studio/v2/flow.js000064400000027022151677225100010675 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.FlowPage = exports.FlowListInstance = exports.FlowInstance = exports.FlowContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const execution_1 = require("./flow/execution"); const flowRevision_1 = require("./flow/flowRevision"); const flowTestUser_1 = require("./flow/flowTestUser"); class FlowContextImpl { 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 = `/Flows/${sid}`; } get executions() { this._executions = this._executions || (0, execution_1.ExecutionListInstance)(this._version, this._solution.sid); return this._executions; } get revisions() { this._revisions = this._revisions || (0, flowRevision_1.FlowRevisionListInstance)(this._version, this._solution.sid); return this._revisions; } get testUsers() { this._testUsers = this._testUsers || (0, flowTestUser_1.FlowTestUserListInstance)(this._version, this._solution.sid); return this._testUsers; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FlowInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["definition"] !== undefined) data["Definition"] = serialize.object(params["definition"]); if (params["commitMessage"] !== undefined) data["CommitMessage"] = params["commitMessage"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FlowInstance(operationVersion, payload, 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.FlowContextImpl = FlowContextImpl; class FlowInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.definition = payload.definition; this.status = payload.status; this.revision = deserialize.integer(payload.revision); this.commitMessage = payload.commit_message; this.valid = payload.valid; this.errors = payload.errors; this.warnings = payload.warnings; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.webhookUrl = payload.webhook_url; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new FlowContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the executions. */ executions() { return this._proxy.executions; } /** * Access the revisions. */ revisions() { return this._proxy.revisions; } /** * Access the testUsers. */ testUsers() { return this._proxy.testUsers; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, definition: this.definition, status: this.status, revision: this.revision, commitMessage: this.commitMessage, valid: this.valid, errors: this.errors, warnings: this.warnings, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, webhookUrl: this.webhookUrl, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlowInstance = FlowInstance; function FlowListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new FlowContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Flows`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } if (params["definition"] === null || params["definition"] === undefined) { throw new Error("Required parameter \"params['definition']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Status"] = params["status"]; data["Definition"] = serialize.object(params["definition"]); if (params["commitMessage"] !== undefined) data["CommitMessage"] = params["commitMessage"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FlowInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new FlowPage(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 FlowPage(instance._version, payload, 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; } exports.FlowListInstance = FlowListInstance; class FlowPage extends Page_1.default { /** * Initialize the FlowPage * * @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 FlowInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new FlowInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlowPage = FlowPage; rest/studio/v2/flow/flowRevision.js000064400000016560151677225100013370 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.FlowRevisionPage = exports.FlowRevisionListInstance = exports.FlowRevisionInstance = exports.FlowRevisionContextImpl = void 0; 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 FlowRevisionContextImpl { constructor(_version, sid, revision) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } if (!(0, utility_1.isValidPathParam)(revision)) { throw new Error("Parameter 'revision' is not valid."); } this._solution = { sid, revision }; this._uri = `/Flows/${sid}/Revisions/${revision}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FlowRevisionInstance(operationVersion, payload, instance._solution.sid, instance._solution.revision)); 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.FlowRevisionContextImpl = FlowRevisionContextImpl; class FlowRevisionInstance { constructor(_version, payload, sid, revision) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.definition = payload.definition; this.status = payload.status; this.revision = deserialize.integer(payload.revision); this.commitMessage = payload.commit_message; this.valid = payload.valid; this.errors = payload.errors; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { sid, revision: revision || this.revision.toString() }; } get _proxy() { this._context = this._context || new FlowRevisionContextImpl(this._version, this._solution.sid, this._solution.revision); return this._context; } /** * Fetch a FlowRevisionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowRevisionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, definition: this.definition, status: this.status, revision: this.revision, commitMessage: this.commitMessage, valid: this.valid, errors: this.errors, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlowRevisionInstance = FlowRevisionInstance; function FlowRevisionListInstance(version, sid) { if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = ((revision) => instance.get(revision)); instance.get = function get(revision) { return new FlowRevisionContextImpl(version, sid, revision); }; instance._version = version; instance._solution = { sid }; instance._uri = `/Flows/${sid}/Revisions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new FlowRevisionPage(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 FlowRevisionPage(instance._version, payload, 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; } exports.FlowRevisionListInstance = FlowRevisionListInstance; class FlowRevisionPage extends Page_1.default { /** * Initialize the FlowRevisionPage * * @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 FlowRevisionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new FlowRevisionInstance(this._version, payload, this._solution.sid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlowRevisionPage = FlowRevisionPage; rest/studio/v2/flow/execution.d.ts000064400000033255151677225100013141 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; import { ExecutionContextListInstance } from "./execution/executionContext"; import { ExecutionStepListInstance } from "./execution/executionStep"; export type ExecutionStatus = "active" | "ended"; /** * Options to pass to update a ExecutionInstance */ export interface ExecutionContextUpdateOptions { /** */ status: ExecutionStatus; } /** * Options to pass to create a ExecutionInstance */ export interface ExecutionListInstanceCreateOptions { /** The Contact phone number to start a Studio Flow Execution, available as variable `{{contact.channel.address}}`. */ to: string; /** The Twilio phone number to send messages or initiate calls from during the Flow\\\'s Execution. Available as variable `{{flow.channel.address}}`. For SMS, this can also be a Messaging Service SID. */ from: string; /** JSON data that will be added to the Flow\\\'s context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={\\\"name\\\":\\\"Zeke\\\"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns \\\"Zeke\\\". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. */ parameters?: any; } /** * Options to pass to each */ export interface ExecutionListInstanceEachOptions { /** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedFrom?: Date; /** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedTo?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ExecutionInstance, 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 ExecutionListInstanceOptions { /** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedFrom?: Date; /** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedTo?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ExecutionListInstancePageOptions { /** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedFrom?: Date; /** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedTo?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ExecutionContext { executionContext: ExecutionContextListInstance; steps: ExecutionStepListInstance; /** * Remove a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Update a ExecutionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExecutionContextSolution { flowSid: string; sid: string; } export declare class ExecutionContextImpl implements ExecutionContext { protected _version: V2; protected _solution: ExecutionContextSolution; protected _uri: string; protected _executionContext?: ExecutionContextListInstance; protected _steps?: ExecutionStepListInstance; constructor(_version: V2, flowSid: string, sid: string); get executionContext(): ExecutionContextListInstance; get steps(): ExecutionStepListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExecutionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExecutionPayload extends TwilioResponsePayload { executions: ExecutionResource[]; } interface ExecutionResource { sid: string; account_sid: string; flow_sid: string; contact_channel_address: string; context: any; status: ExecutionStatus; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ExecutionInstance { protected _version: V2; protected _solution: ExecutionContextSolution; protected _context?: ExecutionContext; constructor(_version: V2, payload: ExecutionResource, flowSid: string, sid?: string); /** * The unique string that we created to identify the Execution resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. */ accountSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. */ contactChannelAddress: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; status: ExecutionStatus; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of nested resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Update a ExecutionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Access the executionContext. */ executionContext(): ExecutionContextListInstance; /** * Access the steps. */ steps(): ExecutionStepListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; flowSid: string; contactChannelAddress: string; context: any; status: ExecutionStatus; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExecutionSolution { flowSid: string; } export interface ExecutionListInstance { _version: V2; _solution: ExecutionSolution; _uri: string; (sid: string): ExecutionContext; get(sid: string): ExecutionContext; /** * Create a ExecutionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ create(params: ExecutionListInstanceCreateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Streams ExecutionInstance 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 { ExecutionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void; each(params: ExecutionListInstanceEachOptions, callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ExecutionInstance 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: ExecutionPage) => any): Promise<ExecutionPage>; /** * Lists ExecutionInstance 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 { ExecutionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ExecutionInstance[]) => any): Promise<ExecutionInstance[]>; list(params: ExecutionListInstanceOptions, callback?: (error: Error | null, items: ExecutionInstance[]) => any): Promise<ExecutionInstance[]>; /** * Retrieve a single page of ExecutionInstance 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 { ExecutionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ExecutionPage) => any): Promise<ExecutionPage>; page(params: ExecutionListInstancePageOptions, callback?: (error: Error | null, items: ExecutionPage) => any): Promise<ExecutionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExecutionListInstance(version: V2, flowSid: string): ExecutionListInstance; export declare class ExecutionPage extends Page<V2, ExecutionPayload, ExecutionResource, ExecutionInstance> { /** * Initialize the ExecutionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ExecutionSolution); /** * Build an instance of ExecutionInstance * * @param payload - Payload response from the API */ getInstance(payload: ExecutionResource): ExecutionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/studio/v2/flow/execution.js000064400000026230151677225100012700 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.ExecutionPage = exports.ExecutionListInstance = exports.ExecutionInstance = exports.ExecutionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const executionContext_1 = require("./execution/executionContext"); const executionStep_1 = require("./execution/executionStep"); class ExecutionContextImpl { constructor(_version, flowSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { flowSid, sid }; this._uri = `/Flows/${flowSid}/Executions/${sid}`; } get executionContext() { this._executionContext = this._executionContext || (0, executionContext_1.ExecutionContextListInstance)(this._version, this._solution.flowSid, this._solution.sid); return this._executionContext; } get steps() { this._steps = this._steps || (0, executionStep_1.ExecutionStepListInstance)(this._version, this._solution.flowSid, this._solution.sid); return this._steps; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid, 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.ExecutionContextImpl = ExecutionContextImpl; class ExecutionInstance { constructor(_version, payload, flowSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.flowSid = payload.flow_sid; this.contactChannelAddress = payload.contact_channel_address; this.context = payload.context; this.status = payload.status; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { flowSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ExecutionContextImpl(this._version, this._solution.flowSid, this._solution.sid); return this._context; } /** * Remove a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the executionContext. */ executionContext() { return this._proxy.executionContext; } /** * Access the steps. */ steps() { return this._proxy.steps; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, flowSid: this.flowSid, contactChannelAddress: this.contactChannelAddress, context: this.context, status: this.status, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionInstance = ExecutionInstance; function ExecutionListInstance(version, flowSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ExecutionContextImpl(version, flowSid, sid); }; instance._version = version; instance._solution = { flowSid }; instance._uri = `/Flows/${flowSid}/Executions`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["to"] === null || params["to"] === undefined) { throw new Error("Required parameter \"params['to']\" missing."); } if (params["from"] === null || params["from"] === undefined) { throw new Error("Required parameter \"params['from']\" missing."); } let data = {}; data["To"] = params["to"]; data["From"] = params["from"]; if (params["parameters"] !== undefined) data["Parameters"] = serialize.object(params["parameters"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid)); 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["dateCreatedFrom"] !== undefined) data["DateCreatedFrom"] = serialize.iso8601DateTime(params["dateCreatedFrom"]); if (params["dateCreatedTo"] !== undefined) data["DateCreatedTo"] = serialize.iso8601DateTime(params["dateCreatedTo"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ExecutionPage(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 ExecutionPage(instance._version, payload, 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; } exports.ExecutionListInstance = ExecutionListInstance; class ExecutionPage extends Page_1.default { /** * Initialize the ExecutionPage * * @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 ExecutionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ExecutionInstance(this._version, payload, this._solution.flowSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionPage = ExecutionPage; rest/studio/v2/flow/flowTestUser.d.ts000064400000007717151677225100013610 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../V2"; /** * Options to pass to update a FlowTestUserInstance */ export interface FlowTestUserContextUpdateOptions { /** List of test user identities that can test draft versions of the flow. */ testUsers: Array<string>; } export interface FlowTestUserContext { /** * Fetch a FlowTestUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowTestUserInstance */ fetch(callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>; /** * Update a FlowTestUserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowTestUserInstance */ update(params: FlowTestUserContextUpdateOptions, callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FlowTestUserContextSolution { sid: string; } export declare class FlowTestUserContextImpl implements FlowTestUserContext { protected _version: V2; protected _solution: FlowTestUserContextSolution; protected _uri: string; constructor(_version: V2, sid: string); fetch(callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>; update(params: FlowTestUserContextUpdateOptions, callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FlowTestUserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FlowTestUserResource { sid: string; test_users: Array<string>; url: string; } export declare class FlowTestUserInstance { protected _version: V2; protected _solution: FlowTestUserContextSolution; protected _context?: FlowTestUserContext; constructor(_version: V2, payload: FlowTestUserResource, sid: string); /** * Unique identifier of the flow. */ sid: string; /** * List of test user identities that can test draft versions of the flow. */ testUsers: Array<string>; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a FlowTestUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowTestUserInstance */ fetch(callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>; /** * Update a FlowTestUserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowTestUserInstance */ update(params: FlowTestUserContextUpdateOptions, callback?: (error: Error | null, item?: FlowTestUserInstance) => any): Promise<FlowTestUserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; testUsers: string[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FlowTestUserSolution { sid: string; } export interface FlowTestUserListInstance { _version: V2; _solution: FlowTestUserSolution; _uri: string; (): FlowTestUserContext; get(): FlowTestUserContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FlowTestUserListInstance(version: V2, sid: string): FlowTestUserListInstance; export {}; rest/studio/v2/flow/flowTestUser.js000064400000011534151677225100013344 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.FlowTestUserListInstance = exports.FlowTestUserInstance = exports.FlowTestUserContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class FlowTestUserContextImpl { 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 = `/Flows/${sid}/TestUsers`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FlowTestUserInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["testUsers"] === null || params["testUsers"] === undefined) { throw new Error("Required parameter \"params['testUsers']\" missing."); } let data = {}; data["TestUsers"] = serialize.map(params["testUsers"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FlowTestUserInstance(operationVersion, payload, 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.FlowTestUserContextImpl = FlowTestUserContextImpl; class FlowTestUserInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.testUsers = payload.test_users; this.url = payload.url; this._solution = { sid }; } get _proxy() { this._context = this._context || new FlowTestUserContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a FlowTestUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowTestUserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, testUsers: this.testUsers, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlowTestUserInstance = FlowTestUserInstance; function FlowTestUserListInstance(version, sid) { if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new FlowTestUserContextImpl(version, sid); }; instance._version = version; instance._solution = { sid }; 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; } exports.FlowTestUserListInstance = FlowTestUserListInstance; rest/studio/v2/flow/flowRevision.d.ts000064400000022151151677225100013615 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type FlowRevisionStatus = "draft" | "published"; /** * Options to pass to each */ export interface FlowRevisionListInstanceEachOptions { /** 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: FlowRevisionInstance, 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 FlowRevisionListInstanceOptions { /** 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 FlowRevisionListInstancePageOptions { /** 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 FlowRevisionContext { /** * Fetch a FlowRevisionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowRevisionInstance */ fetch(callback?: (error: Error | null, item?: FlowRevisionInstance) => any): Promise<FlowRevisionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FlowRevisionContextSolution { sid: string; revision: string; } export declare class FlowRevisionContextImpl implements FlowRevisionContext { protected _version: V2; protected _solution: FlowRevisionContextSolution; protected _uri: string; constructor(_version: V2, sid: string, revision: string); fetch(callback?: (error: Error | null, item?: FlowRevisionInstance) => any): Promise<FlowRevisionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FlowRevisionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FlowRevisionPayload extends TwilioResponsePayload { revisions: FlowRevisionResource[]; } interface FlowRevisionResource { sid: string; account_sid: string; friendly_name: string; definition: any; status: FlowRevisionStatus; revision: number; commit_message: string; valid: boolean; errors: Array<any>; date_created: Date; date_updated: Date; url: string; } export declare class FlowRevisionInstance { protected _version: V2; protected _solution: FlowRevisionContextSolution; protected _context?: FlowRevisionContext; constructor(_version: V2, payload: FlowRevisionResource, sid: string, revision?: string); /** * The unique string that we created to identify the Flow resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. */ accountSid: string; /** * The string that you assigned to describe the Flow. */ friendlyName: string; /** * JSON representation of flow definition. */ definition: any; status: FlowRevisionStatus; /** * The latest revision number of the Flow\'s definition. */ revision: number; /** * Description of change made in the revision. */ commitMessage: string; /** * Boolean if the flow definition is valid. */ valid: boolean; /** * List of error in the flow definition. */ errors: Array<any>; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a FlowRevisionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowRevisionInstance */ fetch(callback?: (error: Error | null, item?: FlowRevisionInstance) => any): Promise<FlowRevisionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; definition: any; status: FlowRevisionStatus; revision: number; commitMessage: string; valid: boolean; errors: any[]; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FlowRevisionSolution { sid: string; } export interface FlowRevisionListInstance { _version: V2; _solution: FlowRevisionSolution; _uri: string; (revision: string): FlowRevisionContext; get(revision: string): FlowRevisionContext; /** * Streams FlowRevisionInstance 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 { FlowRevisionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: FlowRevisionInstance, done: (err?: Error) => void) => void): void; each(params: FlowRevisionListInstanceEachOptions, callback?: (item: FlowRevisionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of FlowRevisionInstance 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: FlowRevisionPage) => any): Promise<FlowRevisionPage>; /** * Lists FlowRevisionInstance 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 { FlowRevisionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: FlowRevisionInstance[]) => any): Promise<FlowRevisionInstance[]>; list(params: FlowRevisionListInstanceOptions, callback?: (error: Error | null, items: FlowRevisionInstance[]) => any): Promise<FlowRevisionInstance[]>; /** * Retrieve a single page of FlowRevisionInstance 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 { FlowRevisionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: FlowRevisionPage) => any): Promise<FlowRevisionPage>; page(params: FlowRevisionListInstancePageOptions, callback?: (error: Error | null, items: FlowRevisionPage) => any): Promise<FlowRevisionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FlowRevisionListInstance(version: V2, sid: string): FlowRevisionListInstance; export declare class FlowRevisionPage extends Page<V2, FlowRevisionPayload, FlowRevisionResource, FlowRevisionInstance> { /** * Initialize the FlowRevisionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: FlowRevisionSolution); /** * Build an instance of FlowRevisionInstance * * @param payload - Payload response from the API */ getInstance(payload: FlowRevisionResource): FlowRevisionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/studio/v2/flow/execution/executionContext.js000064400000010775151677225100016257 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.ExecutionContextListInstance = exports.ExecutionContextInstance = exports.ExecutionContextContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class ExecutionContextContextImpl { constructor(_version, flowSid, executionSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } this._solution = { flowSid, executionSid }; this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Context`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExecutionContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid)); 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.ExecutionContextContextImpl = ExecutionContextContextImpl; class ExecutionContextInstance { constructor(_version, payload, flowSid, executionSid) { this._version = _version; this.accountSid = payload.account_sid; this.context = payload.context; this.flowSid = payload.flow_sid; this.executionSid = payload.execution_sid; this.url = payload.url; this._solution = { flowSid, executionSid }; } get _proxy() { this._context = this._context || new ExecutionContextContextImpl(this._version, this._solution.flowSid, this._solution.executionSid); return this._context; } /** * Fetch a ExecutionContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionContextInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, context: this.context, flowSid: this.flowSid, executionSid: this.executionSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionContextInstance = ExecutionContextInstance; function ExecutionContextListInstance(version, flowSid, executionSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new ExecutionContextContextImpl(version, flowSid, executionSid); }; instance._version = version; instance._solution = { flowSid, executionSid }; 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; } exports.ExecutionContextListInstance = ExecutionContextListInstance; rest/studio/v2/flow/execution/executionStep.js000064400000020542151677225100015537 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.ExecutionStepPage = exports.ExecutionStepListInstance = exports.ExecutionStepInstance = exports.ExecutionStepContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const executionStepContext_1 = require("./executionStep/executionStepContext"); class ExecutionStepContextImpl { constructor(_version, flowSid, executionSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { flowSid, executionSid, sid }; this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps/${sid}`; } get stepContext() { this._stepContext = this._stepContext || (0, executionStepContext_1.ExecutionStepContextListInstance)(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.sid); return this._stepContext; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExecutionStepInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid, 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.ExecutionStepContextImpl = ExecutionStepContextImpl; class ExecutionStepInstance { constructor(_version, payload, flowSid, executionSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.flowSid = payload.flow_sid; this.executionSid = payload.execution_sid; this.name = payload.name; this.context = payload.context; this.transitionedFrom = payload.transitioned_from; this.transitionedTo = payload.transitioned_to; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { flowSid, executionSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ExecutionStepContextImpl(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.sid); return this._context; } /** * Fetch a ExecutionStepInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the stepContext. */ stepContext() { return this._proxy.stepContext; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, flowSid: this.flowSid, executionSid: this.executionSid, name: this.name, context: this.context, transitionedFrom: this.transitionedFrom, transitionedTo: this.transitionedTo, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionStepInstance = ExecutionStepInstance; function ExecutionStepListInstance(version, flowSid, executionSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ExecutionStepContextImpl(version, flowSid, executionSid, sid); }; instance._version = version; instance._solution = { flowSid, executionSid }; instance._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ExecutionStepPage(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 ExecutionStepPage(instance._version, payload, 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; } exports.ExecutionStepListInstance = ExecutionStepListInstance; class ExecutionStepPage extends Page_1.default { /** * Initialize the ExecutionStepPage * * @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 ExecutionStepInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ExecutionStepInstance(this._version, payload, this._solution.flowSid, this._solution.executionSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionStepPage = ExecutionStepPage; rest/studio/v2/flow/execution/executionStep/executionStepContext.d.ts000064400000007640151677225100022203 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../../../V2"; export interface ExecutionStepContextContext { /** * Fetch a ExecutionStepContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepContextInstance */ fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExecutionStepContextContextSolution { flowSid: string; executionSid: string; stepSid: string; } export declare class ExecutionStepContextContextImpl implements ExecutionStepContextContext { protected _version: V2; protected _solution: ExecutionStepContextContextSolution; protected _uri: string; constructor(_version: V2, flowSid: string, executionSid: string, stepSid: string); fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExecutionStepContextContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExecutionStepContextResource { account_sid: string; context: any; execution_sid: string; flow_sid: string; step_sid: string; url: string; } export declare class ExecutionStepContextInstance { protected _version: V2; protected _solution: ExecutionStepContextContextSolution; protected _context?: ExecutionStepContextContext; constructor(_version: V2, payload: ExecutionStepContextResource, flowSid: string, executionSid: string, stepSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. */ accountSid: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; /** * The SID of the context\'s Execution resource. */ executionSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the Step that the context is associated with. */ stepSid: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a ExecutionStepContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepContextInstance */ fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; context: any; executionSid: string; flowSid: string; stepSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExecutionStepContextSolution { flowSid: string; executionSid: string; stepSid: string; } export interface ExecutionStepContextListInstance { _version: V2; _solution: ExecutionStepContextSolution; _uri: string; (): ExecutionStepContextContext; get(): ExecutionStepContextContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExecutionStepContextListInstance(version: V2, flowSid: string, executionSid: string, stepSid: string): ExecutionStepContextListInstance; export {}; rest/studio/v2/flow/execution/executionStep/executionStepContext.js000064400000012030151677225100021734 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.ExecutionStepContextListInstance = exports.ExecutionStepContextInstance = exports.ExecutionStepContextContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); class ExecutionStepContextContextImpl { constructor(_version, flowSid, executionSid, stepSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(stepSid)) { throw new Error("Parameter 'stepSid' is not valid."); } this._solution = { flowSid, executionSid, stepSid }; this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps/${stepSid}/Context`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExecutionStepContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid, instance._solution.stepSid)); 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.ExecutionStepContextContextImpl = ExecutionStepContextContextImpl; class ExecutionStepContextInstance { constructor(_version, payload, flowSid, executionSid, stepSid) { this._version = _version; this.accountSid = payload.account_sid; this.context = payload.context; this.executionSid = payload.execution_sid; this.flowSid = payload.flow_sid; this.stepSid = payload.step_sid; this.url = payload.url; this._solution = { flowSid, executionSid, stepSid }; } get _proxy() { this._context = this._context || new ExecutionStepContextContextImpl(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.stepSid); return this._context; } /** * Fetch a ExecutionStepContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepContextInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, context: this.context, executionSid: this.executionSid, flowSid: this.flowSid, stepSid: this.stepSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionStepContextInstance = ExecutionStepContextInstance; function ExecutionStepContextListInstance(version, flowSid, executionSid, stepSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(stepSid)) { throw new Error("Parameter 'stepSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new ExecutionStepContextContextImpl(version, flowSid, executionSid, stepSid); }; instance._version = version; instance._solution = { flowSid, executionSid, stepSid }; 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; } exports.ExecutionStepContextListInstance = ExecutionStepContextListInstance; rest/studio/v2/flow/execution/executionStep.d.ts000064400000023535151677225100016000 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; import { ExecutionStepContextListInstance } from "./executionStep/executionStepContext"; /** * Options to pass to each */ export interface ExecutionStepListInstanceEachOptions { /** 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: ExecutionStepInstance, 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 ExecutionStepListInstanceOptions { /** 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 ExecutionStepListInstancePageOptions { /** 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 ExecutionStepContext { stepContext: ExecutionStepContextListInstance; /** * Fetch a ExecutionStepInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepInstance */ fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExecutionStepContextSolution { flowSid: string; executionSid: string; sid: string; } export declare class ExecutionStepContextImpl implements ExecutionStepContext { protected _version: V2; protected _solution: ExecutionStepContextSolution; protected _uri: string; protected _stepContext?: ExecutionStepContextListInstance; constructor(_version: V2, flowSid: string, executionSid: string, sid: string); get stepContext(): ExecutionStepContextListInstance; fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExecutionStepContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExecutionStepPayload extends TwilioResponsePayload { steps: ExecutionStepResource[]; } interface ExecutionStepResource { sid: string; account_sid: string; flow_sid: string; execution_sid: string; name: string; context: any; transitioned_from: string; transitioned_to: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ExecutionStepInstance { protected _version: V2; protected _solution: ExecutionStepContextSolution; protected _context?: ExecutionStepContext; constructor(_version: V2, payload: ExecutionStepResource, flowSid: string, executionSid: string, sid?: string); /** * The unique string that we created to identify the ExecutionStep resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. */ accountSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the Step\'s Execution resource. */ executionSid: string; /** * The event that caused the Flow to transition to the Step. */ name: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; /** * The Widget that preceded the Widget for the Step. */ transitionedFrom: string; /** * The Widget that will follow the Widget for the Step. */ transitionedTo: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a ExecutionStepInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepInstance */ fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>; /** * Access the stepContext. */ stepContext(): ExecutionStepContextListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; flowSid: string; executionSid: string; name: string; context: any; transitionedFrom: string; transitionedTo: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExecutionStepSolution { flowSid: string; executionSid: string; } export interface ExecutionStepListInstance { _version: V2; _solution: ExecutionStepSolution; _uri: string; (sid: string): ExecutionStepContext; get(sid: string): ExecutionStepContext; /** * Streams ExecutionStepInstance 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 { ExecutionStepListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void; each(params: ExecutionStepListInstanceEachOptions, callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ExecutionStepInstance 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: ExecutionStepPage) => any): Promise<ExecutionStepPage>; /** * Lists ExecutionStepInstance 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 { ExecutionStepListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ExecutionStepInstance[]) => any): Promise<ExecutionStepInstance[]>; list(params: ExecutionStepListInstanceOptions, callback?: (error: Error | null, items: ExecutionStepInstance[]) => any): Promise<ExecutionStepInstance[]>; /** * Retrieve a single page of ExecutionStepInstance 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 { ExecutionStepListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ExecutionStepPage) => any): Promise<ExecutionStepPage>; page(params: ExecutionStepListInstancePageOptions, callback?: (error: Error | null, items: ExecutionStepPage) => any): Promise<ExecutionStepPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExecutionStepListInstance(version: V2, flowSid: string, executionSid: string): ExecutionStepListInstance; export declare class ExecutionStepPage extends Page<V2, ExecutionStepPayload, ExecutionStepResource, ExecutionStepInstance> { /** * Initialize the ExecutionStepPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ExecutionStepSolution); /** * Build an instance of ExecutionStepInstance * * @param payload - Payload response from the API */ getInstance(payload: ExecutionStepResource): ExecutionStepInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/studio/v2/flow/execution/executionContext.d.ts000064400000007070151677225100016505 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../../V2"; export interface ExecutionContextContext { /** * Fetch a ExecutionContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionContextInstance */ fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExecutionContextContextSolution { flowSid: string; executionSid: string; } export declare class ExecutionContextContextImpl implements ExecutionContextContext { protected _version: V2; protected _solution: ExecutionContextContextSolution; protected _uri: string; constructor(_version: V2, flowSid: string, executionSid: string); fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExecutionContextContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExecutionContextResource { account_sid: string; context: any; flow_sid: string; execution_sid: string; url: string; } export declare class ExecutionContextInstance { protected _version: V2; protected _solution: ExecutionContextContextSolution; protected _context?: ExecutionContextContext; constructor(_version: V2, payload: ExecutionContextResource, flowSid: string, executionSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. */ accountSid: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the context\'s Execution resource. */ executionSid: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a ExecutionContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionContextInstance */ fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; context: any; flowSid: string; executionSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExecutionContextSolution { flowSid: string; executionSid: string; } export interface ExecutionContextListInstance { _version: V2; _solution: ExecutionContextSolution; _uri: string; (): ExecutionContextContext; get(): ExecutionContextContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExecutionContextListInstance(version: V2, flowSid: string, executionSid: string): ExecutionContextListInstance; export {}; rest/studio/v2/flowValidate.d.ts000064400000003466151677225100012611 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; export type FlowValidateStatus = "draft" | "published"; /** * Options to pass to update a FlowValidateInstance */ export interface FlowValidateListInstanceUpdateOptions { /** The string that you assigned to describe the Flow. */ friendlyName: string; /** */ status: FlowValidateStatus; /** JSON representation of flow definition. */ definition: any; /** Description of change made in the revision. */ commitMessage?: string; } export interface FlowValidateSolution { } export interface FlowValidateListInstance { _version: V2; _solution: FlowValidateSolution; _uri: string; /** * Update a FlowValidateInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowValidateInstance */ update(params: FlowValidateListInstanceUpdateOptions, callback?: (error: Error | null, item?: FlowValidateInstance) => any): Promise<FlowValidateInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FlowValidateListInstance(version: V2): FlowValidateListInstance; interface FlowValidateResource { valid: boolean; } export declare class FlowValidateInstance { protected _version: V2; constructor(_version: V2, payload: FlowValidateResource); /** * Boolean if the flow definition is valid. */ valid: boolean; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { valid: boolean; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/studio/v2/flow.d.ts000064400000030237151677225100011133 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; import { ExecutionListInstance } from "./flow/execution"; import { FlowRevisionListInstance } from "./flow/flowRevision"; import { FlowTestUserListInstance } from "./flow/flowTestUser"; export type FlowStatus = "draft" | "published"; /** * Options to pass to update a FlowInstance */ export interface FlowContextUpdateOptions { /** */ status: FlowStatus; /** The string that you assigned to describe the Flow. */ friendlyName?: string; /** JSON representation of flow definition. */ definition?: any; /** Description of change made in the revision. */ commitMessage?: string; } /** * Options to pass to create a FlowInstance */ export interface FlowListInstanceCreateOptions { /** The string that you assigned to describe the Flow. */ friendlyName: string; /** */ status: FlowStatus; /** JSON representation of flow definition. */ definition: any; /** Description of change made in the revision. */ commitMessage?: string; } /** * Options to pass to each */ export interface FlowListInstanceEachOptions { /** 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: FlowInstance, 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 FlowListInstanceOptions { /** 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 FlowListInstancePageOptions { /** 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 FlowContext { executions: ExecutionListInstance; revisions: FlowRevisionListInstance; testUsers: FlowTestUserListInstance; /** * Remove a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowInstance */ fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; /** * Update a FlowInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowInstance */ update(params: FlowContextUpdateOptions, callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FlowContextSolution { sid: string; } export declare class FlowContextImpl implements FlowContext { protected _version: V2; protected _solution: FlowContextSolution; protected _uri: string; protected _executions?: ExecutionListInstance; protected _revisions?: FlowRevisionListInstance; protected _testUsers?: FlowTestUserListInstance; constructor(_version: V2, sid: string); get executions(): ExecutionListInstance; get revisions(): FlowRevisionListInstance; get testUsers(): FlowTestUserListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; update(params: FlowContextUpdateOptions, callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FlowContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FlowPayload extends TwilioResponsePayload { flows: FlowResource[]; } interface FlowResource { sid: string; account_sid: string; friendly_name: string; definition: any; status: FlowStatus; revision: number; commit_message: string; valid: boolean; errors: Array<any>; warnings: Array<any>; date_created: Date; date_updated: Date; webhook_url: string; url: string; links: Record<string, string>; } export declare class FlowInstance { protected _version: V2; protected _solution: FlowContextSolution; protected _context?: FlowContext; constructor(_version: V2, payload: FlowResource, sid?: string); /** * The unique string that we created to identify the Flow resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. */ accountSid: string; /** * The string that you assigned to describe the Flow. */ friendlyName: string; /** * JSON representation of flow definition. */ definition: any; status: FlowStatus; /** * The latest revision number of the Flow\'s definition. */ revision: number; /** * Description of change made in the revision. */ commitMessage: string; /** * Boolean if the flow definition is valid. */ valid: boolean; /** * List of error in the flow definition. */ errors: Array<any>; /** * List of warnings in the flow definition. */ warnings: Array<any>; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; webhookUrl: string; /** * The absolute URL of the resource. */ url: string; /** * The URLs of the Flow\'s nested resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowInstance */ fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; /** * Update a FlowInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowInstance */ update(params: FlowContextUpdateOptions, callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; /** * Access the executions. */ executions(): ExecutionListInstance; /** * Access the revisions. */ revisions(): FlowRevisionListInstance; /** * Access the testUsers. */ testUsers(): FlowTestUserListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; definition: any; status: FlowStatus; revision: number; commitMessage: string; valid: boolean; errors: any[]; warnings: any[]; dateCreated: Date; dateUpdated: Date; webhookUrl: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FlowSolution { } export interface FlowListInstance { _version: V2; _solution: FlowSolution; _uri: string; (sid: string): FlowContext; get(sid: string): FlowContext; /** * Create a FlowInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowInstance */ create(params: FlowListInstanceCreateOptions, callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; /** * Streams FlowInstance 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 { FlowListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void; each(params: FlowListInstanceEachOptions, callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of FlowInstance 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: FlowPage) => any): Promise<FlowPage>; /** * Lists FlowInstance 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 { FlowListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: FlowInstance[]) => any): Promise<FlowInstance[]>; list(params: FlowListInstanceOptions, callback?: (error: Error | null, items: FlowInstance[]) => any): Promise<FlowInstance[]>; /** * Retrieve a single page of FlowInstance 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 { FlowListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: FlowPage) => any): Promise<FlowPage>; page(params: FlowListInstancePageOptions, callback?: (error: Error | null, items: FlowPage) => any): Promise<FlowPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FlowListInstance(version: V2): FlowListInstance; export declare class FlowPage extends Page<V2, FlowPayload, FlowResource, FlowInstance> { /** * Initialize the FlowPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: FlowSolution); /** * Build an instance of FlowInstance * * @param payload - Payload response from the API */ getInstance(payload: FlowResource): FlowInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/studio/v2/flowValidate.js000064400000006410151677225100012345 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.FlowValidateInstance = exports.FlowValidateListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function FlowValidateListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Flows/Validate`; instance.update = function update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } if (params["definition"] === null || params["definition"] === undefined) { throw new Error("Required parameter \"params['definition']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Status"] = params["status"]; data["Definition"] = serialize.object(params["definition"]); if (params["commitMessage"] !== undefined) data["CommitMessage"] = params["commitMessage"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FlowValidateInstance(operationVersion, payload)); 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; } exports.FlowValidateListInstance = FlowValidateListInstance; class FlowValidateInstance { constructor(_version, payload) { this._version = _version; this.valid = payload.valid; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { valid: this.valid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlowValidateInstance = FlowValidateInstance; rest/studio/v1/flow.js000064400000017371151677225100010702 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.FlowPage = exports.FlowListInstance = exports.FlowInstance = exports.FlowContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const engagement_1 = require("./flow/engagement"); const execution_1 = require("./flow/execution"); class FlowContextImpl { 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 = `/Flows/${sid}`; } get engagements() { this._engagements = this._engagements || (0, engagement_1.EngagementListInstance)(this._version, this._solution.sid); return this._engagements; } get executions() { this._executions = this._executions || (0, execution_1.ExecutionListInstance)(this._version, this._solution.sid); return this._executions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FlowInstance(operationVersion, payload, 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.FlowContextImpl = FlowContextImpl; class FlowInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.status = payload.status; this.version = deserialize.integer(payload.version); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new FlowContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the engagements. */ engagements() { return this._proxy.engagements; } /** * Access the executions. */ executions() { return this._proxy.executions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, status: this.status, version: this.version, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlowInstance = FlowInstance; function FlowListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new FlowContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Flows`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new FlowPage(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 FlowPage(instance._version, payload, 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; } exports.FlowListInstance = FlowListInstance; class FlowPage extends Page_1.default { /** * Initialize the FlowPage * * @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 FlowInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new FlowInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlowPage = FlowPage; rest/studio/v1/flow/engagement.d.ts000064400000027253151677225100013250 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { EngagementContextListInstance } from "./engagement/engagementContext"; import { StepListInstance } from "./engagement/step"; export type EngagementStatus = "active" | "ended"; /** * Options to pass to create a EngagementInstance */ export interface EngagementListInstanceCreateOptions { /** The Contact phone number to start a Studio Flow Engagement, available as variable `{{contact.channel.address}}`. */ to: string; /** The Twilio phone number to send messages or initiate calls from during the Flow Engagement. Available as variable `{{flow.channel.address}}` */ from: string; /** A JSON string we will add to your flow\\\'s context and that you can access as variables inside your flow. For example, if you pass in `Parameters={\\\'name\\\':\\\'Zeke\\\'}` then inside a widget you can reference the variable `{{flow.data.name}}` which will return the string \\\'Zeke\\\'. Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode your JSON string. */ parameters?: any; } /** * Options to pass to each */ export interface EngagementListInstanceEachOptions { /** 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: EngagementInstance, 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 EngagementListInstanceOptions { /** 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 EngagementListInstancePageOptions { /** 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 EngagementContext { engagementContext: EngagementContextListInstance; steps: StepListInstance; /** * Remove a EngagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EngagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EngagementInstance */ fetch(callback?: (error: Error | null, item?: EngagementInstance) => any): Promise<EngagementInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EngagementContextSolution { flowSid: string; sid: string; } export declare class EngagementContextImpl implements EngagementContext { protected _version: V1; protected _solution: EngagementContextSolution; protected _uri: string; protected _engagementContext?: EngagementContextListInstance; protected _steps?: StepListInstance; constructor(_version: V1, flowSid: string, sid: string); get engagementContext(): EngagementContextListInstance; get steps(): StepListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: EngagementInstance) => any): Promise<EngagementInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EngagementContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EngagementPayload extends TwilioResponsePayload { engagements: EngagementResource[]; } interface EngagementResource { sid: string; account_sid: string; flow_sid: string; contact_sid: string; contact_channel_address: string; context: any; status: EngagementStatus; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class EngagementInstance { protected _version: V1; protected _solution: EngagementContextSolution; protected _context?: EngagementContext; constructor(_version: V1, payload: EngagementResource, flowSid: string, sid?: string); /** * The unique string that we created to identify the Engagement resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Engagement resource. */ accountSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the Contact. */ contactSid: string; /** * The phone number, SIP address or Client identifier that triggered this Engagement. Phone numbers are in E.164 format (+16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. */ contactChannelAddress: string; /** * The current state of the execution flow. As your flow executes, we save the state in a flow context. Your widgets can access the data in the flow context as variables, either in configuration fields or in text areas as variable substitution. */ context: any; status: EngagementStatus; /** * The date and time in GMT when the Engagement was created in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the Engagement was updated in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of the Engagement\'s nested resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a EngagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EngagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EngagementInstance */ fetch(callback?: (error: Error | null, item?: EngagementInstance) => any): Promise<EngagementInstance>; /** * Access the engagementContext. */ engagementContext(): EngagementContextListInstance; /** * Access the steps. */ steps(): StepListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; flowSid: string; contactSid: string; contactChannelAddress: string; context: any; status: EngagementStatus; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EngagementSolution { flowSid: string; } export interface EngagementListInstance { _version: V1; _solution: EngagementSolution; _uri: string; (sid: string): EngagementContext; get(sid: string): EngagementContext; /** * Create a EngagementInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EngagementInstance */ create(params: EngagementListInstanceCreateOptions, callback?: (error: Error | null, item?: EngagementInstance) => any): Promise<EngagementInstance>; /** * Streams EngagementInstance 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 { EngagementListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EngagementInstance, done: (err?: Error) => void) => void): void; each(params: EngagementListInstanceEachOptions, callback?: (item: EngagementInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EngagementInstance 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: EngagementPage) => any): Promise<EngagementPage>; /** * Lists EngagementInstance 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 { EngagementListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EngagementInstance[]) => any): Promise<EngagementInstance[]>; list(params: EngagementListInstanceOptions, callback?: (error: Error | null, items: EngagementInstance[]) => any): Promise<EngagementInstance[]>; /** * Retrieve a single page of EngagementInstance 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 { EngagementListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EngagementPage) => any): Promise<EngagementPage>; page(params: EngagementListInstancePageOptions, callback?: (error: Error | null, items: EngagementPage) => any): Promise<EngagementPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EngagementListInstance(version: V1, flowSid: string): EngagementListInstance; export declare class EngagementPage extends Page<V1, EngagementPayload, EngagementResource, EngagementInstance> { /** * Initialize the EngagementPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: EngagementSolution); /** * Build an instance of EngagementInstance * * @param payload - Payload response from the API */ getInstance(payload: EngagementResource): EngagementInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/studio/v1/flow/execution.d.ts000064400000033451151677225100013136 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { ExecutionContextListInstance } from "./execution/executionContext"; import { ExecutionStepListInstance } from "./execution/executionStep"; export type ExecutionStatus = "active" | "ended"; /** * Options to pass to update a ExecutionInstance */ export interface ExecutionContextUpdateOptions { /** */ status: ExecutionStatus; } /** * Options to pass to create a ExecutionInstance */ export interface ExecutionListInstanceCreateOptions { /** The Contact phone number to start a Studio Flow Execution, available as variable `{{contact.channel.address}}`. */ to: string; /** The Twilio phone number to send messages or initiate calls from during the Flow\\\'s Execution. Available as variable `{{flow.channel.address}}`. For SMS, this can also be a Messaging Service SID. */ from: string; /** JSON data that will be added to the Flow\\\'s context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={\\\"name\\\":\\\"Zeke\\\"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns \\\"Zeke\\\". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. */ parameters?: any; } /** * Options to pass to each */ export interface ExecutionListInstanceEachOptions { /** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedFrom?: Date; /** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedTo?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ExecutionInstance, 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 ExecutionListInstanceOptions { /** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedFrom?: Date; /** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedTo?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ExecutionListInstancePageOptions { /** Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedFrom?: Date; /** Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. */ dateCreatedTo?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ExecutionContext { executionContext: ExecutionContextListInstance; steps: ExecutionStepListInstance; /** * Remove a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Update a ExecutionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExecutionContextSolution { flowSid: string; sid: string; } export declare class ExecutionContextImpl implements ExecutionContext { protected _version: V1; protected _solution: ExecutionContextSolution; protected _uri: string; protected _executionContext?: ExecutionContextListInstance; protected _steps?: ExecutionStepListInstance; constructor(_version: V1, flowSid: string, sid: string); get executionContext(): ExecutionContextListInstance; get steps(): ExecutionStepListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExecutionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExecutionPayload extends TwilioResponsePayload { executions: ExecutionResource[]; } interface ExecutionResource { sid: string; account_sid: string; flow_sid: string; contact_sid: string; contact_channel_address: string; context: any; status: ExecutionStatus; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ExecutionInstance { protected _version: V1; protected _solution: ExecutionContextSolution; protected _context?: ExecutionContext; constructor(_version: V1, payload: ExecutionResource, flowSid: string, sid?: string); /** * The unique string that we created to identify the Execution resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. */ accountSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the Contact. */ contactSid: string; /** * The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. */ contactChannelAddress: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; status: ExecutionStatus; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of nested resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ fetch(callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Update a ExecutionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ update(params: ExecutionContextUpdateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Access the executionContext. */ executionContext(): ExecutionContextListInstance; /** * Access the steps. */ steps(): ExecutionStepListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; flowSid: string; contactSid: string; contactChannelAddress: string; context: any; status: ExecutionStatus; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExecutionSolution { flowSid: string; } export interface ExecutionListInstance { _version: V1; _solution: ExecutionSolution; _uri: string; (sid: string): ExecutionContext; get(sid: string): ExecutionContext; /** * Create a ExecutionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ create(params: ExecutionListInstanceCreateOptions, callback?: (error: Error | null, item?: ExecutionInstance) => any): Promise<ExecutionInstance>; /** * Streams ExecutionInstance 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 { ExecutionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void; each(params: ExecutionListInstanceEachOptions, callback?: (item: ExecutionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ExecutionInstance 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: ExecutionPage) => any): Promise<ExecutionPage>; /** * Lists ExecutionInstance 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 { ExecutionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ExecutionInstance[]) => any): Promise<ExecutionInstance[]>; list(params: ExecutionListInstanceOptions, callback?: (error: Error | null, items: ExecutionInstance[]) => any): Promise<ExecutionInstance[]>; /** * Retrieve a single page of ExecutionInstance 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 { ExecutionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ExecutionPage) => any): Promise<ExecutionPage>; page(params: ExecutionListInstancePageOptions, callback?: (error: Error | null, items: ExecutionPage) => any): Promise<ExecutionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExecutionListInstance(version: V1, flowSid: string): ExecutionListInstance; export declare class ExecutionPage extends Page<V1, ExecutionPayload, ExecutionResource, ExecutionInstance> { /** * Initialize the ExecutionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ExecutionSolution); /** * Build an instance of ExecutionInstance * * @param payload - Payload response from the API */ getInstance(payload: ExecutionResource): ExecutionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/studio/v1/flow/engagement/engagementContext.d.ts000064400000006753151677225100016731 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; export interface EngagementContextContext { /** * Fetch a EngagementContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EngagementContextInstance */ fetch(callback?: (error: Error | null, item?: EngagementContextInstance) => any): Promise<EngagementContextInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EngagementContextContextSolution { flowSid: string; engagementSid: string; } export declare class EngagementContextContextImpl implements EngagementContextContext { protected _version: V1; protected _solution: EngagementContextContextSolution; protected _uri: string; constructor(_version: V1, flowSid: string, engagementSid: string); fetch(callback?: (error: Error | null, item?: EngagementContextInstance) => any): Promise<EngagementContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EngagementContextContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EngagementContextResource { account_sid: string; context: any; engagement_sid: string; flow_sid: string; url: string; } export declare class EngagementContextInstance { protected _version: V1; protected _solution: EngagementContextContextSolution; protected _context?: EngagementContextContext; constructor(_version: V1, payload: EngagementContextResource, flowSid: string, engagementSid: string); /** * The SID of the Account. */ accountSid: string; /** * As your flow executes, we save the state in what\'s called the Flow Context. Any data in the flow context can be accessed by your widgets as variables, either in configuration fields or in text areas as variable substitution. */ context: any; /** * The SID of the Engagement. */ engagementSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The URL of the resource. */ url: string; private get _proxy(); /** * Fetch a EngagementContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EngagementContextInstance */ fetch(callback?: (error: Error | null, item?: EngagementContextInstance) => any): Promise<EngagementContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; context: any; engagementSid: string; flowSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EngagementContextSolution { flowSid: string; engagementSid: string; } export interface EngagementContextListInstance { _version: V1; _solution: EngagementContextSolution; _uri: string; (): EngagementContextContext; get(): EngagementContextContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EngagementContextListInstance(version: V1, flowSid: string, engagementSid: string): EngagementContextListInstance; export {}; rest/studio/v1/flow/engagement/engagementContext.js000064400000011041151677225100016457 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.EngagementContextListInstance = exports.EngagementContextInstance = exports.EngagementContextContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class EngagementContextContextImpl { constructor(_version, flowSid, engagementSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(engagementSid)) { throw new Error("Parameter 'engagementSid' is not valid."); } this._solution = { flowSid, engagementSid }; this._uri = `/Flows/${flowSid}/Engagements/${engagementSid}/Context`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EngagementContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.engagementSid)); 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.EngagementContextContextImpl = EngagementContextContextImpl; class EngagementContextInstance { constructor(_version, payload, flowSid, engagementSid) { this._version = _version; this.accountSid = payload.account_sid; this.context = payload.context; this.engagementSid = payload.engagement_sid; this.flowSid = payload.flow_sid; this.url = payload.url; this._solution = { flowSid, engagementSid }; } get _proxy() { this._context = this._context || new EngagementContextContextImpl(this._version, this._solution.flowSid, this._solution.engagementSid); return this._context; } /** * Fetch a EngagementContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EngagementContextInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, context: this.context, engagementSid: this.engagementSid, flowSid: this.flowSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EngagementContextInstance = EngagementContextInstance; function EngagementContextListInstance(version, flowSid, engagementSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(engagementSid)) { throw new Error("Parameter 'engagementSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new EngagementContextContextImpl(version, flowSid, engagementSid); }; instance._version = version; instance._solution = { flowSid, engagementSid }; 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; } exports.EngagementContextListInstance = EngagementContextListInstance; rest/studio/v1/flow/engagement/step.d.ts000064400000022273151677225100014220 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; import { StepContextListInstance } from "./step/stepContext"; /** * Options to pass to each */ export interface StepListInstanceEachOptions { /** 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: StepInstance, 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 StepListInstanceOptions { /** 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 StepListInstancePageOptions { /** 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 StepContext { stepContext: StepContextListInstance; /** * Fetch a StepInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed StepInstance */ fetch(callback?: (error: Error | null, item?: StepInstance) => any): Promise<StepInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface StepContextSolution { flowSid: string; engagementSid: string; sid: string; } export declare class StepContextImpl implements StepContext { protected _version: V1; protected _solution: StepContextSolution; protected _uri: string; protected _stepContext?: StepContextListInstance; constructor(_version: V1, flowSid: string, engagementSid: string, sid: string); get stepContext(): StepContextListInstance; fetch(callback?: (error: Error | null, item?: StepInstance) => any): Promise<StepInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): StepContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface StepPayload extends TwilioResponsePayload { steps: StepResource[]; } interface StepResource { sid: string; account_sid: string; flow_sid: string; engagement_sid: string; name: string; context: any; transitioned_from: string; transitioned_to: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class StepInstance { protected _version: V1; protected _solution: StepContextSolution; protected _context?: StepContext; constructor(_version: V1, payload: StepResource, flowSid: string, engagementSid: string, sid?: string); /** * The unique string that we created to identify the Step resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Step resource. */ accountSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the Engagement. */ engagementSid: string; /** * The event that caused the Flow to transition to the Step. */ name: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; /** * The Widget that preceded the Widget for the Step. */ transitionedFrom: string; /** * The Widget that will follow the Widget for the Step. */ transitionedTo: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a StepInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed StepInstance */ fetch(callback?: (error: Error | null, item?: StepInstance) => any): Promise<StepInstance>; /** * Access the stepContext. */ stepContext(): StepContextListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; flowSid: string; engagementSid: string; name: string; context: any; transitionedFrom: string; transitionedTo: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface StepSolution { flowSid: string; engagementSid: string; } export interface StepListInstance { _version: V1; _solution: StepSolution; _uri: string; (sid: string): StepContext; get(sid: string): StepContext; /** * Streams StepInstance 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 { StepListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: StepInstance, done: (err?: Error) => void) => void): void; each(params: StepListInstanceEachOptions, callback?: (item: StepInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of StepInstance 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: StepPage) => any): Promise<StepPage>; /** * Lists StepInstance 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 { StepListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: StepInstance[]) => any): Promise<StepInstance[]>; list(params: StepListInstanceOptions, callback?: (error: Error | null, items: StepInstance[]) => any): Promise<StepInstance[]>; /** * Retrieve a single page of StepInstance 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 { StepListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: StepPage) => any): Promise<StepPage>; page(params: StepListInstancePageOptions, callback?: (error: Error | null, items: StepPage) => any): Promise<StepPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function StepListInstance(version: V1, flowSid: string, engagementSid: string): StepListInstance; export declare class StepPage extends Page<V1, StepPayload, StepResource, StepInstance> { /** * Initialize the StepPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: StepSolution); /** * Build an instance of StepInstance * * @param payload - Payload response from the API */ getInstance(payload: StepResource): StepInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/studio/v1/flow/engagement/step.js000064400000020142151677225100013755 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.StepPage = exports.StepListInstance = exports.StepInstance = exports.StepContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const stepContext_1 = require("./step/stepContext"); class StepContextImpl { constructor(_version, flowSid, engagementSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(engagementSid)) { throw new Error("Parameter 'engagementSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { flowSid, engagementSid, sid }; this._uri = `/Flows/${flowSid}/Engagements/${engagementSid}/Steps/${sid}`; } get stepContext() { this._stepContext = this._stepContext || (0, stepContext_1.StepContextListInstance)(this._version, this._solution.flowSid, this._solution.engagementSid, this._solution.sid); return this._stepContext; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new StepInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.engagementSid, 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.StepContextImpl = StepContextImpl; class StepInstance { constructor(_version, payload, flowSid, engagementSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.flowSid = payload.flow_sid; this.engagementSid = payload.engagement_sid; this.name = payload.name; this.context = payload.context; this.transitionedFrom = payload.transitioned_from; this.transitionedTo = payload.transitioned_to; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { flowSid, engagementSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new StepContextImpl(this._version, this._solution.flowSid, this._solution.engagementSid, this._solution.sid); return this._context; } /** * Fetch a StepInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed StepInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the stepContext. */ stepContext() { return this._proxy.stepContext; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, flowSid: this.flowSid, engagementSid: this.engagementSid, name: this.name, context: this.context, transitionedFrom: this.transitionedFrom, transitionedTo: this.transitionedTo, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.StepInstance = StepInstance; function StepListInstance(version, flowSid, engagementSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(engagementSid)) { throw new Error("Parameter 'engagementSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new StepContextImpl(version, flowSid, engagementSid, sid); }; instance._version = version; instance._solution = { flowSid, engagementSid }; instance._uri = `/Flows/${flowSid}/Engagements/${engagementSid}/Steps`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new StepPage(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 StepPage(instance._version, payload, 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; } exports.StepListInstance = StepListInstance; class StepPage extends Page_1.default { /** * Initialize the StepPage * * @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 StepInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new StepInstance(this._version, payload, this._solution.flowSid, this._solution.engagementSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.StepPage = StepPage; rest/studio/v1/flow/engagement/step/stepContext.js000064400000011622151677225100016300 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.StepContextListInstance = exports.StepContextInstance = exports.StepContextContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); class StepContextContextImpl { constructor(_version, flowSid, engagementSid, stepSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(engagementSid)) { throw new Error("Parameter 'engagementSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(stepSid)) { throw new Error("Parameter 'stepSid' is not valid."); } this._solution = { flowSid, engagementSid, stepSid }; this._uri = `/Flows/${flowSid}/Engagements/${engagementSid}/Steps/${stepSid}/Context`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new StepContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.engagementSid, instance._solution.stepSid)); 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.StepContextContextImpl = StepContextContextImpl; class StepContextInstance { constructor(_version, payload, flowSid, engagementSid, stepSid) { this._version = _version; this.accountSid = payload.account_sid; this.context = payload.context; this.engagementSid = payload.engagement_sid; this.flowSid = payload.flow_sid; this.stepSid = payload.step_sid; this.url = payload.url; this._solution = { flowSid, engagementSid, stepSid }; } get _proxy() { this._context = this._context || new StepContextContextImpl(this._version, this._solution.flowSid, this._solution.engagementSid, this._solution.stepSid); return this._context; } /** * Fetch a StepContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed StepContextInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, context: this.context, engagementSid: this.engagementSid, flowSid: this.flowSid, stepSid: this.stepSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.StepContextInstance = StepContextInstance; function StepContextListInstance(version, flowSid, engagementSid, stepSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(engagementSid)) { throw new Error("Parameter 'engagementSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(stepSid)) { throw new Error("Parameter 'stepSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new StepContextContextImpl(version, flowSid, engagementSid, stepSid); }; instance._version = version; instance._solution = { flowSid, engagementSid, stepSid }; 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; } exports.StepContextListInstance = StepContextListInstance; rest/studio/v1/flow/engagement/step/stepContext.d.ts000064400000007213151677225100016535 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../../V1"; export interface StepContextContext { /** * Fetch a StepContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed StepContextInstance */ fetch(callback?: (error: Error | null, item?: StepContextInstance) => any): Promise<StepContextInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface StepContextContextSolution { flowSid: string; engagementSid: string; stepSid: string; } export declare class StepContextContextImpl implements StepContextContext { protected _version: V1; protected _solution: StepContextContextSolution; protected _uri: string; constructor(_version: V1, flowSid: string, engagementSid: string, stepSid: string); fetch(callback?: (error: Error | null, item?: StepContextInstance) => any): Promise<StepContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): StepContextContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface StepContextResource { account_sid: string; context: any; engagement_sid: string; flow_sid: string; step_sid: string; url: string; } export declare class StepContextInstance { protected _version: V1; protected _solution: StepContextContextSolution; protected _context?: StepContextContext; constructor(_version: V1, payload: StepContextResource, flowSid: string, engagementSid: string, stepSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StepContext resource. */ accountSid: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; /** * The SID of the Engagement. */ engagementSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the Step the context is associated with. */ stepSid: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a StepContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed StepContextInstance */ fetch(callback?: (error: Error | null, item?: StepContextInstance) => any): Promise<StepContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; context: any; engagementSid: string; flowSid: string; stepSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface StepContextSolution { flowSid: string; engagementSid: string; stepSid: string; } export interface StepContextListInstance { _version: V1; _solution: StepContextSolution; _uri: string; (): StepContextContext; get(): StepContextContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function StepContextListInstance(version: V1, flowSid: string, engagementSid: string, stepSid: string): StepContextListInstance; export {}; rest/studio/v1/flow/execution.js000064400000026360151677225100012703 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.ExecutionPage = exports.ExecutionListInstance = exports.ExecutionInstance = exports.ExecutionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const executionContext_1 = require("./execution/executionContext"); const executionStep_1 = require("./execution/executionStep"); class ExecutionContextImpl { constructor(_version, flowSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { flowSid, sid }; this._uri = `/Flows/${flowSid}/Executions/${sid}`; } get executionContext() { this._executionContext = this._executionContext || (0, executionContext_1.ExecutionContextListInstance)(this._version, this._solution.flowSid, this._solution.sid); return this._executionContext; } get steps() { this._steps = this._steps || (0, executionStep_1.ExecutionStepListInstance)(this._version, this._solution.flowSid, this._solution.sid); return this._steps; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid, 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.ExecutionContextImpl = ExecutionContextImpl; class ExecutionInstance { constructor(_version, payload, flowSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.flowSid = payload.flow_sid; this.contactSid = payload.contact_sid; this.contactChannelAddress = payload.contact_channel_address; this.context = payload.context; this.status = payload.status; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { flowSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ExecutionContextImpl(this._version, this._solution.flowSid, this._solution.sid); return this._context; } /** * Remove a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ExecutionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the executionContext. */ executionContext() { return this._proxy.executionContext; } /** * Access the steps. */ steps() { return this._proxy.steps; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, flowSid: this.flowSid, contactSid: this.contactSid, contactChannelAddress: this.contactChannelAddress, context: this.context, status: this.status, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionInstance = ExecutionInstance; function ExecutionListInstance(version, flowSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ExecutionContextImpl(version, flowSid, sid); }; instance._version = version; instance._solution = { flowSid }; instance._uri = `/Flows/${flowSid}/Executions`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["to"] === null || params["to"] === undefined) { throw new Error("Required parameter \"params['to']\" missing."); } if (params["from"] === null || params["from"] === undefined) { throw new Error("Required parameter \"params['from']\" missing."); } let data = {}; data["To"] = params["to"]; data["From"] = params["from"]; if (params["parameters"] !== undefined) data["Parameters"] = serialize.object(params["parameters"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ExecutionInstance(operationVersion, payload, instance._solution.flowSid)); 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["dateCreatedFrom"] !== undefined) data["DateCreatedFrom"] = serialize.iso8601DateTime(params["dateCreatedFrom"]); if (params["dateCreatedTo"] !== undefined) data["DateCreatedTo"] = serialize.iso8601DateTime(params["dateCreatedTo"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ExecutionPage(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 ExecutionPage(instance._version, payload, 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; } exports.ExecutionListInstance = ExecutionListInstance; class ExecutionPage extends Page_1.default { /** * Initialize the ExecutionPage * * @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 ExecutionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ExecutionInstance(this._version, payload, this._solution.flowSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionPage = ExecutionPage; rest/studio/v1/flow/engagement.js000064400000023573151677225100013015 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.EngagementPage = exports.EngagementListInstance = exports.EngagementInstance = exports.EngagementContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const engagementContext_1 = require("./engagement/engagementContext"); const step_1 = require("./engagement/step"); class EngagementContextImpl { constructor(_version, flowSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { flowSid, sid }; this._uri = `/Flows/${flowSid}/Engagements/${sid}`; } get engagementContext() { this._engagementContext = this._engagementContext || (0, engagementContext_1.EngagementContextListInstance)(this._version, this._solution.flowSid, this._solution.sid); return this._engagementContext; } get steps() { this._steps = this._steps || (0, step_1.StepListInstance)(this._version, this._solution.flowSid, this._solution.sid); return this._steps; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EngagementInstance(operationVersion, payload, instance._solution.flowSid, 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.EngagementContextImpl = EngagementContextImpl; class EngagementInstance { constructor(_version, payload, flowSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.flowSid = payload.flow_sid; this.contactSid = payload.contact_sid; this.contactChannelAddress = payload.contact_channel_address; this.context = payload.context; this.status = payload.status; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { flowSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new EngagementContextImpl(this._version, this._solution.flowSid, this._solution.sid); return this._context; } /** * Remove a EngagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a EngagementInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EngagementInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the engagementContext. */ engagementContext() { return this._proxy.engagementContext; } /** * Access the steps. */ steps() { return this._proxy.steps; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, flowSid: this.flowSid, contactSid: this.contactSid, contactChannelAddress: this.contactChannelAddress, context: this.context, status: this.status, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EngagementInstance = EngagementInstance; function EngagementListInstance(version, flowSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EngagementContextImpl(version, flowSid, sid); }; instance._version = version; instance._solution = { flowSid }; instance._uri = `/Flows/${flowSid}/Engagements`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["to"] === null || params["to"] === undefined) { throw new Error("Required parameter \"params['to']\" missing."); } if (params["from"] === null || params["from"] === undefined) { throw new Error("Required parameter \"params['from']\" missing."); } let data = {}; data["To"] = params["to"]; data["From"] = params["from"]; if (params["parameters"] !== undefined) data["Parameters"] = serialize.object(params["parameters"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new EngagementInstance(operationVersion, payload, instance._solution.flowSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EngagementPage(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 EngagementPage(instance._version, payload, 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; } exports.EngagementListInstance = EngagementListInstance; class EngagementPage extends Page_1.default { /** * Initialize the EngagementPage * * @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 EngagementInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EngagementInstance(this._version, payload, this._solution.flowSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EngagementPage = EngagementPage; rest/studio/v1/flow/execution/executionContext.js000064400000010775151677225100016256 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.ExecutionContextListInstance = exports.ExecutionContextInstance = exports.ExecutionContextContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class ExecutionContextContextImpl { constructor(_version, flowSid, executionSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } this._solution = { flowSid, executionSid }; this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Context`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExecutionContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid)); 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.ExecutionContextContextImpl = ExecutionContextContextImpl; class ExecutionContextInstance { constructor(_version, payload, flowSid, executionSid) { this._version = _version; this.accountSid = payload.account_sid; this.context = payload.context; this.flowSid = payload.flow_sid; this.executionSid = payload.execution_sid; this.url = payload.url; this._solution = { flowSid, executionSid }; } get _proxy() { this._context = this._context || new ExecutionContextContextImpl(this._version, this._solution.flowSid, this._solution.executionSid); return this._context; } /** * Fetch a ExecutionContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionContextInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, context: this.context, flowSid: this.flowSid, executionSid: this.executionSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionContextInstance = ExecutionContextInstance; function ExecutionContextListInstance(version, flowSid, executionSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new ExecutionContextContextImpl(version, flowSid, executionSid); }; instance._version = version; instance._solution = { flowSid, executionSid }; 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; } exports.ExecutionContextListInstance = ExecutionContextListInstance; rest/studio/v1/flow/execution/executionStep.js000064400000020542151677225100015536 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.ExecutionStepPage = exports.ExecutionStepListInstance = exports.ExecutionStepInstance = exports.ExecutionStepContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const executionStepContext_1 = require("./executionStep/executionStepContext"); class ExecutionStepContextImpl { constructor(_version, flowSid, executionSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { flowSid, executionSid, sid }; this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps/${sid}`; } get stepContext() { this._stepContext = this._stepContext || (0, executionStepContext_1.ExecutionStepContextListInstance)(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.sid); return this._stepContext; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExecutionStepInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid, 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.ExecutionStepContextImpl = ExecutionStepContextImpl; class ExecutionStepInstance { constructor(_version, payload, flowSid, executionSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.flowSid = payload.flow_sid; this.executionSid = payload.execution_sid; this.name = payload.name; this.context = payload.context; this.transitionedFrom = payload.transitioned_from; this.transitionedTo = payload.transitioned_to; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { flowSid, executionSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ExecutionStepContextImpl(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.sid); return this._context; } /** * Fetch a ExecutionStepInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the stepContext. */ stepContext() { return this._proxy.stepContext; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, flowSid: this.flowSid, executionSid: this.executionSid, name: this.name, context: this.context, transitionedFrom: this.transitionedFrom, transitionedTo: this.transitionedTo, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionStepInstance = ExecutionStepInstance; function ExecutionStepListInstance(version, flowSid, executionSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ExecutionStepContextImpl(version, flowSid, executionSid, sid); }; instance._version = version; instance._solution = { flowSid, executionSid }; instance._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ExecutionStepPage(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 ExecutionStepPage(instance._version, payload, 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; } exports.ExecutionStepListInstance = ExecutionStepListInstance; class ExecutionStepPage extends Page_1.default { /** * Initialize the ExecutionStepPage * * @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 ExecutionStepInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ExecutionStepInstance(this._version, payload, this._solution.flowSid, this._solution.executionSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionStepPage = ExecutionStepPage; rest/studio/v1/flow/execution/executionStep/executionStepContext.d.ts000064400000007640151677225100022202 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../../V1"; export interface ExecutionStepContextContext { /** * Fetch a ExecutionStepContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepContextInstance */ fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExecutionStepContextContextSolution { flowSid: string; executionSid: string; stepSid: string; } export declare class ExecutionStepContextContextImpl implements ExecutionStepContextContext { protected _version: V1; protected _solution: ExecutionStepContextContextSolution; protected _uri: string; constructor(_version: V1, flowSid: string, executionSid: string, stepSid: string); fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExecutionStepContextContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExecutionStepContextResource { account_sid: string; context: any; execution_sid: string; flow_sid: string; step_sid: string; url: string; } export declare class ExecutionStepContextInstance { protected _version: V1; protected _solution: ExecutionStepContextContextSolution; protected _context?: ExecutionStepContextContext; constructor(_version: V1, payload: ExecutionStepContextResource, flowSid: string, executionSid: string, stepSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. */ accountSid: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; /** * The SID of the context\'s Execution resource. */ executionSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the Step that the context is associated with. */ stepSid: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a ExecutionStepContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepContextInstance */ fetch(callback?: (error: Error | null, item?: ExecutionStepContextInstance) => any): Promise<ExecutionStepContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; context: any; executionSid: string; flowSid: string; stepSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExecutionStepContextSolution { flowSid: string; executionSid: string; stepSid: string; } export interface ExecutionStepContextListInstance { _version: V1; _solution: ExecutionStepContextSolution; _uri: string; (): ExecutionStepContextContext; get(): ExecutionStepContextContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExecutionStepContextListInstance(version: V1, flowSid: string, executionSid: string, stepSid: string): ExecutionStepContextListInstance; export {}; rest/studio/v1/flow/execution/executionStep/executionStepContext.js000064400000012030151677225100021733 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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.ExecutionStepContextListInstance = exports.ExecutionStepContextInstance = exports.ExecutionStepContextContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); class ExecutionStepContextContextImpl { constructor(_version, flowSid, executionSid, stepSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(stepSid)) { throw new Error("Parameter 'stepSid' is not valid."); } this._solution = { flowSid, executionSid, stepSid }; this._uri = `/Flows/${flowSid}/Executions/${executionSid}/Steps/${stepSid}/Context`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExecutionStepContextInstance(operationVersion, payload, instance._solution.flowSid, instance._solution.executionSid, instance._solution.stepSid)); 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.ExecutionStepContextContextImpl = ExecutionStepContextContextImpl; class ExecutionStepContextInstance { constructor(_version, payload, flowSid, executionSid, stepSid) { this._version = _version; this.accountSid = payload.account_sid; this.context = payload.context; this.executionSid = payload.execution_sid; this.flowSid = payload.flow_sid; this.stepSid = payload.step_sid; this.url = payload.url; this._solution = { flowSid, executionSid, stepSid }; } get _proxy() { this._context = this._context || new ExecutionStepContextContextImpl(this._version, this._solution.flowSid, this._solution.executionSid, this._solution.stepSid); return this._context; } /** * Fetch a ExecutionStepContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepContextInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, context: this.context, executionSid: this.executionSid, flowSid: this.flowSid, stepSid: this.stepSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExecutionStepContextInstance = ExecutionStepContextInstance; function ExecutionStepContextListInstance(version, flowSid, executionSid, stepSid) { if (!(0, utility_1.isValidPathParam)(flowSid)) { throw new Error("Parameter 'flowSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(executionSid)) { throw new Error("Parameter 'executionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(stepSid)) { throw new Error("Parameter 'stepSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new ExecutionStepContextContextImpl(version, flowSid, executionSid, stepSid); }; instance._version = version; instance._solution = { flowSid, executionSid, stepSid }; 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; } exports.ExecutionStepContextListInstance = ExecutionStepContextListInstance; rest/studio/v1/flow/execution/executionStep.d.ts000064400000023535151677225100015777 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; import { ExecutionStepContextListInstance } from "./executionStep/executionStepContext"; /** * Options to pass to each */ export interface ExecutionStepListInstanceEachOptions { /** 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: ExecutionStepInstance, 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 ExecutionStepListInstanceOptions { /** 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 ExecutionStepListInstancePageOptions { /** 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 ExecutionStepContext { stepContext: ExecutionStepContextListInstance; /** * Fetch a ExecutionStepInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepInstance */ fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExecutionStepContextSolution { flowSid: string; executionSid: string; sid: string; } export declare class ExecutionStepContextImpl implements ExecutionStepContext { protected _version: V1; protected _solution: ExecutionStepContextSolution; protected _uri: string; protected _stepContext?: ExecutionStepContextListInstance; constructor(_version: V1, flowSid: string, executionSid: string, sid: string); get stepContext(): ExecutionStepContextListInstance; fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExecutionStepContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExecutionStepPayload extends TwilioResponsePayload { steps: ExecutionStepResource[]; } interface ExecutionStepResource { sid: string; account_sid: string; flow_sid: string; execution_sid: string; name: string; context: any; transitioned_from: string; transitioned_to: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ExecutionStepInstance { protected _version: V1; protected _solution: ExecutionStepContextSolution; protected _context?: ExecutionStepContext; constructor(_version: V1, payload: ExecutionStepResource, flowSid: string, executionSid: string, sid?: string); /** * The unique string that we created to identify the ExecutionStep resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. */ accountSid: string; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the Step\'s Execution resource. */ executionSid: string; /** * The event that caused the Flow to transition to the Step. */ name: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; /** * The Widget that preceded the Widget for the Step. */ transitionedFrom: string; /** * The Widget that will follow the Widget for the Step. */ transitionedTo: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a ExecutionStepInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionStepInstance */ fetch(callback?: (error: Error | null, item?: ExecutionStepInstance) => any): Promise<ExecutionStepInstance>; /** * Access the stepContext. */ stepContext(): ExecutionStepContextListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; flowSid: string; executionSid: string; name: string; context: any; transitionedFrom: string; transitionedTo: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExecutionStepSolution { flowSid: string; executionSid: string; } export interface ExecutionStepListInstance { _version: V1; _solution: ExecutionStepSolution; _uri: string; (sid: string): ExecutionStepContext; get(sid: string): ExecutionStepContext; /** * Streams ExecutionStepInstance 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 { ExecutionStepListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void; each(params: ExecutionStepListInstanceEachOptions, callback?: (item: ExecutionStepInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ExecutionStepInstance 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: ExecutionStepPage) => any): Promise<ExecutionStepPage>; /** * Lists ExecutionStepInstance 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 { ExecutionStepListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ExecutionStepInstance[]) => any): Promise<ExecutionStepInstance[]>; list(params: ExecutionStepListInstanceOptions, callback?: (error: Error | null, items: ExecutionStepInstance[]) => any): Promise<ExecutionStepInstance[]>; /** * Retrieve a single page of ExecutionStepInstance 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 { ExecutionStepListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ExecutionStepPage) => any): Promise<ExecutionStepPage>; page(params: ExecutionStepListInstancePageOptions, callback?: (error: Error | null, items: ExecutionStepPage) => any): Promise<ExecutionStepPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExecutionStepListInstance(version: V1, flowSid: string, executionSid: string): ExecutionStepListInstance; export declare class ExecutionStepPage extends Page<V1, ExecutionStepPayload, ExecutionStepResource, ExecutionStepInstance> { /** * Initialize the ExecutionStepPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ExecutionStepSolution); /** * Build an instance of ExecutionStepInstance * * @param payload - Payload response from the API */ getInstance(payload: ExecutionStepResource): ExecutionStepInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/studio/v1/flow/execution/executionContext.d.ts000064400000007070151677225100016504 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; export interface ExecutionContextContext { /** * Fetch a ExecutionContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionContextInstance */ fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExecutionContextContextSolution { flowSid: string; executionSid: string; } export declare class ExecutionContextContextImpl implements ExecutionContextContext { protected _version: V1; protected _solution: ExecutionContextContextSolution; protected _uri: string; constructor(_version: V1, flowSid: string, executionSid: string); fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExecutionContextContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExecutionContextResource { account_sid: string; context: any; flow_sid: string; execution_sid: string; url: string; } export declare class ExecutionContextInstance { protected _version: V1; protected _solution: ExecutionContextContextSolution; protected _context?: ExecutionContextContext; constructor(_version: V1, payload: ExecutionContextResource, flowSid: string, executionSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. */ accountSid: string; /** * The current state of the Flow\'s Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. */ context: any; /** * The SID of the Flow. */ flowSid: string; /** * The SID of the context\'s Execution resource. */ executionSid: string; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a ExecutionContextInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExecutionContextInstance */ fetch(callback?: (error: Error | null, item?: ExecutionContextInstance) => any): Promise<ExecutionContextInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; context: any; flowSid: string; executionSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExecutionContextSolution { flowSid: string; executionSid: string; } export interface ExecutionContextListInstance { _version: V1; _solution: ExecutionContextSolution; _uri: string; (): ExecutionContextContext; get(): ExecutionContextContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExecutionContextListInstance(version: V1, flowSid: string, executionSid: string): ExecutionContextListInstance; export {}; rest/studio/v1/flow.d.ts000064400000022351151677225100011130 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { EngagementListInstance } from "./flow/engagement"; import { ExecutionListInstance } from "./flow/execution"; export type FlowStatus = "draft" | "published"; /** * Options to pass to each */ export interface FlowListInstanceEachOptions { /** 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: FlowInstance, 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 FlowListInstanceOptions { /** 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 FlowListInstancePageOptions { /** 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 FlowContext { engagements: EngagementListInstance; executions: ExecutionListInstance; /** * Remove a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowInstance */ fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FlowContextSolution { sid: string; } export declare class FlowContextImpl implements FlowContext { protected _version: V1; protected _solution: FlowContextSolution; protected _uri: string; protected _engagements?: EngagementListInstance; protected _executions?: ExecutionListInstance; constructor(_version: V1, sid: string); get engagements(): EngagementListInstance; get executions(): ExecutionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FlowContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FlowPayload extends TwilioResponsePayload { flows: FlowResource[]; } interface FlowResource { sid: string; account_sid: string; friendly_name: string; status: FlowStatus; version: number; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class FlowInstance { protected _version: V1; protected _solution: FlowContextSolution; protected _context?: FlowContext; constructor(_version: V1, payload: FlowResource, sid?: string); /** * The unique string that we created to identify the Flow resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. */ accountSid: string; /** * The string that you assigned to describe the Flow. */ friendlyName: string; status: FlowStatus; /** * The latest version number of the Flow\'s definition. */ version: number; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of the Flow\'s nested resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlowInstance */ fetch(callback?: (error: Error | null, item?: FlowInstance) => any): Promise<FlowInstance>; /** * Access the engagements. */ engagements(): EngagementListInstance; /** * Access the executions. */ executions(): ExecutionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; status: FlowStatus; version: number; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FlowSolution { } export interface FlowListInstance { _version: V1; _solution: FlowSolution; _uri: string; (sid: string): FlowContext; get(sid: string): FlowContext; /** * Streams FlowInstance 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 { FlowListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void; each(params: FlowListInstanceEachOptions, callback?: (item: FlowInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of FlowInstance 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: FlowPage) => any): Promise<FlowPage>; /** * Lists FlowInstance 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 { FlowListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: FlowInstance[]) => any): Promise<FlowInstance[]>; list(params: FlowListInstanceOptions, callback?: (error: Error | null, items: FlowInstance[]) => any): Promise<FlowInstance[]>; /** * Retrieve a single page of FlowInstance 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 { FlowListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: FlowPage) => any): Promise<FlowPage>; page(params: FlowListInstancePageOptions, callback?: (error: Error | null, items: FlowPage) => any): Promise<FlowPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FlowListInstance(version: V1): FlowListInstance; export declare class FlowPage extends Page<V1, FlowPayload, FlowResource, FlowInstance> { /** * Initialize the FlowPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: FlowSolution); /** * Build an instance of FlowInstance * * @param payload - Payload response from the API */ getInstance(payload: FlowResource): FlowInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/studio/V1.js000064400000002303151677225100007660 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Studio * 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 flow_1 = require("./v1/flow"); class V1 extends Version_1.default { /** * Initialize the V1 version of Studio * * @param domain - The Twilio (Twilio.Studio) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for flows resource */ get flows() { this._flows = this._flows || (0, flow_1.FlowListInstance)(this); return this._flows; } } exports.default = V1; rest/Proxy.js000064400000000735151677225100007213 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const ProxyBase_1 = __importDefault(require("./ProxyBase")); class Proxy extends ProxyBase_1.default { /** * @deprecated - Use v1.services instead */ get services() { console.warn("services is deprecated. Use v1.services instead."); return this.v1.services; } } module.exports = Proxy; rest/Trusthub.d.ts000064400000002703151677225100010143 0ustar00import { CustomerProfilesListInstance } from "./trusthub/v1/customerProfiles"; import { EndUserListInstance } from "./trusthub/v1/endUser"; import { EndUserTypeListInstance } from "./trusthub/v1/endUserType"; import { PoliciesListInstance } from "./trusthub/v1/policies"; import { SupportingDocumentListInstance } from "./trusthub/v1/supportingDocument"; import { SupportingDocumentTypeListInstance } from "./trusthub/v1/supportingDocumentType"; import { TrustProductsListInstance } from "./trusthub/v1/trustProducts"; import TrusthubBase from "./TrusthubBase"; declare class Trusthub extends TrusthubBase { /** * @deprecated - Use v1.customerProfiles instead */ get customerProfiles(): CustomerProfilesListInstance; /** * @deprecated - Use v1.endUsers instead */ get endUsers(): EndUserListInstance; /** * @deprecated - Use v1.endUserTypes instead */ get endUserTypes(): EndUserTypeListInstance; /** * @deprecated - Use v1.policies instead */ get policies(): PoliciesListInstance; /** * @deprecated - Use v1.supportingDocuments instead */ get supportingDocuments(): SupportingDocumentListInstance; /** * @deprecated - Use v1.supportingDocumentTypes instead */ get supportingDocumentTypes(): SupportingDocumentTypeListInstance; /** * @deprecated - Use v1.trustProducts instead */ get trustProducts(): TrustProductsListInstance; } export = Trusthub; rest/FlexApi.d.ts000064400000002467151677225100007662 0ustar00import { ChannelListInstance } from "./flexApi/v1/channel"; import { ConfigurationListInstance } from "./flexApi/v1/configuration"; import { FlexFlowListInstance } from "./flexApi/v1/flexFlow"; import { InteractionListInstance } from "./flexApi/v1/interaction"; import { WebChannelListInstance } from "./flexApi/v1/webChannel"; import { AssessmentsListInstance } from "./flexApi/v1/assessments"; import { WebChannelsListInstance } from "./flexApi/v2/webChannels"; import FlexApiBase from "./FlexApiBase"; declare class FlexApi extends FlexApiBase { /** * @deprecated - Use v1.assessments instead */ get assessments(): AssessmentsListInstance; /** * @deprecated - Use v1.channel instead */ get channel(): ChannelListInstance; /** * @deprecated - Use v1.configuration instead */ get configuration(): ConfigurationListInstance; /** * @deprecated - Use v1.flexFlow instead */ get flexFlow(): FlexFlowListInstance; /** * @deprecated - Use v1.interaction instead */ get interaction(): InteractionListInstance; /** * @deprecated - Use v1.webChannel instead */ get webChannel(): WebChannelListInstance; /** * @deprecated - Use v2.webChannels instead */ get webChannels(): WebChannelsListInstance; } export = FlexApi; rest/Preview.d.ts000064400000003530151677225100007743 0ustar00import { FleetListInstance } from "./preview/deployed_devices/fleet"; import { AuthorizationDocumentListInstance } from "./preview/hosted_numbers/authorizationDocument"; import { HostedNumberOrderListInstance } from "./preview/hosted_numbers/hostedNumberOrder"; import { AvailableAddOnListInstance } from "./preview/marketplace/availableAddOn"; import { InstalledAddOnListInstance } from "./preview/marketplace/installedAddOn"; import { ServiceListInstance } from "./preview/sync/service"; import { CommandListInstance } from "./preview/wireless/command"; import { RatePlanListInstance } from "./preview/wireless/ratePlan"; import { SimListInstance } from "./preview/wireless/sim"; import PreviewBase from "./PreviewBase"; declare class Preview extends PreviewBase { /** * @deprecated - Use deployed_devices.fleets instead */ get fleets(): FleetListInstance; /** * @deprecated - Use hosted_numbers.authorizationDocuments instead */ get authorizationDocuments(): AuthorizationDocumentListInstance; /** * @deprecated - Use hosted_numbers.hostedNumberOrders instead */ get hostedNumberOrders(): HostedNumberOrderListInstance; /** * @deprecated - Use marketplace.availableAddOns instead */ get availableAddOns(): AvailableAddOnListInstance; /** * @deprecated - Use marketplace.installedAddOns instead */ get installedAddOns(): InstalledAddOnListInstance; /** * @deprecated - Use sync.services instead */ get services(): ServiceListInstance; /** * @deprecated - Use wireless.commands instead */ get commands(): CommandListInstance; /** * @deprecated - Use wireless.ratePlans instead */ get ratePlans(): RatePlanListInstance; /** * @deprecated - Use wireless.sims instead */ get sims(): SimListInstance; } export = Preview; rest/PricingBase.js000064400000002301151677225100010247 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./pricing/V1")); const V2_1 = __importDefault(require("./pricing/V2")); class PricingBase extends Domain_1.default { /** * Initialize pricing domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://pricing.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = PricingBase; rest/SyncBase.d.ts000064400000000432151677225100010027 0ustar00import Domain from "../base/Domain"; import V1 from "./sync/V1"; declare class SyncBase extends Domain { _v1?: V1; /** * Initialize sync domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = SyncBase; rest/ProxyBase.js000064400000002033151677225100007777 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./proxy/V1")); class ProxyBase extends Domain_1.default { /** * Initialize proxy domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://proxy.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = ProxyBase; rest/Content.d.ts000064400000000413151677225100007731 0ustar00import ContentBase from "./ContentBase"; import { ContentListInstance } from "./content/v1/content"; declare class Content extends ContentBase { /** * @deprecated - Use v1.contents instead */ get contents(): ContentListInstance; } export = Content; rest/Twilio.d.ts000064400000030417151677225100007575 0ustar00import { Client, ClientOpts, RequestOpts } from "../base/BaseTwilio"; import Accounts from "./Accounts"; import Api from "./Api"; import Bulkexports from "./Bulkexports"; import Chat from "./Chat"; import Content from "./Content"; import Conversations from "./Conversations"; import Events from "./Events"; import FlexApi from "./FlexApi"; import FrontlineApi from "./FrontlineApi"; import Insights from "./Insights"; import Intelligence from "./Intelligence"; import IpMessaging from "./IpMessaging"; import Lookups from "./Lookups"; import Marketplace from "./Marketplace"; import Messaging from "./Messaging"; import Microvisor from "./Microvisor"; import Monitor from "./Monitor"; import Notify from "./Notify"; import Numbers from "./Numbers"; import Oauth from "./Oauth"; import Preview from "./Preview"; import Pricing from "./Pricing"; import Proxy from "./Proxy"; import Routes from "./Routes"; import Serverless from "./Serverless"; import Studio from "./Studio"; import Supersim from "./Supersim"; import Sync from "./Sync"; import Taskrouter from "./Taskrouter"; import Trunking from "./Trunking"; import Trusthub from "./Trusthub"; import Verify from "./Verify"; import Video from "./Video"; import Voice from "./Voice"; import Wireless from "./Wireless"; import { AddressListInstance } from "./api/v2010/account/address"; import { ApplicationListInstance } from "./api/v2010/account/application"; import { AuthorizedConnectAppListInstance } from "./api/v2010/account/authorizedConnectApp"; import { AvailablePhoneNumberCountryListInstance } from "./api/v2010/account/availablePhoneNumberCountry"; import { BalanceListInstance } from "./api/v2010/account/balance"; import { CallListInstance } from "./api/v2010/account/call"; import { ConferenceListInstance } from "./api/v2010/account/conference"; import { ConnectAppListInstance } from "./api/v2010/account/connectApp"; import { IncomingPhoneNumberListInstance } from "./api/v2010/account/incomingPhoneNumber"; import { KeyListInstance } from "./api/v2010/account/key"; import { MessageListInstance } from "./api/v2010/account/message"; import { NewKeyListInstance } from "./api/v2010/account/newKey"; import { NewSigningKeyListInstance } from "./api/v2010/account/newSigningKey"; import { NotificationListInstance } from "./api/v2010/account/notification"; import { OutgoingCallerIdListInstance } from "./api/v2010/account/outgoingCallerId"; import { QueueListInstance } from "./api/v2010/account/queue"; import { RecordingListInstance } from "./api/v2010/account/recording"; import { ShortCodeListInstance } from "./api/v2010/account/shortCode"; import { SigningKeyListInstance } from "./api/v2010/account/signingKey"; import { SipListInstance } from "./api/v2010/account/sip"; import { TokenListInstance } from "./api/v2010/account/token"; import { TranscriptionListInstance } from "./api/v2010/account/transcription"; import { UsageListInstance } from "./api/v2010/account/usage"; import { ValidationRequestListInstance } from "./api/v2010/account/validationRequest"; /** * Twilio Client to interact with the Rest API */ declare class Twilio extends Client { /** (Twilio.Accounts) - accounts domain */ _accounts?: Accounts; /** (Twilio.Api) - api domain */ _api?: Api; /** (Twilio.Bulkexports) - bulkexports domain */ _bulkexports?: Bulkexports; /** (Twilio.Chat) - chat domain */ _chat?: Chat; /** (Twilio.Content) - content domain */ _content?: Content; /** (Twilio.Conversations) - conversations domain */ _conversations?: Conversations; /** (Twilio.Events) - events domain */ _events?: Events; /** (Twilio.FlexApi) - flexApi domain */ _flexApi?: FlexApi; /** (Twilio.FrontlineApi) - frontlineApi domain */ _frontlineApi?: FrontlineApi; /** (Twilio.Insights) - insights domain */ _insights?: Insights; /** (Twilio.Intelligence) - intelligence domain */ _intelligence?: Intelligence; /** (Twilio.IpMessaging) - ipMessaging domain */ _ipMessaging?: IpMessaging; /** (Twilio.Lookups) - lookups domain */ _lookups?: Lookups; /** (Twilio.Marketplace) - marketplace domain */ _marketplace?: Marketplace; /** (Twilio.Messaging) - messaging domain */ _messaging?: Messaging; /** (Twilio.Microvisor) - microvisor domain */ _microvisor?: Microvisor; /** (Twilio.Monitor) - monitor domain */ _monitor?: Monitor; /** (Twilio.Notify) - notify domain */ _notify?: Notify; /** (Twilio.Numbers) - numbers domain */ _numbers?: Numbers; /** (Twilio.Oauth) - oauth domain */ _oauth?: Oauth; /** (Twilio.Preview) - preview domain */ _preview?: Preview; /** (Twilio.Pricing) - pricing domain */ _pricing?: Pricing; /** (Twilio.Proxy) - proxy domain */ _proxy?: Proxy; /** (Twilio.Routes) - routes domain */ _routes?: Routes; /** (Twilio.Serverless) - serverless domain */ _serverless?: Serverless; /** (Twilio.Studio) - studio domain */ _studio?: Studio; /** (Twilio.Supersim) - supersim domain */ _supersim?: Supersim; /** (Twilio.Sync) - sync domain */ _sync?: Sync; /** (Twilio.Taskrouter) - taskrouter domain */ _taskrouter?: Taskrouter; /** (Twilio.Trunking) - trunking domain */ _trunking?: Trunking; /** (Twilio.Trusthub) - trusthub domain */ _trusthub?: Trusthub; /** (Twilio.Verify) - verify domain */ _verify?: Verify; /** (Twilio.Video) - video domain */ _video?: Video; /** (Twilio.Voice) - voice domain */ _voice?: Voice; /** (Twilio.Wireless) - wireless domain */ _wireless?: Wireless; /** * Creates a new instance of Twilio Client * * @param username - * The username used for authentication. This is normally account sid, but if using key/secret auth will be the api key sid. * @param password - * The password used for authentication. This is normally auth token, but if using key/secret auth will be the secret. * @param opts - The options argument * * @returns A new instance of Twilio client */ constructor(username?: string, password?: string, opts?: ClientOpts); /** Getter for (Twilio.Accounts) domain */ get accounts(): Accounts; /** Getter for (Twilio.Api) domain */ get api(): Api; /** Getter for (Twilio.Bulkexports) domain */ get bulkexports(): Bulkexports; /** Getter for (Twilio.Chat) domain */ get chat(): Chat; /** Getter for (Twilio.Content) domain */ get content(): Content; /** Getter for (Twilio.Conversations) domain */ get conversations(): Conversations; /** Getter for (Twilio.Events) domain */ get events(): Events; /** Getter for (Twilio.FlexApi) domain */ get flexApi(): FlexApi; /** Getter for (Twilio.FrontlineApi) domain */ get frontlineApi(): FrontlineApi; /** Getter for (Twilio.Insights) domain */ get insights(): Insights; /** Getter for (Twilio.Intelligence) domain */ get intelligence(): Intelligence; /** Getter for (Twilio.IpMessaging) domain */ get ipMessaging(): IpMessaging; /** Getter for (Twilio.Lookups) domain */ get lookups(): Lookups; /** Getter for (Twilio.Marketplace) domain */ get marketplace(): Marketplace; /** Getter for (Twilio.Messaging) domain */ get messaging(): Messaging; /** Getter for (Twilio.Microvisor) domain */ get microvisor(): Microvisor; /** Getter for (Twilio.Monitor) domain */ get monitor(): Monitor; /** Getter for (Twilio.Notify) domain */ get notify(): Notify; /** Getter for (Twilio.Numbers) domain */ get numbers(): Numbers; /** Getter for (Twilio.Oauth) domain */ get oauth(): Oauth; /** Getter for (Twilio.Preview) domain */ get preview(): Preview; /** Getter for (Twilio.Pricing) domain */ get pricing(): Pricing; /** Getter for (Twilio.Proxy) domain */ get proxy(): Proxy; /** Getter for (Twilio.Routes) domain */ get routes(): Routes; /** Getter for (Twilio.Serverless) domain */ get serverless(): Serverless; /** Getter for (Twilio.Studio) domain */ get studio(): Studio; /** Getter for (Twilio.Supersim) domain */ get supersim(): Supersim; /** Getter for (Twilio.Sync) domain */ get sync(): Sync; /** Getter for (Twilio.Taskrouter) domain */ get taskrouter(): Taskrouter; /** Getter for (Twilio.Trunking) domain */ get trunking(): Trunking; /** Getter for (Twilio.Trusthub) domain */ get trusthub(): Trusthub; /** Getter for (Twilio.Verify) domain */ get verify(): Verify; /** Getter for (Twilio.Video) domain */ get video(): Video; /** Getter for (Twilio.Voice) domain */ get voice(): Voice; /** Getter for (Twilio.Wireless) domain */ get wireless(): Wireless; /** Getter for (Twilio.Api.V2010.AccountContext.AddressListInstance) addresses resource */ get addresses(): AddressListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.ApplicationListInstance) applications resource */ get applications(): ApplicationListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.AuthorizedConnectAppListInstance) authorizedConnectApps resource */ get authorizedConnectApps(): AuthorizedConnectAppListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.AvailablePhoneNumberCountryListInstance) availablePhoneNumbers resource */ get availablePhoneNumbers(): AvailablePhoneNumberCountryListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.BalanceListInstance) balance resource */ get balance(): BalanceListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.CallListInstance) calls resource */ get calls(): CallListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.ConferenceListInstance) conferences resource */ get conferences(): ConferenceListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.ConnectAppListInstance) connectApps resource */ get connectApps(): ConnectAppListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.IncomingPhoneNumberListInstance) incomingPhoneNumbers resource */ get incomingPhoneNumbers(): IncomingPhoneNumberListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.KeyListInstance) keys resource */ get keys(): KeyListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.MessageListInstance) messages resource */ get messages(): MessageListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.NewKeyListInstance) newKeys resource */ get newKeys(): NewKeyListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.NewSigningKeyListInstance) newSigningKeys resource */ get newSigningKeys(): NewSigningKeyListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.NotificationListInstance) notifications resource */ get notifications(): NotificationListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.OutgoingCallerIdListInstance) outgoingCallerIds resource */ get outgoingCallerIds(): OutgoingCallerIdListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.QueueListInstance) queues resource */ get queues(): QueueListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.RecordingListInstance) recordings resource */ get recordings(): RecordingListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.ShortCodeListInstance) shortCodes resource */ get shortCodes(): ShortCodeListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.SigningKeyListInstance) signingKeys resource */ get signingKeys(): SigningKeyListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.SipListInstance) sip resource */ get sip(): SipListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.TokenListInstance) tokens resource */ get tokens(): TokenListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.TranscriptionListInstance) transcriptions resource */ get transcriptions(): TranscriptionListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.UsageListInstance) usage resource */ get usage(): UsageListInstance; /** Getter for (Twilio.Api.V2010.AccountContext.ValidationRequestListInstance) validationRequests resource */ get validationRequests(): ValidationRequestListInstance; } declare namespace Twilio { interface RequestClientOptions extends ClientOpts { } interface RequestOptions extends RequestOpts { } } export = Twilio; rest/Wireless.d.ts000064400000001377151677225100010126 0ustar00import { CommandListInstance } from "./wireless/v1/command"; import { RatePlanListInstance } from "./wireless/v1/ratePlan"; import { SimListInstance } from "./wireless/v1/sim"; import { UsageRecordListInstance } from "./wireless/v1/usageRecord"; import WirelessBase from "./WirelessBase"; declare class Wireless extends WirelessBase { /** * @deprecated - Use v1.usageRecords instead */ get usageRecords(): UsageRecordListInstance; /** * @deprecated - Use v1.commands instead */ get commands(): CommandListInstance; /** * @deprecated - Use v1.ratePlans instead */ get ratePlans(): RatePlanListInstance; /** * @deprecated - Use v1.sims instead */ get sims(): SimListInstance; } export = Wireless; rest/api/v2010/account.js000064400000043272151677225100011052 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AccountPage = exports.AccountListInstance = exports.AccountInstance = exports.AccountContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const address_1 = require("./account/address"); const application_1 = require("./account/application"); const authorizedConnectApp_1 = require("./account/authorizedConnectApp"); const availablePhoneNumberCountry_1 = require("./account/availablePhoneNumberCountry"); const balance_1 = require("./account/balance"); const call_1 = require("./account/call"); const conference_1 = require("./account/conference"); const connectApp_1 = require("./account/connectApp"); const incomingPhoneNumber_1 = require("./account/incomingPhoneNumber"); const key_1 = require("./account/key"); const message_1 = require("./account/message"); const newKey_1 = require("./account/newKey"); const newSigningKey_1 = require("./account/newSigningKey"); const notification_1 = require("./account/notification"); const outgoingCallerId_1 = require("./account/outgoingCallerId"); const queue_1 = require("./account/queue"); const recording_1 = require("./account/recording"); const shortCode_1 = require("./account/shortCode"); const signingKey_1 = require("./account/signingKey"); const sip_1 = require("./account/sip"); const token_1 = require("./account/token"); const transcription_1 = require("./account/transcription"); const usage_1 = require("./account/usage"); const validationRequest_1 = require("./account/validationRequest"); class AccountContextImpl { 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 = `/Accounts/${sid}.json`; } get addresses() { this._addresses = this._addresses || (0, address_1.AddressListInstance)(this._version, this._solution.sid); return this._addresses; } get applications() { this._applications = this._applications || (0, application_1.ApplicationListInstance)(this._version, this._solution.sid); return this._applications; } get authorizedConnectApps() { this._authorizedConnectApps = this._authorizedConnectApps || (0, authorizedConnectApp_1.AuthorizedConnectAppListInstance)(this._version, this._solution.sid); return this._authorizedConnectApps; } get availablePhoneNumbers() { this._availablePhoneNumbers = this._availablePhoneNumbers || (0, availablePhoneNumberCountry_1.AvailablePhoneNumberCountryListInstance)(this._version, this._solution.sid); return this._availablePhoneNumbers; } get balance() { this._balance = this._balance || (0, balance_1.BalanceListInstance)(this._version, this._solution.sid); return this._balance; } get calls() { this._calls = this._calls || (0, call_1.CallListInstance)(this._version, this._solution.sid); return this._calls; } get conferences() { this._conferences = this._conferences || (0, conference_1.ConferenceListInstance)(this._version, this._solution.sid); return this._conferences; } get connectApps() { this._connectApps = this._connectApps || (0, connectApp_1.ConnectAppListInstance)(this._version, this._solution.sid); return this._connectApps; } get incomingPhoneNumbers() { this._incomingPhoneNumbers = this._incomingPhoneNumbers || (0, incomingPhoneNumber_1.IncomingPhoneNumberListInstance)(this._version, this._solution.sid); return this._incomingPhoneNumbers; } get keys() { this._keys = this._keys || (0, key_1.KeyListInstance)(this._version, this._solution.sid); return this._keys; } get messages() { this._messages = this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.sid); return this._messages; } get newKeys() { this._newKeys = this._newKeys || (0, newKey_1.NewKeyListInstance)(this._version, this._solution.sid); return this._newKeys; } get newSigningKeys() { this._newSigningKeys = this._newSigningKeys || (0, newSigningKey_1.NewSigningKeyListInstance)(this._version, this._solution.sid); return this._newSigningKeys; } get notifications() { this._notifications = this._notifications || (0, notification_1.NotificationListInstance)(this._version, this._solution.sid); return this._notifications; } get outgoingCallerIds() { this._outgoingCallerIds = this._outgoingCallerIds || (0, outgoingCallerId_1.OutgoingCallerIdListInstance)(this._version, this._solution.sid); return this._outgoingCallerIds; } get queues() { this._queues = this._queues || (0, queue_1.QueueListInstance)(this._version, this._solution.sid); return this._queues; } get recordings() { this._recordings = this._recordings || (0, recording_1.RecordingListInstance)(this._version, this._solution.sid); return this._recordings; } get shortCodes() { this._shortCodes = this._shortCodes || (0, shortCode_1.ShortCodeListInstance)(this._version, this._solution.sid); return this._shortCodes; } get signingKeys() { this._signingKeys = this._signingKeys || (0, signingKey_1.SigningKeyListInstance)(this._version, this._solution.sid); return this._signingKeys; } get sip() { this._sip = this._sip || (0, sip_1.SipListInstance)(this._version, this._solution.sid); return this._sip; } get tokens() { this._tokens = this._tokens || (0, token_1.TokenListInstance)(this._version, this._solution.sid); return this._tokens; } get transcriptions() { this._transcriptions = this._transcriptions || (0, transcription_1.TranscriptionListInstance)(this._version, this._solution.sid); return this._transcriptions; } get usage() { this._usage = this._usage || (0, usage_1.UsageListInstance)(this._version, this._solution.sid); return this._usage; } get validationRequests() { this._validationRequests = this._validationRequests || (0, validationRequest_1.ValidationRequestListInstance)(this._version, this._solution.sid); return this._validationRequests; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AccountInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["status"] !== undefined) data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AccountInstance(operationVersion, payload, 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.AccountContextImpl = AccountContextImpl; class AccountInstance { constructor(_version, payload, sid) { this._version = _version; this.authToken = payload.auth_token; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.ownerAccountSid = payload.owner_account_sid; this.sid = payload.sid; this.status = payload.status; this.subresourceUris = payload.subresource_uris; this.type = payload.type; this.uri = payload.uri; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AccountContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a AccountInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the addresses. */ addresses() { return this._proxy.addresses; } /** * Access the applications. */ applications() { return this._proxy.applications; } /** * Access the authorizedConnectApps. */ authorizedConnectApps() { return this._proxy.authorizedConnectApps; } /** * Access the availablePhoneNumbers. */ availablePhoneNumbers() { return this._proxy.availablePhoneNumbers; } /** * Access the balance. */ balance() { return this._proxy.balance; } /** * Access the calls. */ calls() { return this._proxy.calls; } /** * Access the conferences. */ conferences() { return this._proxy.conferences; } /** * Access the connectApps. */ connectApps() { return this._proxy.connectApps; } /** * Access the incomingPhoneNumbers. */ incomingPhoneNumbers() { return this._proxy.incomingPhoneNumbers; } /** * Access the keys. */ keys() { return this._proxy.keys; } /** * Access the messages. */ messages() { return this._proxy.messages; } /** * Access the newKeys. */ newKeys() { return this._proxy.newKeys; } /** * Access the newSigningKeys. */ newSigningKeys() { return this._proxy.newSigningKeys; } /** * Access the notifications. */ notifications() { return this._proxy.notifications; } /** * Access the outgoingCallerIds. */ outgoingCallerIds() { return this._proxy.outgoingCallerIds; } /** * Access the queues. */ queues() { return this._proxy.queues; } /** * Access the recordings. */ recordings() { return this._proxy.recordings; } /** * Access the shortCodes. */ shortCodes() { return this._proxy.shortCodes; } /** * Access the signingKeys. */ signingKeys() { return this._proxy.signingKeys; } /** * Access the sip. */ sip() { return this._proxy.sip; } /** * Access the tokens. */ tokens() { return this._proxy.tokens; } /** * Access the transcriptions. */ transcriptions() { return this._proxy.transcriptions; } /** * Access the usage. */ usage() { return this._proxy.usage; } /** * Access the validationRequests. */ validationRequests() { return this._proxy.validationRequests; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { authToken: this.authToken, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, ownerAccountSid: this.ownerAccountSid, sid: this.sid, status: this.status, subresourceUris: this.subresourceUris, type: this.type, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AccountInstance = AccountInstance; function AccountListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AccountContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Accounts.json`; instance.create = function create(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"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AccountInstance(operationVersion, payload)); 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["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AccountPage(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 AccountPage(instance._version, payload, 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; } exports.AccountListInstance = AccountListInstance; class AccountPage extends Page_1.default { /** * Initialize the AccountPage * * @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 AccountInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AccountInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AccountPage = AccountPage; rest/api/v2010/account/usage.js000064400000004166151677225100012155 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.UsageListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const record_1 = require("./usage/record"); const trigger_1 = require("./usage/trigger"); function UsageListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage.json`; Object.defineProperty(instance, "records", { get: function records() { if (!instance._records) { instance._records = (0, record_1.RecordListInstance)(instance._version, instance._solution.accountSid); } return instance._records; }, }); Object.defineProperty(instance, "triggers", { get: function triggers() { if (!instance._triggers) { instance._triggers = (0, trigger_1.TriggerListInstance)(instance._version, instance._solution.accountSid); } return instance._triggers; }, }); 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; } exports.UsageListInstance = UsageListInstance; rest/api/v2010/account/key.js000064400000020215151677225100011632 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.KeyPage = exports.KeyListInstance = exports.KeyInstance = exports.KeyContextImpl = void 0; 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 KeyContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Keys/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new KeyInstance(operationVersion, payload, instance._solution.accountSid, 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"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new KeyInstance(operationVersion, payload, instance._solution.accountSid, 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.KeyContextImpl = KeyContextImpl; class KeyInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new KeyContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.KeyInstance = KeyInstance; function KeyListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new KeyContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Keys.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new KeyPage(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 KeyPage(instance._version, payload, 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; } exports.KeyListInstance = KeyListInstance; class KeyPage extends Page_1.default { /** * Initialize the KeyPage * * @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 KeyInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new KeyInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.KeyPage = KeyPage; rest/api/v2010/account/transcription.d.ts000064400000024513151677225100014202 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; export type TranscriptionStatus = "in-progress" | "completed" | "failed"; /** * Options to pass to each */ export interface TranscriptionListInstanceEachOptions { /** 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: TranscriptionInstance, 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 TranscriptionListInstanceOptions { /** 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 TranscriptionListInstancePageOptions { /** 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 TranscriptionContext { /** * Remove a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptionInstance */ fetch(callback?: (error: Error | null, item?: TranscriptionInstance) => any): Promise<TranscriptionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TranscriptionContextSolution { accountSid: string; sid: string; } export declare class TranscriptionContextImpl implements TranscriptionContext { protected _version: V2010; protected _solution: TranscriptionContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TranscriptionInstance) => any): Promise<TranscriptionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TranscriptionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TranscriptionPayload extends TwilioResponsePayload { transcriptions: TranscriptionResource[]; } interface TranscriptionResource { account_sid: string; api_version: string; date_created: Date; date_updated: Date; duration: string; price: number; price_unit: string; recording_sid: string; sid: string; status: TranscriptionStatus; transcription_text: string; type: string; uri: string; } export declare class TranscriptionInstance { protected _version: V2010; protected _solution: TranscriptionContextSolution; protected _context?: TranscriptionContext; constructor(_version: V2010, payload: TranscriptionResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. */ accountSid: string; /** * The API version used to create the transcription. */ apiVersion: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The duration of the transcribed audio in seconds. */ duration: string; /** * The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. */ recordingSid: string; /** * The unique string that that we created to identify the Transcription resource. */ sid: string; status: TranscriptionStatus; /** * The text content of the transcription. */ transcriptionText: string; /** * The transcription type. Can only be: `fast`. */ type: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Remove a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptionInstance */ fetch(callback?: (error: Error | null, item?: TranscriptionInstance) => any): Promise<TranscriptionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; dateCreated: Date; dateUpdated: Date; duration: string; price: number; priceUnit: string; recordingSid: string; sid: string; status: TranscriptionStatus; transcriptionText: string; type: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TranscriptionSolution { accountSid: string; } export interface TranscriptionListInstance { _version: V2010; _solution: TranscriptionSolution; _uri: string; (sid: string): TranscriptionContext; get(sid: string): TranscriptionContext; /** * Streams TranscriptionInstance 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 { TranscriptionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TranscriptionInstance, done: (err?: Error) => void) => void): void; each(params: TranscriptionListInstanceEachOptions, callback?: (item: TranscriptionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TranscriptionInstance 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: TranscriptionPage) => any): Promise<TranscriptionPage>; /** * Lists TranscriptionInstance 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 { TranscriptionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TranscriptionInstance[]) => any): Promise<TranscriptionInstance[]>; list(params: TranscriptionListInstanceOptions, callback?: (error: Error | null, items: TranscriptionInstance[]) => any): Promise<TranscriptionInstance[]>; /** * Retrieve a single page of TranscriptionInstance 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 { TranscriptionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TranscriptionPage) => any): Promise<TranscriptionPage>; page(params: TranscriptionListInstancePageOptions, callback?: (error: Error | null, items: TranscriptionPage) => any): Promise<TranscriptionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TranscriptionListInstance(version: V2010, accountSid: string): TranscriptionListInstance; export declare class TranscriptionPage extends Page<V2010, TranscriptionPayload, TranscriptionResource, TranscriptionInstance> { /** * Initialize the TranscriptionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: TranscriptionSolution); /** * Build an instance of TranscriptionInstance * * @param payload - Payload response from the API */ getInstance(payload: TranscriptionResource): TranscriptionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/authorizedConnectApp.d.ts000064400000022573151677225100015440 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; export type AuthorizedConnectAppPermission = "get-all" | "post-all"; /** * Options to pass to each */ export interface AuthorizedConnectAppListInstanceEachOptions { /** 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: AuthorizedConnectAppInstance, 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 AuthorizedConnectAppListInstanceOptions { /** 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 AuthorizedConnectAppListInstancePageOptions { /** 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 AuthorizedConnectAppContext { /** * Fetch a AuthorizedConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizedConnectAppInstance */ fetch(callback?: (error: Error | null, item?: AuthorizedConnectAppInstance) => any): Promise<AuthorizedConnectAppInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AuthorizedConnectAppContextSolution { accountSid: string; connectAppSid: string; } export declare class AuthorizedConnectAppContextImpl implements AuthorizedConnectAppContext { protected _version: V2010; protected _solution: AuthorizedConnectAppContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, connectAppSid: string); fetch(callback?: (error: Error | null, item?: AuthorizedConnectAppInstance) => any): Promise<AuthorizedConnectAppInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AuthorizedConnectAppContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AuthorizedConnectAppPayload extends TwilioResponsePayload { authorized_connect_apps: AuthorizedConnectAppResource[]; } interface AuthorizedConnectAppResource { account_sid: string; connect_app_company_name: string; connect_app_description: string; connect_app_friendly_name: string; connect_app_homepage_url: string; connect_app_sid: string; permissions: Array<AuthorizedConnectAppPermission>; uri: string; } export declare class AuthorizedConnectAppInstance { protected _version: V2010; protected _solution: AuthorizedConnectAppContextSolution; protected _context?: AuthorizedConnectAppContext; constructor(_version: V2010, payload: AuthorizedConnectAppResource, accountSid: string, connectAppSid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AuthorizedConnectApp resource. */ accountSid: string; /** * The company name set for the Connect App. */ connectAppCompanyName: string; /** * A detailed description of the Connect App. */ connectAppDescription: string; /** * The name of the Connect App. */ connectAppFriendlyName: string; /** * The public URL for the Connect App. */ connectAppHomepageUrl: string; /** * The SID that we assigned to the Connect App. */ connectAppSid: string; /** * The set of permissions that you authorized for the Connect App. Can be: `get-all` or `post-all`. */ permissions: Array<AuthorizedConnectAppPermission>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Fetch a AuthorizedConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizedConnectAppInstance */ fetch(callback?: (error: Error | null, item?: AuthorizedConnectAppInstance) => any): Promise<AuthorizedConnectAppInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; connectAppCompanyName: string; connectAppDescription: string; connectAppFriendlyName: string; connectAppHomepageUrl: string; connectAppSid: string; permissions: AuthorizedConnectAppPermission[]; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AuthorizedConnectAppSolution { accountSid: string; } export interface AuthorizedConnectAppListInstance { _version: V2010; _solution: AuthorizedConnectAppSolution; _uri: string; (connectAppSid: string): AuthorizedConnectAppContext; get(connectAppSid: string): AuthorizedConnectAppContext; /** * Streams AuthorizedConnectAppInstance 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 { AuthorizedConnectAppListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AuthorizedConnectAppInstance, done: (err?: Error) => void) => void): void; each(params: AuthorizedConnectAppListInstanceEachOptions, callback?: (item: AuthorizedConnectAppInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AuthorizedConnectAppInstance 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: AuthorizedConnectAppPage) => any): Promise<AuthorizedConnectAppPage>; /** * Lists AuthorizedConnectAppInstance 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 { AuthorizedConnectAppListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AuthorizedConnectAppInstance[]) => any): Promise<AuthorizedConnectAppInstance[]>; list(params: AuthorizedConnectAppListInstanceOptions, callback?: (error: Error | null, items: AuthorizedConnectAppInstance[]) => any): Promise<AuthorizedConnectAppInstance[]>; /** * Retrieve a single page of AuthorizedConnectAppInstance 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 { AuthorizedConnectAppListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AuthorizedConnectAppPage) => any): Promise<AuthorizedConnectAppPage>; page(params: AuthorizedConnectAppListInstancePageOptions, callback?: (error: Error | null, items: AuthorizedConnectAppPage) => any): Promise<AuthorizedConnectAppPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthorizedConnectAppListInstance(version: V2010, accountSid: string): AuthorizedConnectAppListInstance; export declare class AuthorizedConnectAppPage extends Page<V2010, AuthorizedConnectAppPayload, AuthorizedConnectAppResource, AuthorizedConnectAppInstance> { /** * Initialize the AuthorizedConnectAppPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AuthorizedConnectAppSolution); /** * Build an instance of AuthorizedConnectAppInstance * * @param payload - Payload response from the API */ getInstance(payload: AuthorizedConnectAppResource): AuthorizedConnectAppInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/application.js000064400000035346151677225100013360 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.ApplicationPage = exports.ApplicationListInstance = exports.ApplicationInstance = exports.ApplicationContextImpl = void 0; 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 ApplicationContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Applications/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ApplicationInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["apiVersion"] !== undefined) data["ApiVersion"] = params["apiVersion"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["voiceCallerIdLookup"] !== undefined) data["VoiceCallerIdLookup"] = serialize.bool(params["voiceCallerIdLookup"]); if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["smsStatusCallback"] !== undefined) data["SmsStatusCallback"] = params["smsStatusCallback"]; if (params["messageStatusCallback"] !== undefined) data["MessageStatusCallback"] = params["messageStatusCallback"]; if (params["publicApplicationConnectEnabled"] !== undefined) data["PublicApplicationConnectEnabled"] = serialize.bool(params["publicApplicationConnectEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ApplicationInstance(operationVersion, payload, instance._solution.accountSid, 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.ApplicationContextImpl = ApplicationContextImpl; class ApplicationInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.messageStatusCallback = payload.message_status_callback; this.sid = payload.sid; this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsStatusCallback = payload.sms_status_callback; this.smsUrl = payload.sms_url; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.uri = payload.uri; this.voiceCallerIdLookup = payload.voice_caller_id_lookup; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceMethod = payload.voice_method; this.voiceUrl = payload.voice_url; this.publicApplicationConnectEnabled = payload.public_application_connect_enabled; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ApplicationContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a ApplicationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ApplicationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApplicationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, messageStatusCallback: this.messageStatusCallback, sid: this.sid, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsStatusCallback: this.smsStatusCallback, smsUrl: this.smsUrl, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, uri: this.uri, voiceCallerIdLookup: this.voiceCallerIdLookup, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceMethod: this.voiceMethod, voiceUrl: this.voiceUrl, publicApplicationConnectEnabled: this.publicApplicationConnectEnabled, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ApplicationInstance = ApplicationInstance; function ApplicationListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ApplicationContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Applications.json`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["apiVersion"] !== undefined) data["ApiVersion"] = params["apiVersion"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["voiceCallerIdLookup"] !== undefined) data["VoiceCallerIdLookup"] = serialize.bool(params["voiceCallerIdLookup"]); if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["smsStatusCallback"] !== undefined) data["SmsStatusCallback"] = params["smsStatusCallback"]; if (params["messageStatusCallback"] !== undefined) data["MessageStatusCallback"] = params["messageStatusCallback"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["publicApplicationConnectEnabled"] !== undefined) data["PublicApplicationConnectEnabled"] = serialize.bool(params["publicApplicationConnectEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ApplicationInstance(operationVersion, payload, instance._solution.accountSid)); 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["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ApplicationPage(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 ApplicationPage(instance._version, payload, 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; } exports.ApplicationListInstance = ApplicationListInstance; class ApplicationPage extends Page_1.default { /** * Initialize the ApplicationPage * * @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 ApplicationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ApplicationInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ApplicationPage = ApplicationPage; rest/api/v2010/account/newKey.js000064400000006315151677225100012311 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.NewKeyInstance = exports.NewKeyListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function NewKeyListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Keys.json`; instance.create = function create(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"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new NewKeyInstance(operationVersion, payload, instance._solution.accountSid)); 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; } exports.NewKeyListInstance = NewKeyListInstance; class NewKeyInstance { constructor(_version, payload, accountSid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.secret = payload.secret; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, secret: this.secret, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NewKeyInstance = NewKeyInstance; rest/api/v2010/account/signingKey.js000064400000020537151677225100013160 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.SigningKeyPage = exports.SigningKeyListInstance = exports.SigningKeyInstance = exports.SigningKeyContextImpl = void 0; 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 SigningKeyContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/SigningKeys/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SigningKeyInstance(operationVersion, payload, instance._solution.accountSid, 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"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SigningKeyInstance(operationVersion, payload, instance._solution.accountSid, 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.SigningKeyContextImpl = SigningKeyContextImpl; class SigningKeyInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SigningKeyContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a SigningKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SigningKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningKeyInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SigningKeyInstance = SigningKeyInstance; function SigningKeyListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SigningKeyContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/SigningKeys.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SigningKeyPage(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 SigningKeyPage(instance._version, payload, 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; } exports.SigningKeyListInstance = SigningKeyListInstance; class SigningKeyPage extends Page_1.default { /** * Initialize the SigningKeyPage * * @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 SigningKeyInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SigningKeyInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SigningKeyPage = SigningKeyPage; rest/api/v2010/account/queue.js000064400000024344151677225100012175 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.QueuePage = exports.QueueListInstance = exports.QueueInstance = exports.QueueContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const member_1 = require("./queue/member"); class QueueContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Queues/${sid}.json`; } get members() { this._members = this._members || (0, member_1.MemberListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._members; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new QueueInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["maxSize"] !== undefined) data["MaxSize"] = params["maxSize"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new QueueInstance(operationVersion, payload, instance._solution.accountSid, 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.QueueContextImpl = QueueContextImpl; class QueueInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.currentSize = deserialize.integer(payload.current_size); this.friendlyName = payload.friendly_name; this.uri = payload.uri; this.accountSid = payload.account_sid; this.averageWaitTime = deserialize.integer(payload.average_wait_time); this.sid = payload.sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.maxSize = deserialize.integer(payload.max_size); this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new QueueContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a QueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a QueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed QueueInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the members. */ members() { return this._proxy.members; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { dateUpdated: this.dateUpdated, currentSize: this.currentSize, friendlyName: this.friendlyName, uri: this.uri, accountSid: this.accountSid, averageWaitTime: this.averageWaitTime, sid: this.sid, dateCreated: this.dateCreated, maxSize: this.maxSize, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.QueueInstance = QueueInstance; function QueueListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new QueueContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Queues.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["maxSize"] !== undefined) data["MaxSize"] = params["maxSize"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new QueueInstance(operationVersion, payload, instance._solution.accountSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new QueuePage(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 QueuePage(instance._version, payload, 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; } exports.QueueListInstance = QueueListInstance; class QueuePage extends Page_1.default { /** * Initialize the QueuePage * * @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 QueueInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new QueueInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.QueuePage = QueuePage; rest/api/v2010/account/newSigningKey.d.ts000064400000005703151677225100014064 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../V2010"; /** * Options to pass to create a NewSigningKeyInstance */ export interface NewSigningKeyListInstanceCreateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; } export interface NewSigningKeySolution { accountSid: string; } export interface NewSigningKeyListInstance { _version: V2010; _solution: NewSigningKeySolution; _uri: string; /** * Create a NewSigningKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NewSigningKeyInstance */ create(callback?: (error: Error | null, item?: NewSigningKeyInstance) => any): Promise<NewSigningKeyInstance>; /** * Create a NewSigningKeyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NewSigningKeyInstance */ create(params: NewSigningKeyListInstanceCreateOptions, callback?: (error: Error | null, item?: NewSigningKeyInstance) => any): Promise<NewSigningKeyInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NewSigningKeyListInstance(version: V2010, accountSid: string): NewSigningKeyListInstance; interface NewSigningKeyResource { sid: string; friendly_name: string; date_created: Date; date_updated: Date; secret: string; } export declare class NewSigningKeyInstance { protected _version: V2010; constructor(_version: V2010, payload: NewSigningKeyResource, accountSid: string); /** * The unique string that that we created to identify the NewSigningKey resource. */ sid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** */ secret: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; secret: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/incomingPhoneNumber/mobile.js000064400000026707151677225100016273 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.MobilePage = exports.MobileInstance = exports.MobileListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function MobileListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/IncomingPhoneNumbers/Mobile.json`; 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"]; if (params["apiVersion"] !== undefined) data["ApiVersion"] = params["apiVersion"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["smsApplicationSid"] !== undefined) data["SmsApplicationSid"] = params["smsApplicationSid"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["voiceApplicationSid"] !== undefined) data["VoiceApplicationSid"] = params["voiceApplicationSid"]; if (params["voiceCallerIdLookup"] !== undefined) data["VoiceCallerIdLookup"] = serialize.bool(params["voiceCallerIdLookup"]); if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["identitySid"] !== undefined) data["IdentitySid"] = params["identitySid"]; if (params["addressSid"] !== undefined) data["AddressSid"] = params["addressSid"]; if (params["emergencyStatus"] !== undefined) data["EmergencyStatus"] = params["emergencyStatus"]; if (params["emergencyAddressSid"] !== undefined) data["EmergencyAddressSid"] = params["emergencyAddressSid"]; if (params["trunkSid"] !== undefined) data["TrunkSid"] = params["trunkSid"]; if (params["voiceReceiveMode"] !== undefined) data["VoiceReceiveMode"] = params["voiceReceiveMode"]; if (params["bundleSid"] !== undefined) data["BundleSid"] = params["bundleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MobileInstance(operationVersion, payload, instance._solution.accountSid)); 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["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["origin"] !== undefined) data["Origin"] = params["origin"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MobilePage(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 MobilePage(instance._version, payload, 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; } exports.MobileListInstance = MobileListInstance; class MobileInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.addressSid = payload.address_sid; this.addressRequirements = payload.address_requirements; this.apiVersion = payload.api_version; this.beta = payload.beta; this.capabilities = payload.capabilities; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.identitySid = payload.identity_sid; this.phoneNumber = payload.phone_number; this.origin = payload.origin; this.sid = payload.sid; this.smsApplicationSid = payload.sms_application_sid; this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsUrl = payload.sms_url; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.trunkSid = payload.trunk_sid; this.uri = payload.uri; this.voiceReceiveMode = payload.voice_receive_mode; this.voiceApplicationSid = payload.voice_application_sid; this.voiceCallerIdLookup = payload.voice_caller_id_lookup; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceMethod = payload.voice_method; this.voiceUrl = payload.voice_url; this.emergencyStatus = payload.emergency_status; this.emergencyAddressSid = payload.emergency_address_sid; this.emergencyAddressStatus = payload.emergency_address_status; this.bundleSid = payload.bundle_sid; this.status = payload.status; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, addressSid: this.addressSid, addressRequirements: this.addressRequirements, apiVersion: this.apiVersion, beta: this.beta, capabilities: this.capabilities, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, identitySid: this.identitySid, phoneNumber: this.phoneNumber, origin: this.origin, sid: this.sid, smsApplicationSid: this.smsApplicationSid, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsUrl: this.smsUrl, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, trunkSid: this.trunkSid, uri: this.uri, voiceReceiveMode: this.voiceReceiveMode, voiceApplicationSid: this.voiceApplicationSid, voiceCallerIdLookup: this.voiceCallerIdLookup, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceMethod: this.voiceMethod, voiceUrl: this.voiceUrl, emergencyStatus: this.emergencyStatus, emergencyAddressSid: this.emergencyAddressSid, emergencyAddressStatus: this.emergencyAddressStatus, bundleSid: this.bundleSid, status: this.status, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MobileInstance = MobileInstance; class MobilePage extends Page_1.default { /** * Initialize the MobilePage * * @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 MobileInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MobileInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MobilePage = MobilePage; rest/api/v2010/account/incomingPhoneNumber/tollFree.d.ts000064400000045323151677225100017027 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; export type TollFreeAddressRequirement = "none" | "any" | "local" | "foreign"; export type TollFreeEmergencyAddressStatus = "registered" | "unregistered" | "pending-registration" | "registration-failure" | "pending-unregistration" | "unregistration-failure"; export type TollFreeEmergencyStatus = "Active" | "Inactive"; export type TollFreeVoiceReceiveMode = "voice" | "fax"; /** * Options to pass to create a TollFreeInstance */ export interface TollFreeListInstanceCreateOptions { /** The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. */ phoneNumber: string; /** The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. */ apiVersion?: string; /** A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. */ friendlyName?: string; /** The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. */ smsApplicationSid?: string; /** The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsFallbackMethod?: string; /** The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. */ smsFallbackUrl?: string; /** The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsMethod?: string; /** The URL we should call when the new phone number receives an incoming SMS message. */ smsUrl?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ statusCallbackMethod?: string; /** The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid?: string; /** Whether to lookup the caller\\\'s name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. */ voiceCallerIdLookup?: boolean; /** The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceFallbackMethod?: string; /** The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl?: string; /** The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceMethod?: string; /** The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl?: string; /** The SID of the Identity resource that we should associate with the new phone number. Some regions require an Identity to meet local regulations. */ identitySid?: string; /** The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. */ addressSid?: string; /** */ emergencyStatus?: TollFreeEmergencyStatus; /** The SID of the emergency address configuration to use for emergency calling from the new phone number. */ emergencyAddressSid?: string; /** The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid?: string; /** */ voiceReceiveMode?: TollFreeVoiceReceiveMode; /** The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. */ bundleSid?: string; } /** * Options to pass to each */ export interface TollFreeListInstanceEachOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: TollFreeInstance, 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 TollFreeListInstanceOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface TollFreeListInstancePageOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface TollFreeSolution { accountSid: string; } export interface TollFreeListInstance { _version: V2010; _solution: TollFreeSolution; _uri: string; /** * Create a TollFreeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TollFreeInstance */ create(params: TollFreeListInstanceCreateOptions, callback?: (error: Error | null, item?: TollFreeInstance) => any): Promise<TollFreeInstance>; /** * Streams TollFreeInstance 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 { TollFreeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TollFreeInstance, done: (err?: Error) => void) => void): void; each(params: TollFreeListInstanceEachOptions, callback?: (item: TollFreeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TollFreeInstance 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: TollFreePage) => any): Promise<TollFreePage>; /** * Lists TollFreeInstance 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 { TollFreeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TollFreeInstance[]) => any): Promise<TollFreeInstance[]>; list(params: TollFreeListInstanceOptions, callback?: (error: Error | null, items: TollFreeInstance[]) => any): Promise<TollFreeInstance[]>; /** * Retrieve a single page of TollFreeInstance 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 { TollFreeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TollFreePage) => any): Promise<TollFreePage>; page(params: TollFreeListInstancePageOptions, callback?: (error: Error | null, items: TollFreePage) => any): Promise<TollFreePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TollFreeListInstance(version: V2010, accountSid: string): TollFreeListInstance; interface TollFreePayload extends TwilioResponsePayload { incoming_phone_numbers: TollFreeResource[]; } interface TollFreeResource { account_sid: string; address_sid: string; address_requirements: TollFreeAddressRequirement; api_version: string; beta: boolean; capabilities: PhoneNumberCapabilities; date_created: Date; date_updated: Date; friendly_name: string; identity_sid: string; phone_number: string; origin: string; sid: string; sms_application_sid: string; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_url: string; status_callback: string; status_callback_method: string; trunk_sid: string; uri: string; voice_receive_mode: TollFreeVoiceReceiveMode; voice_application_sid: string; voice_caller_id_lookup: boolean; voice_fallback_method: string; voice_fallback_url: string; voice_method: string; voice_url: string; emergency_status: TollFreeEmergencyStatus; emergency_address_sid: string; emergency_address_status: TollFreeEmergencyAddressStatus; bundle_sid: string; status: string; } export declare class TollFreeInstance { protected _version: V2010; constructor(_version: V2010, payload: TollFreeResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. */ accountSid: string; /** * The SID of the Address resource associated with the phone number. */ addressSid: string; addressRequirements: TollFreeAddressRequirement; /** * The API version used to start a new TwiML session. */ apiVersion: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. */ identitySid: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The phone number\'s origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. */ origin: string; /** * The unique string that that we created to identify the resource. */ sid: string; /** * The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. */ smsApplicationSid: string; /** * The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod: string; /** * The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl: string; /** * The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. */ smsMethod: string; /** * The URL we call when the phone number receives an incoming SMS message. */ smsUrl: string; /** * The URL we call using the `status_callback_method` to send status information to your application. */ statusCallback: string; /** * The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. */ statusCallbackMethod: string; /** * The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; voiceReceiveMode: TollFreeVoiceReceiveMode; /** * The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid: string; /** * Whether we look up the caller\'s caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. */ voiceCallerIdLookup: boolean; /** * The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod: string; /** * The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl: string; /** * The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod: string; /** * The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl: string; emergencyStatus: TollFreeEmergencyStatus; /** * The SID of the emergency address configuration that we use for emergency calling from this phone number. */ emergencyAddressSid: string; emergencyAddressStatus: TollFreeEmergencyAddressStatus; /** * The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. */ bundleSid: string; status: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; addressSid: string; addressRequirements: TollFreeAddressRequirement; apiVersion: string; beta: boolean; capabilities: PhoneNumberCapabilities; dateCreated: Date; dateUpdated: Date; friendlyName: string; identitySid: string; phoneNumber: string; origin: string; sid: string; smsApplicationSid: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; statusCallback: string; statusCallbackMethod: string; trunkSid: string; uri: string; voiceReceiveMode: TollFreeVoiceReceiveMode; voiceApplicationSid: string; voiceCallerIdLookup: boolean; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceUrl: string; emergencyStatus: TollFreeEmergencyStatus; emergencyAddressSid: string; emergencyAddressStatus: TollFreeEmergencyAddressStatus; bundleSid: string; status: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class TollFreePage extends Page<V2010, TollFreePayload, TollFreeResource, TollFreeInstance> { /** * Initialize the TollFreePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: TollFreeSolution); /** * Build an instance of TollFreeInstance * * @param payload - Payload response from the API */ getInstance(payload: TollFreeResource): TollFreeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.d.ts000064400000026065151677225100017760 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { AssignedAddOnExtensionListInstance } from "./assignedAddOn/assignedAddOnExtension"; /** * Options to pass to create a AssignedAddOnInstance */ export interface AssignedAddOnListInstanceCreateOptions { /** The SID that identifies the Add-on installation. */ installedAddOnSid: string; } /** * Options to pass to each */ export interface AssignedAddOnListInstanceEachOptions { /** 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: AssignedAddOnInstance, 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 AssignedAddOnListInstanceOptions { /** 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 AssignedAddOnListInstancePageOptions { /** 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 AssignedAddOnContext { extensions: AssignedAddOnExtensionListInstance; /** * Remove a AssignedAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AssignedAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssignedAddOnInstance */ fetch(callback?: (error: Error | null, item?: AssignedAddOnInstance) => any): Promise<AssignedAddOnInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AssignedAddOnContextSolution { accountSid: string; resourceSid: string; sid: string; } export declare class AssignedAddOnContextImpl implements AssignedAddOnContext { protected _version: V2010; protected _solution: AssignedAddOnContextSolution; protected _uri: string; protected _extensions?: AssignedAddOnExtensionListInstance; constructor(_version: V2010, accountSid: string, resourceSid: string, sid: string); get extensions(): AssignedAddOnExtensionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AssignedAddOnInstance) => any): Promise<AssignedAddOnInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AssignedAddOnContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AssignedAddOnPayload extends TwilioResponsePayload { assigned_add_ons: AssignedAddOnResource[]; } interface AssignedAddOnResource { sid: string; account_sid: string; resource_sid: string; friendly_name: string; description: string; configuration: any; unique_name: string; date_created: Date; date_updated: Date; uri: string; subresource_uris: Record<string, string>; } export declare class AssignedAddOnInstance { protected _version: V2010; protected _solution: AssignedAddOnContextSolution; protected _context?: AssignedAddOnContext; constructor(_version: V2010, payload: AssignedAddOnResource, accountSid: string, resourceSid: string, sid?: string); /** * The unique string that that we created to identify the resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. */ accountSid: string; /** * The SID of the Phone Number to which the Add-on is assigned. */ resourceSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * A short description of the functionality that the Add-on provides. */ description: string; /** * A JSON string that represents the current configuration of this Add-on installation. */ configuration: any; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * A list of related resources identified by their relative URIs. */ subresourceUris: Record<string, string>; private get _proxy(); /** * Remove a AssignedAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AssignedAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssignedAddOnInstance */ fetch(callback?: (error: Error | null, item?: AssignedAddOnInstance) => any): Promise<AssignedAddOnInstance>; /** * Access the extensions. */ extensions(): AssignedAddOnExtensionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; resourceSid: string; friendlyName: string; description: string; configuration: any; uniqueName: string; dateCreated: Date; dateUpdated: Date; uri: string; subresourceUris: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AssignedAddOnSolution { accountSid: string; resourceSid: string; } export interface AssignedAddOnListInstance { _version: V2010; _solution: AssignedAddOnSolution; _uri: string; (sid: string): AssignedAddOnContext; get(sid: string): AssignedAddOnContext; /** * Create a AssignedAddOnInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssignedAddOnInstance */ create(params: AssignedAddOnListInstanceCreateOptions, callback?: (error: Error | null, item?: AssignedAddOnInstance) => any): Promise<AssignedAddOnInstance>; /** * Streams AssignedAddOnInstance 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 { AssignedAddOnListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AssignedAddOnInstance, done: (err?: Error) => void) => void): void; each(params: AssignedAddOnListInstanceEachOptions, callback?: (item: AssignedAddOnInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AssignedAddOnInstance 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: AssignedAddOnPage) => any): Promise<AssignedAddOnPage>; /** * Lists AssignedAddOnInstance 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 { AssignedAddOnListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AssignedAddOnInstance[]) => any): Promise<AssignedAddOnInstance[]>; list(params: AssignedAddOnListInstanceOptions, callback?: (error: Error | null, items: AssignedAddOnInstance[]) => any): Promise<AssignedAddOnInstance[]>; /** * Retrieve a single page of AssignedAddOnInstance 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 { AssignedAddOnListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AssignedAddOnPage) => any): Promise<AssignedAddOnPage>; page(params: AssignedAddOnListInstancePageOptions, callback?: (error: Error | null, items: AssignedAddOnPage) => any): Promise<AssignedAddOnPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AssignedAddOnListInstance(version: V2010, accountSid: string, resourceSid: string): AssignedAddOnListInstance; export declare class AssignedAddOnPage extends Page<V2010, AssignedAddOnPayload, AssignedAddOnResource, AssignedAddOnInstance> { /** * Initialize the AssignedAddOnPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AssignedAddOnSolution); /** * Build an instance of AssignedAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload: AssignedAddOnResource): AssignedAddOnInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.d.ts000064400000023314151677225100024352 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; /** * Options to pass to each */ export interface AssignedAddOnExtensionListInstanceEachOptions { /** 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: AssignedAddOnExtensionInstance, 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 AssignedAddOnExtensionListInstanceOptions { /** 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 AssignedAddOnExtensionListInstancePageOptions { /** 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 AssignedAddOnExtensionContext { /** * Fetch a AssignedAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssignedAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: AssignedAddOnExtensionInstance) => any): Promise<AssignedAddOnExtensionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AssignedAddOnExtensionContextSolution { accountSid: string; resourceSid: string; assignedAddOnSid: string; sid: string; } export declare class AssignedAddOnExtensionContextImpl implements AssignedAddOnExtensionContext { protected _version: V2010; protected _solution: AssignedAddOnExtensionContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, resourceSid: string, assignedAddOnSid: string, sid: string); fetch(callback?: (error: Error | null, item?: AssignedAddOnExtensionInstance) => any): Promise<AssignedAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AssignedAddOnExtensionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AssignedAddOnExtensionPayload extends TwilioResponsePayload { extensions: AssignedAddOnExtensionResource[]; } interface AssignedAddOnExtensionResource { sid: string; account_sid: string; resource_sid: string; assigned_add_on_sid: string; friendly_name: string; product_name: string; unique_name: string; uri: string; enabled: boolean; } export declare class AssignedAddOnExtensionInstance { protected _version: V2010; protected _solution: AssignedAddOnExtensionContextSolution; protected _context?: AssignedAddOnExtensionContext; constructor(_version: V2010, payload: AssignedAddOnExtensionResource, accountSid: string, resourceSid: string, assignedAddOnSid: string, sid?: string); /** * The unique string that that we created to identify the resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. */ accountSid: string; /** * The SID of the Phone Number to which the Add-on is assigned. */ resourceSid: string; /** * The SID that uniquely identifies the assigned Add-on installation. */ assignedAddOnSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * A string that you assigned to describe the Product this Extension is used within. */ productName: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * Whether the Extension will be invoked. */ enabled: boolean; private get _proxy(); /** * Fetch a AssignedAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssignedAddOnExtensionInstance */ fetch(callback?: (error: Error | null, item?: AssignedAddOnExtensionInstance) => any): Promise<AssignedAddOnExtensionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; resourceSid: string; assignedAddOnSid: string; friendlyName: string; productName: string; uniqueName: string; uri: string; enabled: boolean; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AssignedAddOnExtensionSolution { accountSid: string; resourceSid: string; assignedAddOnSid: string; } export interface AssignedAddOnExtensionListInstance { _version: V2010; _solution: AssignedAddOnExtensionSolution; _uri: string; (sid: string): AssignedAddOnExtensionContext; get(sid: string): AssignedAddOnExtensionContext; /** * Streams AssignedAddOnExtensionInstance 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 { AssignedAddOnExtensionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AssignedAddOnExtensionInstance, done: (err?: Error) => void) => void): void; each(params: AssignedAddOnExtensionListInstanceEachOptions, callback?: (item: AssignedAddOnExtensionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AssignedAddOnExtensionInstance 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: AssignedAddOnExtensionPage) => any): Promise<AssignedAddOnExtensionPage>; /** * Lists AssignedAddOnExtensionInstance 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 { AssignedAddOnExtensionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AssignedAddOnExtensionInstance[]) => any): Promise<AssignedAddOnExtensionInstance[]>; list(params: AssignedAddOnExtensionListInstanceOptions, callback?: (error: Error | null, items: AssignedAddOnExtensionInstance[]) => any): Promise<AssignedAddOnExtensionInstance[]>; /** * Retrieve a single page of AssignedAddOnExtensionInstance 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 { AssignedAddOnExtensionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AssignedAddOnExtensionPage) => any): Promise<AssignedAddOnExtensionPage>; page(params: AssignedAddOnExtensionListInstancePageOptions, callback?: (error: Error | null, items: AssignedAddOnExtensionPage) => any): Promise<AssignedAddOnExtensionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AssignedAddOnExtensionListInstance(version: V2010, accountSid: string, resourceSid: string, assignedAddOnSid: string): AssignedAddOnExtensionListInstance; export declare class AssignedAddOnExtensionPage extends Page<V2010, AssignedAddOnExtensionPayload, AssignedAddOnExtensionResource, AssignedAddOnExtensionInstance> { /** * Initialize the AssignedAddOnExtensionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AssignedAddOnExtensionSolution); /** * Build an instance of AssignedAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload: AssignedAddOnExtensionResource): AssignedAddOnExtensionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/incomingPhoneNumber/assignedAddOn/assignedAddOnExtension.js000064400000021057151677225100024120 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AssignedAddOnExtensionPage = exports.AssignedAddOnExtensionListInstance = exports.AssignedAddOnExtensionInstance = exports.AssignedAddOnExtensionContextImpl = void 0; 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 AssignedAddOnExtensionContextImpl { constructor(_version, accountSid, resourceSid, assignedAddOnSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(resourceSid)) { throw new Error("Parameter 'resourceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(assignedAddOnSid)) { throw new Error("Parameter 'assignedAddOnSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, resourceSid, assignedAddOnSid, sid }; this._uri = `/Accounts/${accountSid}/IncomingPhoneNumbers/${resourceSid}/AssignedAddOns/${assignedAddOnSid}/Extensions/${sid}.json`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AssignedAddOnExtensionInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.resourceSid, instance._solution.assignedAddOnSid, 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.AssignedAddOnExtensionContextImpl = AssignedAddOnExtensionContextImpl; class AssignedAddOnExtensionInstance { constructor(_version, payload, accountSid, resourceSid, assignedAddOnSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.resourceSid = payload.resource_sid; this.assignedAddOnSid = payload.assigned_add_on_sid; this.friendlyName = payload.friendly_name; this.productName = payload.product_name; this.uniqueName = payload.unique_name; this.uri = payload.uri; this.enabled = payload.enabled; this._solution = { accountSid, resourceSid, assignedAddOnSid, sid: sid || this.sid, }; } get _proxy() { this._context = this._context || new AssignedAddOnExtensionContextImpl(this._version, this._solution.accountSid, this._solution.resourceSid, this._solution.assignedAddOnSid, this._solution.sid); return this._context; } /** * Fetch a AssignedAddOnExtensionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssignedAddOnExtensionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, resourceSid: this.resourceSid, assignedAddOnSid: this.assignedAddOnSid, friendlyName: this.friendlyName, productName: this.productName, uniqueName: this.uniqueName, uri: this.uri, enabled: this.enabled, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssignedAddOnExtensionInstance = AssignedAddOnExtensionInstance; function AssignedAddOnExtensionListInstance(version, accountSid, resourceSid, assignedAddOnSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(resourceSid)) { throw new Error("Parameter 'resourceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(assignedAddOnSid)) { throw new Error("Parameter 'assignedAddOnSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AssignedAddOnExtensionContextImpl(version, accountSid, resourceSid, assignedAddOnSid, sid); }; instance._version = version; instance._solution = { accountSid, resourceSid, assignedAddOnSid }; instance._uri = `/Accounts/${accountSid}/IncomingPhoneNumbers/${resourceSid}/AssignedAddOns/${assignedAddOnSid}/Extensions.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AssignedAddOnExtensionPage(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 AssignedAddOnExtensionPage(instance._version, payload, 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; } exports.AssignedAddOnExtensionListInstance = AssignedAddOnExtensionListInstance; class AssignedAddOnExtensionPage extends Page_1.default { /** * Initialize the AssignedAddOnExtensionPage * * @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 AssignedAddOnExtensionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AssignedAddOnExtensionInstance(this._version, payload, this._solution.accountSid, this._solution.resourceSid, this._solution.assignedAddOnSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssignedAddOnExtensionPage = AssignedAddOnExtensionPage; rest/api/v2010/account/incomingPhoneNumber/tollFree.js000064400000026755151677225100016603 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.TollFreePage = exports.TollFreeInstance = exports.TollFreeListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function TollFreeListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/IncomingPhoneNumbers/TollFree.json`; 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"]; if (params["apiVersion"] !== undefined) data["ApiVersion"] = params["apiVersion"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["smsApplicationSid"] !== undefined) data["SmsApplicationSid"] = params["smsApplicationSid"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["voiceApplicationSid"] !== undefined) data["VoiceApplicationSid"] = params["voiceApplicationSid"]; if (params["voiceCallerIdLookup"] !== undefined) data["VoiceCallerIdLookup"] = serialize.bool(params["voiceCallerIdLookup"]); if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["identitySid"] !== undefined) data["IdentitySid"] = params["identitySid"]; if (params["addressSid"] !== undefined) data["AddressSid"] = params["addressSid"]; if (params["emergencyStatus"] !== undefined) data["EmergencyStatus"] = params["emergencyStatus"]; if (params["emergencyAddressSid"] !== undefined) data["EmergencyAddressSid"] = params["emergencyAddressSid"]; if (params["trunkSid"] !== undefined) data["TrunkSid"] = params["trunkSid"]; if (params["voiceReceiveMode"] !== undefined) data["VoiceReceiveMode"] = params["voiceReceiveMode"]; if (params["bundleSid"] !== undefined) data["BundleSid"] = params["bundleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TollFreeInstance(operationVersion, payload, instance._solution.accountSid)); 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["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["origin"] !== undefined) data["Origin"] = params["origin"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TollFreePage(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 TollFreePage(instance._version, payload, 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; } exports.TollFreeListInstance = TollFreeListInstance; class TollFreeInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.addressSid = payload.address_sid; this.addressRequirements = payload.address_requirements; this.apiVersion = payload.api_version; this.beta = payload.beta; this.capabilities = payload.capabilities; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.identitySid = payload.identity_sid; this.phoneNumber = payload.phone_number; this.origin = payload.origin; this.sid = payload.sid; this.smsApplicationSid = payload.sms_application_sid; this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsUrl = payload.sms_url; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.trunkSid = payload.trunk_sid; this.uri = payload.uri; this.voiceReceiveMode = payload.voice_receive_mode; this.voiceApplicationSid = payload.voice_application_sid; this.voiceCallerIdLookup = payload.voice_caller_id_lookup; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceMethod = payload.voice_method; this.voiceUrl = payload.voice_url; this.emergencyStatus = payload.emergency_status; this.emergencyAddressSid = payload.emergency_address_sid; this.emergencyAddressStatus = payload.emergency_address_status; this.bundleSid = payload.bundle_sid; this.status = payload.status; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, addressSid: this.addressSid, addressRequirements: this.addressRequirements, apiVersion: this.apiVersion, beta: this.beta, capabilities: this.capabilities, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, identitySid: this.identitySid, phoneNumber: this.phoneNumber, origin: this.origin, sid: this.sid, smsApplicationSid: this.smsApplicationSid, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsUrl: this.smsUrl, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, trunkSid: this.trunkSid, uri: this.uri, voiceReceiveMode: this.voiceReceiveMode, voiceApplicationSid: this.voiceApplicationSid, voiceCallerIdLookup: this.voiceCallerIdLookup, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceMethod: this.voiceMethod, voiceUrl: this.voiceUrl, emergencyStatus: this.emergencyStatus, emergencyAddressSid: this.emergencyAddressSid, emergencyAddressStatus: this.emergencyAddressStatus, bundleSid: this.bundleSid, status: this.status, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TollFreeInstance = TollFreeInstance; class TollFreePage extends Page_1.default { /** * Initialize the TollFreePage * * @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 TollFreeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TollFreeInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TollFreePage = TollFreePage; rest/api/v2010/account/incomingPhoneNumber/local.js000064400000026664151677225100016120 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.LocalPage = exports.LocalInstance = exports.LocalListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function LocalListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/IncomingPhoneNumbers/Local.json`; 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"]; if (params["apiVersion"] !== undefined) data["ApiVersion"] = params["apiVersion"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["smsApplicationSid"] !== undefined) data["SmsApplicationSid"] = params["smsApplicationSid"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["voiceApplicationSid"] !== undefined) data["VoiceApplicationSid"] = params["voiceApplicationSid"]; if (params["voiceCallerIdLookup"] !== undefined) data["VoiceCallerIdLookup"] = serialize.bool(params["voiceCallerIdLookup"]); if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["identitySid"] !== undefined) data["IdentitySid"] = params["identitySid"]; if (params["addressSid"] !== undefined) data["AddressSid"] = params["addressSid"]; if (params["emergencyStatus"] !== undefined) data["EmergencyStatus"] = params["emergencyStatus"]; if (params["emergencyAddressSid"] !== undefined) data["EmergencyAddressSid"] = params["emergencyAddressSid"]; if (params["trunkSid"] !== undefined) data["TrunkSid"] = params["trunkSid"]; if (params["voiceReceiveMode"] !== undefined) data["VoiceReceiveMode"] = params["voiceReceiveMode"]; if (params["bundleSid"] !== undefined) data["BundleSid"] = params["bundleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new LocalInstance(operationVersion, payload, instance._solution.accountSid)); 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["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["origin"] !== undefined) data["Origin"] = params["origin"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new LocalPage(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 LocalPage(instance._version, payload, 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; } exports.LocalListInstance = LocalListInstance; class LocalInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.addressSid = payload.address_sid; this.addressRequirements = payload.address_requirements; this.apiVersion = payload.api_version; this.beta = payload.beta; this.capabilities = payload.capabilities; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.identitySid = payload.identity_sid; this.phoneNumber = payload.phone_number; this.origin = payload.origin; this.sid = payload.sid; this.smsApplicationSid = payload.sms_application_sid; this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsUrl = payload.sms_url; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.trunkSid = payload.trunk_sid; this.uri = payload.uri; this.voiceReceiveMode = payload.voice_receive_mode; this.voiceApplicationSid = payload.voice_application_sid; this.voiceCallerIdLookup = payload.voice_caller_id_lookup; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceMethod = payload.voice_method; this.voiceUrl = payload.voice_url; this.emergencyStatus = payload.emergency_status; this.emergencyAddressSid = payload.emergency_address_sid; this.emergencyAddressStatus = payload.emergency_address_status; this.bundleSid = payload.bundle_sid; this.status = payload.status; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, addressSid: this.addressSid, addressRequirements: this.addressRequirements, apiVersion: this.apiVersion, beta: this.beta, capabilities: this.capabilities, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, identitySid: this.identitySid, phoneNumber: this.phoneNumber, origin: this.origin, sid: this.sid, smsApplicationSid: this.smsApplicationSid, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsUrl: this.smsUrl, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, trunkSid: this.trunkSid, uri: this.uri, voiceReceiveMode: this.voiceReceiveMode, voiceApplicationSid: this.voiceApplicationSid, voiceCallerIdLookup: this.voiceCallerIdLookup, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceMethod: this.voiceMethod, voiceUrl: this.voiceUrl, emergencyStatus: this.emergencyStatus, emergencyAddressSid: this.emergencyAddressSid, emergencyAddressStatus: this.emergencyAddressStatus, bundleSid: this.bundleSid, status: this.status, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LocalInstance = LocalInstance; class LocalPage extends Page_1.default { /** * Initialize the LocalPage * * @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 LocalInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new LocalInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LocalPage = LocalPage; rest/api/v2010/account/incomingPhoneNumber/local.d.ts000064400000045020151677225100016337 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; export type LocalAddressRequirement = "none" | "any" | "local" | "foreign"; export type LocalEmergencyAddressStatus = "registered" | "unregistered" | "pending-registration" | "registration-failure" | "pending-unregistration" | "unregistration-failure"; export type LocalEmergencyStatus = "Active" | "Inactive"; export type LocalVoiceReceiveMode = "voice" | "fax"; /** * Options to pass to create a LocalInstance */ export interface LocalListInstanceCreateOptions { /** The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. */ phoneNumber: string; /** The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. */ apiVersion?: string; /** A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. */ friendlyName?: string; /** The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. */ smsApplicationSid?: string; /** The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsFallbackMethod?: string; /** The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. */ smsFallbackUrl?: string; /** The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsMethod?: string; /** The URL we should call when the new phone number receives an incoming SMS message. */ smsUrl?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ statusCallbackMethod?: string; /** The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid?: string; /** Whether to lookup the caller\\\'s name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. */ voiceCallerIdLookup?: boolean; /** The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceFallbackMethod?: string; /** The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl?: string; /** The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceMethod?: string; /** The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl?: string; /** The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. */ identitySid?: string; /** The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. */ addressSid?: string; /** */ emergencyStatus?: LocalEmergencyStatus; /** The SID of the emergency address configuration to use for emergency calling from the new phone number. */ emergencyAddressSid?: string; /** The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid?: string; /** */ voiceReceiveMode?: LocalVoiceReceiveMode; /** The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. */ bundleSid?: string; } /** * Options to pass to each */ export interface LocalListInstanceEachOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: LocalInstance, 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 LocalListInstanceOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface LocalListInstancePageOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface LocalSolution { accountSid: string; } export interface LocalListInstance { _version: V2010; _solution: LocalSolution; _uri: string; /** * Create a LocalInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed LocalInstance */ create(params: LocalListInstanceCreateOptions, callback?: (error: Error | null, item?: LocalInstance) => any): Promise<LocalInstance>; /** * Streams LocalInstance 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 { LocalListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: LocalInstance, done: (err?: Error) => void) => void): void; each(params: LocalListInstanceEachOptions, callback?: (item: LocalInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of LocalInstance 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: LocalPage) => any): Promise<LocalPage>; /** * Lists LocalInstance 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 { LocalListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: LocalInstance[]) => any): Promise<LocalInstance[]>; list(params: LocalListInstanceOptions, callback?: (error: Error | null, items: LocalInstance[]) => any): Promise<LocalInstance[]>; /** * Retrieve a single page of LocalInstance 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 { LocalListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: LocalPage) => any): Promise<LocalPage>; page(params: LocalListInstancePageOptions, callback?: (error: Error | null, items: LocalPage) => any): Promise<LocalPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function LocalListInstance(version: V2010, accountSid: string): LocalListInstance; interface LocalPayload extends TwilioResponsePayload { incoming_phone_numbers: LocalResource[]; } interface LocalResource { account_sid: string; address_sid: string; address_requirements: LocalAddressRequirement; api_version: string; beta: boolean; capabilities: PhoneNumberCapabilities; date_created: Date; date_updated: Date; friendly_name: string; identity_sid: string; phone_number: string; origin: string; sid: string; sms_application_sid: string; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_url: string; status_callback: string; status_callback_method: string; trunk_sid: string; uri: string; voice_receive_mode: LocalVoiceReceiveMode; voice_application_sid: string; voice_caller_id_lookup: boolean; voice_fallback_method: string; voice_fallback_url: string; voice_method: string; voice_url: string; emergency_status: LocalEmergencyStatus; emergency_address_sid: string; emergency_address_status: LocalEmergencyAddressStatus; bundle_sid: string; status: string; } export declare class LocalInstance { protected _version: V2010; constructor(_version: V2010, payload: LocalResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. */ accountSid: string; /** * The SID of the Address resource associated with the phone number. */ addressSid: string; addressRequirements: LocalAddressRequirement; /** * The API version used to start a new TwiML session. */ apiVersion: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. */ identitySid: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The phone number\'s origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. */ origin: string; /** * The unique string that that we created to identify the resource. */ sid: string; /** * The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. */ smsApplicationSid: string; /** * The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod: string; /** * The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl: string; /** * The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. */ smsMethod: string; /** * The URL we call when the phone number receives an incoming SMS message. */ smsUrl: string; /** * The URL we call using the `status_callback_method` to send status information to your application. */ statusCallback: string; /** * The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. */ statusCallbackMethod: string; /** * The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; voiceReceiveMode: LocalVoiceReceiveMode; /** * The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid: string; /** * Whether we look up the caller\'s caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. */ voiceCallerIdLookup: boolean; /** * The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod: string; /** * The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl: string; /** * The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod: string; /** * The URL we call when this phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl: string; emergencyStatus: LocalEmergencyStatus; /** * The SID of the emergency address configuration that we use for emergency calling from this phone number. */ emergencyAddressSid: string; emergencyAddressStatus: LocalEmergencyAddressStatus; /** * The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. */ bundleSid: string; status: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; addressSid: string; addressRequirements: LocalAddressRequirement; apiVersion: string; beta: boolean; capabilities: PhoneNumberCapabilities; dateCreated: Date; dateUpdated: Date; friendlyName: string; identitySid: string; phoneNumber: string; origin: string; sid: string; smsApplicationSid: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; statusCallback: string; statusCallbackMethod: string; trunkSid: string; uri: string; voiceReceiveMode: LocalVoiceReceiveMode; voiceApplicationSid: string; voiceCallerIdLookup: boolean; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceUrl: string; emergencyStatus: LocalEmergencyStatus; emergencyAddressSid: string; emergencyAddressStatus: LocalEmergencyAddressStatus; bundleSid: string; status: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class LocalPage extends Page<V2010, LocalPayload, LocalResource, LocalInstance> { /** * Initialize the LocalPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: LocalSolution); /** * Build an instance of LocalInstance * * @param payload - Payload response from the API */ getInstance(payload: LocalResource): LocalInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/incomingPhoneNumber/mobile.d.ts000064400000045120151677225100016515 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; export type MobileAddressRequirement = "none" | "any" | "local" | "foreign"; export type MobileEmergencyAddressStatus = "registered" | "unregistered" | "pending-registration" | "registration-failure" | "pending-unregistration" | "unregistration-failure"; export type MobileEmergencyStatus = "Active" | "Inactive"; export type MobileVoiceReceiveMode = "voice" | "fax"; /** * Options to pass to create a MobileInstance */ export interface MobileListInstanceCreateOptions { /** The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. */ phoneNumber: string; /** The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. */ apiVersion?: string; /** A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, the is a formatted version of the phone number. */ friendlyName?: string; /** The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those of the application. */ smsApplicationSid?: string; /** The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsFallbackMethod?: string; /** The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. */ smsFallbackUrl?: string; /** The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsMethod?: string; /** The URL we should call when the new phone number receives an incoming SMS message. */ smsUrl?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ statusCallbackMethod?: string; /** The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid?: string; /** Whether to lookup the caller\\\'s name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. */ voiceCallerIdLookup?: boolean; /** The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceFallbackMethod?: string; /** The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl?: string; /** The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceMethod?: string; /** The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl?: string; /** The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. */ identitySid?: string; /** The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. */ addressSid?: string; /** */ emergencyStatus?: MobileEmergencyStatus; /** The SID of the emergency address configuration to use for emergency calling from the new phone number. */ emergencyAddressSid?: string; /** The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid?: string; /** */ voiceReceiveMode?: MobileVoiceReceiveMode; /** The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. */ bundleSid?: string; } /** * Options to pass to each */ export interface MobileListInstanceEachOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: MobileInstance, 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 MobileListInstanceOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface MobileListInstancePageOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface MobileSolution { accountSid: string; } export interface MobileListInstance { _version: V2010; _solution: MobileSolution; _uri: string; /** * Create a MobileInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MobileInstance */ create(params: MobileListInstanceCreateOptions, callback?: (error: Error | null, item?: MobileInstance) => any): Promise<MobileInstance>; /** * Streams MobileInstance 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 { MobileListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MobileInstance, done: (err?: Error) => void) => void): void; each(params: MobileListInstanceEachOptions, callback?: (item: MobileInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MobileInstance 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: MobilePage) => any): Promise<MobilePage>; /** * Lists MobileInstance 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 { MobileListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MobileInstance[]) => any): Promise<MobileInstance[]>; list(params: MobileListInstanceOptions, callback?: (error: Error | null, items: MobileInstance[]) => any): Promise<MobileInstance[]>; /** * Retrieve a single page of MobileInstance 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 { MobileListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MobilePage) => any): Promise<MobilePage>; page(params: MobileListInstancePageOptions, callback?: (error: Error | null, items: MobilePage) => any): Promise<MobilePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MobileListInstance(version: V2010, accountSid: string): MobileListInstance; interface MobilePayload extends TwilioResponsePayload { incoming_phone_numbers: MobileResource[]; } interface MobileResource { account_sid: string; address_sid: string; address_requirements: MobileAddressRequirement; api_version: string; beta: boolean; capabilities: PhoneNumberCapabilities; date_created: Date; date_updated: Date; friendly_name: string; identity_sid: string; phone_number: string; origin: string; sid: string; sms_application_sid: string; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_url: string; status_callback: string; status_callback_method: string; trunk_sid: string; uri: string; voice_receive_mode: MobileVoiceReceiveMode; voice_application_sid: string; voice_caller_id_lookup: boolean; voice_fallback_method: string; voice_fallback_url: string; voice_method: string; voice_url: string; emergency_status: MobileEmergencyStatus; emergency_address_sid: string; emergency_address_status: MobileEmergencyAddressStatus; bundle_sid: string; status: string; } export declare class MobileInstance { protected _version: V2010; constructor(_version: V2010, payload: MobileResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. */ accountSid: string; /** * The SID of the Address resource associated with the phone number. */ addressSid: string; addressRequirements: MobileAddressRequirement; /** * The API version used to start a new TwiML session. */ apiVersion: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. */ identitySid: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The phone number\'s origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. */ origin: string; /** * The unique string that that we created to identify the resource. */ sid: string; /** * The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. */ smsApplicationSid: string; /** * The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod: string; /** * The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl: string; /** * The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. */ smsMethod: string; /** * The URL we call when the phone number receives an incoming SMS message. */ smsUrl: string; /** * The URL we call using the `status_callback_method` to send status information to your application. */ statusCallback: string; /** * The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. */ statusCallbackMethod: string; /** * The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; voiceReceiveMode: MobileVoiceReceiveMode; /** * The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid: string; /** * Whether we look up the caller\'s caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. */ voiceCallerIdLookup: boolean; /** * The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod: string; /** * The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl: string; /** * The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod: string; /** * The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl: string; emergencyStatus: MobileEmergencyStatus; /** * The SID of the emergency address configuration that we use for emergency calling from this phone number. */ emergencyAddressSid: string; emergencyAddressStatus: MobileEmergencyAddressStatus; /** * The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. */ bundleSid: string; status: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; addressSid: string; addressRequirements: MobileAddressRequirement; apiVersion: string; beta: boolean; capabilities: PhoneNumberCapabilities; dateCreated: Date; dateUpdated: Date; friendlyName: string; identitySid: string; phoneNumber: string; origin: string; sid: string; smsApplicationSid: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; statusCallback: string; statusCallbackMethod: string; trunkSid: string; uri: string; voiceReceiveMode: MobileVoiceReceiveMode; voiceApplicationSid: string; voiceCallerIdLookup: boolean; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceUrl: string; emergencyStatus: MobileEmergencyStatus; emergencyAddressSid: string; emergencyAddressStatus: MobileEmergencyAddressStatus; bundleSid: string; status: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class MobilePage extends Page<V2010, MobilePayload, MobileResource, MobileInstance> { /** * Initialize the MobilePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: MobileSolution); /** * Build an instance of MobileInstance * * @param payload - Payload response from the API */ getInstance(payload: MobileResource): MobileInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/incomingPhoneNumber/assignedAddOn.js000064400000024114151677225100017515 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AssignedAddOnPage = exports.AssignedAddOnListInstance = exports.AssignedAddOnInstance = exports.AssignedAddOnContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const assignedAddOnExtension_1 = require("./assignedAddOn/assignedAddOnExtension"); class AssignedAddOnContextImpl { constructor(_version, accountSid, resourceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(resourceSid)) { throw new Error("Parameter 'resourceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, resourceSid, sid }; this._uri = `/Accounts/${accountSid}/IncomingPhoneNumbers/${resourceSid}/AssignedAddOns/${sid}.json`; } get extensions() { this._extensions = this._extensions || (0, assignedAddOnExtension_1.AssignedAddOnExtensionListInstance)(this._version, this._solution.accountSid, this._solution.resourceSid, this._solution.sid); return this._extensions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AssignedAddOnInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.resourceSid, 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.AssignedAddOnContextImpl = AssignedAddOnContextImpl; class AssignedAddOnInstance { constructor(_version, payload, accountSid, resourceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.resourceSid = payload.resource_sid; this.friendlyName = payload.friendly_name; this.description = payload.description; this.configuration = payload.configuration; this.uniqueName = payload.unique_name; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.uri = payload.uri; this.subresourceUris = payload.subresource_uris; this._solution = { accountSid, resourceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AssignedAddOnContextImpl(this._version, this._solution.accountSid, this._solution.resourceSid, this._solution.sid); return this._context; } /** * Remove a AssignedAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AssignedAddOnInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssignedAddOnInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the extensions. */ extensions() { return this._proxy.extensions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, resourceSid: this.resourceSid, friendlyName: this.friendlyName, description: this.description, configuration: this.configuration, uniqueName: this.uniqueName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, uri: this.uri, subresourceUris: this.subresourceUris, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssignedAddOnInstance = AssignedAddOnInstance; function AssignedAddOnListInstance(version, accountSid, resourceSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(resourceSid)) { throw new Error("Parameter 'resourceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AssignedAddOnContextImpl(version, accountSid, resourceSid, sid); }; instance._version = version; instance._solution = { accountSid, resourceSid }; instance._uri = `/Accounts/${accountSid}/IncomingPhoneNumbers/${resourceSid}/AssignedAddOns.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["installedAddOnSid"] === null || params["installedAddOnSid"] === undefined) { throw new Error("Required parameter \"params['installedAddOnSid']\" missing."); } let data = {}; data["InstalledAddOnSid"] = params["installedAddOnSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AssignedAddOnInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.resourceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AssignedAddOnPage(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 AssignedAddOnPage(instance._version, payload, 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; } exports.AssignedAddOnListInstance = AssignedAddOnListInstance; class AssignedAddOnPage extends Page_1.default { /** * Initialize the AssignedAddOnPage * * @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 AssignedAddOnInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AssignedAddOnInstance(this._version, payload, this._solution.accountSid, this._solution.resourceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssignedAddOnPage = AssignedAddOnPage; rest/api/v2010/account/usage/trigger.js000064400000027444151677225100013624 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.TriggerPage = exports.TriggerListInstance = exports.TriggerInstance = exports.TriggerContextImpl = void 0; 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 TriggerContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Usage/Triggers/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TriggerInstance(operationVersion, payload, instance._solution.accountSid, 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["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TriggerInstance(operationVersion, payload, instance._solution.accountSid, 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.TriggerContextImpl = TriggerContextImpl; class TriggerInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.callbackMethod = payload.callback_method; this.callbackUrl = payload.callback_url; this.currentValue = payload.current_value; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateFired = deserialize.rfc2822DateTime(payload.date_fired); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.recurring = payload.recurring; this.sid = payload.sid; this.triggerBy = payload.trigger_by; this.triggerValue = payload.trigger_value; this.uri = payload.uri; this.usageCategory = payload.usage_category; this.usageRecordUri = payload.usage_record_uri; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TriggerContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a TriggerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TriggerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TriggerInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, callbackMethod: this.callbackMethod, callbackUrl: this.callbackUrl, currentValue: this.currentValue, dateCreated: this.dateCreated, dateFired: this.dateFired, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, recurring: this.recurring, sid: this.sid, triggerBy: this.triggerBy, triggerValue: this.triggerValue, uri: this.uri, usageCategory: this.usageCategory, usageRecordUri: this.usageRecordUri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TriggerInstance = TriggerInstance; function TriggerListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TriggerContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Triggers.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["callbackUrl"] === null || params["callbackUrl"] === undefined) { throw new Error("Required parameter \"params['callbackUrl']\" missing."); } if (params["triggerValue"] === null || params["triggerValue"] === undefined) { throw new Error("Required parameter \"params['triggerValue']\" missing."); } if (params["usageCategory"] === null || params["usageCategory"] === undefined) { throw new Error("Required parameter \"params['usageCategory']\" missing."); } let data = {}; data["CallbackUrl"] = params["callbackUrl"]; data["TriggerValue"] = params["triggerValue"]; data["UsageCategory"] = params["usageCategory"]; if (params["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["recurring"] !== undefined) data["Recurring"] = params["recurring"]; if (params["triggerBy"] !== undefined) data["TriggerBy"] = params["triggerBy"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TriggerInstance(operationVersion, payload, instance._solution.accountSid)); 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["recurring"] !== undefined) data["Recurring"] = params["recurring"]; if (params["triggerBy"] !== undefined) data["TriggerBy"] = params["triggerBy"]; if (params["usageCategory"] !== undefined) data["UsageCategory"] = params["usageCategory"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TriggerPage(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 TriggerPage(instance._version, payload, 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; } exports.TriggerListInstance = TriggerListInstance; class TriggerPage extends Page_1.default { /** * Initialize the TriggerPage * * @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 TriggerInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TriggerInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TriggerPage = TriggerPage; rest/api/v2010/account/usage/trigger.d.ts000064400000055463151677225100014062 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; export type TriggerRecurring = "daily" | "monthly" | "yearly" | "alltime"; export type TriggerTriggerField = "count" | "usage" | "price"; export type TriggerUsageCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to update a TriggerInstance */ export interface TriggerContextUpdateOptions { /** The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`. */ callbackMethod?: string; /** The URL we should call using `callback_method` when the trigger fires. */ callbackUrl?: string; /** 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 TriggerInstance */ export interface TriggerListInstanceCreateOptions { /** The URL we should call using `callback_method` when the trigger fires. */ callbackUrl: string; /** The usage value at which the trigger should fire. For convenience, you can use an offset value such as `+30` to specify a trigger_value that is 30 units more than the current usage value. Be sure to urlencode a `+` as `%2B`. */ triggerValue: string; /** */ usageCategory: TriggerUsageCategory; /** The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`. */ callbackMethod?: string; /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** */ recurring?: TriggerRecurring; /** */ triggerBy?: TriggerTriggerField; } /** * Options to pass to each */ export interface TriggerListInstanceEachOptions { /** The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers. */ recurring?: TriggerRecurring; /** The trigger field of the UsageTriggers to read. Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price). */ triggerBy?: TriggerTriggerField; /** The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories). */ usageCategory?: TriggerUsageCategory; /** 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: TriggerInstance, 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 TriggerListInstanceOptions { /** The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers. */ recurring?: TriggerRecurring; /** The trigger field of the UsageTriggers to read. Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price). */ triggerBy?: TriggerTriggerField; /** The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories). */ usageCategory?: TriggerUsageCategory; /** 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 TriggerListInstancePageOptions { /** The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers. */ recurring?: TriggerRecurring; /** The trigger field of the UsageTriggers to read. Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price). */ triggerBy?: TriggerTriggerField; /** The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories). */ usageCategory?: TriggerUsageCategory; /** 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 TriggerContext { /** * Remove a TriggerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TriggerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TriggerInstance */ fetch(callback?: (error: Error | null, item?: TriggerInstance) => any): Promise<TriggerInstance>; /** * Update a TriggerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TriggerInstance */ update(callback?: (error: Error | null, item?: TriggerInstance) => any): Promise<TriggerInstance>; /** * Update a TriggerInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TriggerInstance */ update(params: TriggerContextUpdateOptions, callback?: (error: Error | null, item?: TriggerInstance) => any): Promise<TriggerInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TriggerContextSolution { accountSid: string; sid: string; } export declare class TriggerContextImpl implements TriggerContext { protected _version: V2010; protected _solution: TriggerContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TriggerInstance) => any): Promise<TriggerInstance>; update(params?: TriggerContextUpdateOptions | ((error: Error | null, item?: TriggerInstance) => any), callback?: (error: Error | null, item?: TriggerInstance) => any): Promise<TriggerInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TriggerContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TriggerPayload extends TwilioResponsePayload { usage_triggers: TriggerResource[]; } interface TriggerResource { account_sid: string; api_version: string; callback_method: string; callback_url: string; current_value: string; date_created: Date; date_fired: Date; date_updated: Date; friendly_name: string; recurring: TriggerRecurring; sid: string; trigger_by: TriggerTriggerField; trigger_value: string; uri: string; usage_category: TriggerUsageCategory; usage_record_uri: string; } export declare class TriggerInstance { protected _version: V2010; protected _solution: TriggerContextSolution; protected _context?: TriggerContext; constructor(_version: V2010, payload: TriggerResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the trigger monitors. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * The HTTP method we use to call `callback_url`. Can be: `GET` or `POST`. */ callbackMethod: string; /** * The URL we call using the `callback_method` when the trigger fires. */ callbackUrl: string; /** * The current value of the field the trigger is watching. */ currentValue: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the trigger was last fired specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateFired: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the trigger. */ friendlyName: string; recurring: TriggerRecurring; /** * The unique string that that we created to identify the UsageTrigger resource. */ sid: string; triggerBy: TriggerTriggerField; /** * The value at which the trigger will fire. Must be a positive, numeric value. */ triggerValue: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; usageCategory: TriggerUsageCategory; /** * The URI of the [UsageRecord](https://www.twilio.com/docs/usage/api/usage-record) resource this trigger watches, relative to `https://api.twilio.com`. */ usageRecordUri: string; private get _proxy(); /** * Remove a TriggerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TriggerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TriggerInstance */ fetch(callback?: (error: Error | null, item?: TriggerInstance) => any): Promise<TriggerInstance>; /** * Update a TriggerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TriggerInstance */ update(callback?: (error: Error | null, item?: TriggerInstance) => any): Promise<TriggerInstance>; /** * Update a TriggerInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TriggerInstance */ update(params: TriggerContextUpdateOptions, callback?: (error: Error | null, item?: TriggerInstance) => any): Promise<TriggerInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; callbackMethod: string; callbackUrl: string; currentValue: string; dateCreated: Date; dateFired: Date; dateUpdated: Date; friendlyName: string; recurring: TriggerRecurring; sid: string; triggerBy: TriggerTriggerField; triggerValue: string; uri: string; usageCategory: TriggerUsageCategory; usageRecordUri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TriggerSolution { accountSid: string; } export interface TriggerListInstance { _version: V2010; _solution: TriggerSolution; _uri: string; (sid: string): TriggerContext; get(sid: string): TriggerContext; /** * Create a TriggerInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TriggerInstance */ create(params: TriggerListInstanceCreateOptions, callback?: (error: Error | null, item?: TriggerInstance) => any): Promise<TriggerInstance>; /** * Streams TriggerInstance 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 { TriggerListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TriggerInstance, done: (err?: Error) => void) => void): void; each(params: TriggerListInstanceEachOptions, callback?: (item: TriggerInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TriggerInstance 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: TriggerPage) => any): Promise<TriggerPage>; /** * Lists TriggerInstance 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 { TriggerListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TriggerInstance[]) => any): Promise<TriggerInstance[]>; list(params: TriggerListInstanceOptions, callback?: (error: Error | null, items: TriggerInstance[]) => any): Promise<TriggerInstance[]>; /** * Retrieve a single page of TriggerInstance 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 { TriggerListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TriggerPage) => any): Promise<TriggerPage>; page(params: TriggerListInstancePageOptions, callback?: (error: Error | null, items: TriggerPage) => any): Promise<TriggerPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TriggerListInstance(version: V2010, accountSid: string): TriggerListInstance; export declare class TriggerPage extends Page<V2010, TriggerPayload, TriggerResource, TriggerInstance> { /** * Initialize the TriggerPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: TriggerSolution); /** * Build an instance of TriggerInstance * * @param payload - Payload response from the API */ getInstance(payload: TriggerResource): TriggerInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record.d.ts000064400000046627151677225100013677 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { AllTimeListInstance } from "./record/allTime"; import { DailyListInstance } from "./record/daily"; import { LastMonthListInstance } from "./record/lastMonth"; import { MonthlyListInstance } from "./record/monthly"; import { ThisMonthListInstance } from "./record/thisMonth"; import { TodayListInstance } from "./record/today"; import { YearlyListInstance } from "./record/yearly"; import { YesterdayListInstance } from "./record/yesterday"; export type RecordCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to each */ export interface RecordListInstanceEachOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: RecordCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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: RecordInstance, 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 RecordListInstanceOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: RecordCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 RecordListInstancePageOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: RecordCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 RecordSolution { accountSid: string; } export interface RecordListInstance { _version: V2010; _solution: RecordSolution; _uri: string; _allTime?: AllTimeListInstance; allTime: AllTimeListInstance; _daily?: DailyListInstance; daily: DailyListInstance; _lastMonth?: LastMonthListInstance; lastMonth: LastMonthListInstance; _monthly?: MonthlyListInstance; monthly: MonthlyListInstance; _thisMonth?: ThisMonthListInstance; thisMonth: ThisMonthListInstance; _today?: TodayListInstance; today: TodayListInstance; _yearly?: YearlyListInstance; yearly: YearlyListInstance; _yesterday?: YesterdayListInstance; yesterday: YesterdayListInstance; /** * Streams RecordInstance 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 { RecordListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RecordInstance, done: (err?: Error) => void) => void): void; each(params: RecordListInstanceEachOptions, callback?: (item: RecordInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RecordInstance 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: RecordPage) => any): Promise<RecordPage>; /** * Lists RecordInstance 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 { RecordListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RecordInstance[]) => any): Promise<RecordInstance[]>; list(params: RecordListInstanceOptions, callback?: (error: Error | null, items: RecordInstance[]) => any): Promise<RecordInstance[]>; /** * Retrieve a single page of RecordInstance 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 { RecordListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RecordPage) => any): Promise<RecordPage>; page(params: RecordListInstancePageOptions, callback?: (error: Error | null, items: RecordPage) => any): Promise<RecordPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RecordListInstance(version: V2010, accountSid: string): RecordListInstance; interface RecordPayload extends TwilioResponsePayload { usage_records: RecordResource[]; } interface RecordResource { account_sid: string; api_version: string; as_of: string; category: RecordCategory; count: string; count_unit: string; description: string; end_date: Date; price: number; price_unit: string; start_date: Date; subresource_uris: Record<string, string>; uri: string; usage: string; usage_unit: string; } export declare class RecordInstance { protected _version: V2010; constructor(_version: V2010, payload: RecordResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT */ asOf: string; category: RecordCategory; /** * The number of usage events, such as the number of calls. */ count: string; /** * The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. */ countUnit: string; /** * A plain-language description of the usage category. */ description: string; /** * The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ endDate: Date; /** * The total price of the usage in the currency specified in `price_unit` and associated with the account. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. */ priceUnit: string; /** * The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ startDate: Date; /** * A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). */ subresourceUris: Record<string, string>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The amount used to bill usage and measured in units described in `usage_unit`. */ usage: string; /** * The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. */ usageUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; asOf: string; category: RecordCategory; count: string; countUnit: string; description: string; endDate: Date; price: number; priceUnit: string; startDate: Date; subresourceUris: Record<string, string>; uri: string; usage: string; usageUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class RecordPage extends Page<V2010, RecordPayload, RecordResource, RecordInstance> { /** * Initialize the RecordPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: RecordSolution); /** * Build an instance of RecordInstance * * @param payload - Payload response from the API */ getInstance(payload: RecordResource): RecordInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record.js000064400000021466151677225100013435 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.RecordPage = exports.RecordInstance = exports.RecordListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const allTime_1 = require("./record/allTime"); const daily_1 = require("./record/daily"); const lastMonth_1 = require("./record/lastMonth"); const monthly_1 = require("./record/monthly"); const thisMonth_1 = require("./record/thisMonth"); const today_1 = require("./record/today"); const yearly_1 = require("./record/yearly"); const yesterday_1 = require("./record/yesterday"); function RecordListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Records.json`; Object.defineProperty(instance, "allTime", { get: function allTime() { if (!instance._allTime) { instance._allTime = (0, allTime_1.AllTimeListInstance)(instance._version, instance._solution.accountSid); } return instance._allTime; }, }); Object.defineProperty(instance, "daily", { get: function daily() { if (!instance._daily) { instance._daily = (0, daily_1.DailyListInstance)(instance._version, instance._solution.accountSid); } return instance._daily; }, }); Object.defineProperty(instance, "lastMonth", { get: function lastMonth() { if (!instance._lastMonth) { instance._lastMonth = (0, lastMonth_1.LastMonthListInstance)(instance._version, instance._solution.accountSid); } return instance._lastMonth; }, }); Object.defineProperty(instance, "monthly", { get: function monthly() { if (!instance._monthly) { instance._monthly = (0, monthly_1.MonthlyListInstance)(instance._version, instance._solution.accountSid); } return instance._monthly; }, }); Object.defineProperty(instance, "thisMonth", { get: function thisMonth() { if (!instance._thisMonth) { instance._thisMonth = (0, thisMonth_1.ThisMonthListInstance)(instance._version, instance._solution.accountSid); } return instance._thisMonth; }, }); Object.defineProperty(instance, "today", { get: function today() { if (!instance._today) { instance._today = (0, today_1.TodayListInstance)(instance._version, instance._solution.accountSid); } return instance._today; }, }); Object.defineProperty(instance, "yearly", { get: function yearly() { if (!instance._yearly) { instance._yearly = (0, yearly_1.YearlyListInstance)(instance._version, instance._solution.accountSid); } return instance._yearly; }, }); Object.defineProperty(instance, "yesterday", { get: function yesterday() { if (!instance._yesterday) { instance._yesterday = (0, yesterday_1.YesterdayListInstance)(instance._version, instance._solution.accountSid); } return instance._yesterday; }, }); instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["category"] !== undefined) data["Category"] = params["category"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["includeSubaccounts"] !== undefined) data["IncludeSubaccounts"] = serialize.bool(params["includeSubaccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RecordPage(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 RecordPage(instance._version, payload, 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; } exports.RecordListInstance = RecordListInstance; class RecordInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.asOf = payload.as_of; this.category = payload.category; this.count = payload.count; this.countUnit = payload.count_unit; this.description = payload.description; this.endDate = deserialize.iso8601Date(payload.end_date); this.price = payload.price; this.priceUnit = payload.price_unit; this.startDate = deserialize.iso8601Date(payload.start_date); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this.usage = payload.usage; this.usageUnit = payload.usage_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, asOf: this.asOf, category: this.category, count: this.count, countUnit: this.countUnit, description: this.description, endDate: this.endDate, price: this.price, priceUnit: this.priceUnit, startDate: this.startDate, subresourceUris: this.subresourceUris, uri: this.uri, usage: this.usage, usageUnit: this.usageUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordInstance = RecordInstance; class RecordPage extends Page_1.default { /** * Initialize the RecordPage * * @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 RecordInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RecordInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordPage = RecordPage; rest/api/v2010/account/usage/record/monthly.js000064400000014012151677225100015114 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.MonthlyPage = exports.MonthlyInstance = exports.MonthlyListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../../base/Page")); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); function MonthlyListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Records/Monthly.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["category"] !== undefined) data["Category"] = params["category"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["includeSubaccounts"] !== undefined) data["IncludeSubaccounts"] = serialize.bool(params["includeSubaccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MonthlyPage(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 MonthlyPage(instance._version, payload, 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; } exports.MonthlyListInstance = MonthlyListInstance; class MonthlyInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.asOf = payload.as_of; this.category = payload.category; this.count = payload.count; this.countUnit = payload.count_unit; this.description = payload.description; this.endDate = deserialize.iso8601Date(payload.end_date); this.price = payload.price; this.priceUnit = payload.price_unit; this.startDate = deserialize.iso8601Date(payload.start_date); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this.usage = payload.usage; this.usageUnit = payload.usage_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, asOf: this.asOf, category: this.category, count: this.count, countUnit: this.countUnit, description: this.description, endDate: this.endDate, price: this.price, priceUnit: this.priceUnit, startDate: this.startDate, subresourceUris: this.subresourceUris, uri: this.uri, usage: this.usage, usageUnit: this.usageUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MonthlyInstance = MonthlyInstance; class MonthlyPage extends Page_1.default { /** * Initialize the MonthlyPage * * @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 MonthlyInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MonthlyInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MonthlyPage = MonthlyPage; rest/api/v2010/account/usage/record/today.js000064400000013746151677225100014557 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.TodayPage = exports.TodayInstance = exports.TodayListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../../base/Page")); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); function TodayListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Records/Today.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["category"] !== undefined) data["Category"] = params["category"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["includeSubaccounts"] !== undefined) data["IncludeSubaccounts"] = serialize.bool(params["includeSubaccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TodayPage(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 TodayPage(instance._version, payload, 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; } exports.TodayListInstance = TodayListInstance; class TodayInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.asOf = payload.as_of; this.category = payload.category; this.count = payload.count; this.countUnit = payload.count_unit; this.description = payload.description; this.endDate = deserialize.iso8601Date(payload.end_date); this.price = payload.price; this.priceUnit = payload.price_unit; this.startDate = deserialize.iso8601Date(payload.start_date); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this.usage = payload.usage; this.usageUnit = payload.usage_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, asOf: this.asOf, category: this.category, count: this.count, countUnit: this.countUnit, description: this.description, endDate: this.endDate, price: this.price, priceUnit: this.priceUnit, startDate: this.startDate, subresourceUris: this.subresourceUris, uri: this.uri, usage: this.usage, usageUnit: this.usageUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TodayInstance = TodayInstance; class TodayPage extends Page_1.default { /** * Initialize the TodayPage * * @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 TodayInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TodayInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TodayPage = TodayPage; rest/api/v2010/account/usage/record/monthly.d.ts000064400000044736151677225100015370 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; export type MonthlyCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to each */ export interface MonthlyListInstanceEachOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: MonthlyCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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: MonthlyInstance, 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 MonthlyListInstanceOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: MonthlyCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 MonthlyListInstancePageOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: MonthlyCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 MonthlySolution { accountSid: string; } export interface MonthlyListInstance { _version: V2010; _solution: MonthlySolution; _uri: string; /** * Streams MonthlyInstance 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 { MonthlyListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MonthlyInstance, done: (err?: Error) => void) => void): void; each(params: MonthlyListInstanceEachOptions, callback?: (item: MonthlyInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MonthlyInstance 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: MonthlyPage) => any): Promise<MonthlyPage>; /** * Lists MonthlyInstance 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 { MonthlyListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MonthlyInstance[]) => any): Promise<MonthlyInstance[]>; list(params: MonthlyListInstanceOptions, callback?: (error: Error | null, items: MonthlyInstance[]) => any): Promise<MonthlyInstance[]>; /** * Retrieve a single page of MonthlyInstance 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 { MonthlyListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MonthlyPage) => any): Promise<MonthlyPage>; page(params: MonthlyListInstancePageOptions, callback?: (error: Error | null, items: MonthlyPage) => any): Promise<MonthlyPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MonthlyListInstance(version: V2010, accountSid: string): MonthlyListInstance; interface MonthlyPayload extends TwilioResponsePayload { usage_records: MonthlyResource[]; } interface MonthlyResource { account_sid: string; api_version: string; as_of: string; category: MonthlyCategory; count: string; count_unit: string; description: string; end_date: Date; price: number; price_unit: string; start_date: Date; subresource_uris: Record<string, string>; uri: string; usage: string; usage_unit: string; } export declare class MonthlyInstance { protected _version: V2010; constructor(_version: V2010, payload: MonthlyResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT */ asOf: string; category: MonthlyCategory; /** * The number of usage events, such as the number of calls. */ count: string; /** * The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. */ countUnit: string; /** * A plain-language description of the usage category. */ description: string; /** * The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ endDate: Date; /** * The total price of the usage in the currency specified in `price_unit` and associated with the account. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. */ priceUnit: string; /** * The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ startDate: Date; /** * A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). */ subresourceUris: Record<string, string>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The amount used to bill usage and measured in units described in `usage_unit`. */ usage: string; /** * The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. */ usageUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; asOf: string; category: MonthlyCategory; count: string; countUnit: string; description: string; endDate: Date; price: number; priceUnit: string; startDate: Date; subresourceUris: Record<string, string>; uri: string; usage: string; usageUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class MonthlyPage extends Page<V2010, MonthlyPayload, MonthlyResource, MonthlyInstance> { /** * Initialize the MonthlyPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: MonthlySolution); /** * Build an instance of MonthlyInstance * * @param payload - Payload response from the API */ getInstance(payload: MonthlyResource): MonthlyInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record/yesterday.d.ts000064400000045106151677225100015677 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; export type YesterdayCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to each */ export interface YesterdayListInstanceEachOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: YesterdayCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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: YesterdayInstance, 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 YesterdayListInstanceOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: YesterdayCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 YesterdayListInstancePageOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: YesterdayCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 YesterdaySolution { accountSid: string; } export interface YesterdayListInstance { _version: V2010; _solution: YesterdaySolution; _uri: string; /** * Streams YesterdayInstance 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 { YesterdayListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: YesterdayInstance, done: (err?: Error) => void) => void): void; each(params: YesterdayListInstanceEachOptions, callback?: (item: YesterdayInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of YesterdayInstance 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: YesterdayPage) => any): Promise<YesterdayPage>; /** * Lists YesterdayInstance 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 { YesterdayListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: YesterdayInstance[]) => any): Promise<YesterdayInstance[]>; list(params: YesterdayListInstanceOptions, callback?: (error: Error | null, items: YesterdayInstance[]) => any): Promise<YesterdayInstance[]>; /** * Retrieve a single page of YesterdayInstance 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 { YesterdayListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: YesterdayPage) => any): Promise<YesterdayPage>; page(params: YesterdayListInstancePageOptions, callback?: (error: Error | null, items: YesterdayPage) => any): Promise<YesterdayPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function YesterdayListInstance(version: V2010, accountSid: string): YesterdayListInstance; interface YesterdayPayload extends TwilioResponsePayload { usage_records: YesterdayResource[]; } interface YesterdayResource { account_sid: string; api_version: string; as_of: string; category: YesterdayCategory; count: string; count_unit: string; description: string; end_date: Date; price: number; price_unit: string; start_date: Date; subresource_uris: Record<string, string>; uri: string; usage: string; usage_unit: string; } export declare class YesterdayInstance { protected _version: V2010; constructor(_version: V2010, payload: YesterdayResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT */ asOf: string; category: YesterdayCategory; /** * The number of usage events, such as the number of calls. */ count: string; /** * The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. */ countUnit: string; /** * A plain-language description of the usage category. */ description: string; /** * The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ endDate: Date; /** * The total price of the usage in the currency specified in `price_unit` and associated with the account. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. */ priceUnit: string; /** * The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ startDate: Date; /** * A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). */ subresourceUris: Record<string, string>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The amount used to bill usage and measured in units described in `usage_unit`. */ usage: string; /** * The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. */ usageUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; asOf: string; category: YesterdayCategory; count: string; countUnit: string; description: string; endDate: Date; price: number; priceUnit: string; startDate: Date; subresourceUris: Record<string, string>; uri: string; usage: string; usageUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class YesterdayPage extends Page<V2010, YesterdayPayload, YesterdayResource, YesterdayInstance> { /** * Initialize the YesterdayPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: YesterdaySolution); /** * Build an instance of YesterdayInstance * * @param payload - Payload response from the API */ getInstance(payload: YesterdayResource): YesterdayInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record/daily.d.ts000064400000044566151677225100015001 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; export type DailyCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to each */ export interface DailyListInstanceEachOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: DailyCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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: DailyInstance, 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 DailyListInstanceOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: DailyCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 DailyListInstancePageOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: DailyCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 DailySolution { accountSid: string; } export interface DailyListInstance { _version: V2010; _solution: DailySolution; _uri: string; /** * Streams DailyInstance 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 { DailyListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DailyInstance, done: (err?: Error) => void) => void): void; each(params: DailyListInstanceEachOptions, callback?: (item: DailyInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DailyInstance 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: DailyPage) => any): Promise<DailyPage>; /** * Lists DailyInstance 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 { DailyListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DailyInstance[]) => any): Promise<DailyInstance[]>; list(params: DailyListInstanceOptions, callback?: (error: Error | null, items: DailyInstance[]) => any): Promise<DailyInstance[]>; /** * Retrieve a single page of DailyInstance 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 { DailyListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DailyPage) => any): Promise<DailyPage>; page(params: DailyListInstancePageOptions, callback?: (error: Error | null, items: DailyPage) => any): Promise<DailyPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DailyListInstance(version: V2010, accountSid: string): DailyListInstance; interface DailyPayload extends TwilioResponsePayload { usage_records: DailyResource[]; } interface DailyResource { account_sid: string; api_version: string; as_of: string; category: DailyCategory; count: string; count_unit: string; description: string; end_date: Date; price: number; price_unit: string; start_date: Date; subresource_uris: Record<string, string>; uri: string; usage: string; usage_unit: string; } export declare class DailyInstance { protected _version: V2010; constructor(_version: V2010, payload: DailyResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT */ asOf: string; category: DailyCategory; /** * The number of usage events, such as the number of calls. */ count: string; /** * The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. */ countUnit: string; /** * A plain-language description of the usage category. */ description: string; /** * The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ endDate: Date; /** * The total price of the usage in the currency specified in `price_unit` and associated with the account. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. */ priceUnit: string; /** * The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ startDate: Date; /** * A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). */ subresourceUris: Record<string, string>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The amount used to bill usage and measured in units described in `usage_unit`. */ usage: string; /** * The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. */ usageUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; asOf: string; category: DailyCategory; count: string; countUnit: string; description: string; endDate: Date; price: number; priceUnit: string; startDate: Date; subresourceUris: Record<string, string>; uri: string; usage: string; usageUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class DailyPage extends Page<V2010, DailyPayload, DailyResource, DailyInstance> { /** * Initialize the DailyPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: DailySolution); /** * Build an instance of DailyInstance * * @param payload - Payload response from the API */ getInstance(payload: DailyResource): DailyInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record/allTime.d.ts000064400000044736151677225100015265 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; export type AllTimeCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to each */ export interface AllTimeListInstanceEachOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: AllTimeCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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: AllTimeInstance, 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 AllTimeListInstanceOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: AllTimeCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 AllTimeListInstancePageOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: AllTimeCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 AllTimeSolution { accountSid: string; } export interface AllTimeListInstance { _version: V2010; _solution: AllTimeSolution; _uri: string; /** * Streams AllTimeInstance 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 { AllTimeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AllTimeInstance, done: (err?: Error) => void) => void): void; each(params: AllTimeListInstanceEachOptions, callback?: (item: AllTimeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AllTimeInstance 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: AllTimePage) => any): Promise<AllTimePage>; /** * Lists AllTimeInstance 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 { AllTimeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AllTimeInstance[]) => any): Promise<AllTimeInstance[]>; list(params: AllTimeListInstanceOptions, callback?: (error: Error | null, items: AllTimeInstance[]) => any): Promise<AllTimeInstance[]>; /** * Retrieve a single page of AllTimeInstance 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 { AllTimeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AllTimePage) => any): Promise<AllTimePage>; page(params: AllTimeListInstancePageOptions, callback?: (error: Error | null, items: AllTimePage) => any): Promise<AllTimePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AllTimeListInstance(version: V2010, accountSid: string): AllTimeListInstance; interface AllTimePayload extends TwilioResponsePayload { usage_records: AllTimeResource[]; } interface AllTimeResource { account_sid: string; api_version: string; as_of: string; category: AllTimeCategory; count: string; count_unit: string; description: string; end_date: Date; price: number; price_unit: string; start_date: Date; subresource_uris: Record<string, string>; uri: string; usage: string; usage_unit: string; } export declare class AllTimeInstance { protected _version: V2010; constructor(_version: V2010, payload: AllTimeResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT */ asOf: string; category: AllTimeCategory; /** * The number of usage events, such as the number of calls. */ count: string; /** * The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. */ countUnit: string; /** * A plain-language description of the usage category. */ description: string; /** * The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ endDate: Date; /** * The total price of the usage in the currency specified in `price_unit` and associated with the account. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. */ priceUnit: string; /** * The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ startDate: Date; /** * A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). */ subresourceUris: Record<string, string>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The amount used to bill usage and measured in units described in `usage_unit`. */ usage: string; /** * The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. */ usageUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; asOf: string; category: AllTimeCategory; count: string; countUnit: string; description: string; endDate: Date; price: number; priceUnit: string; startDate: Date; subresourceUris: Record<string, string>; uri: string; usage: string; usageUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class AllTimePage extends Page<V2010, AllTimePayload, AllTimeResource, AllTimeInstance> { /** * Initialize the AllTimePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AllTimeSolution); /** * Build an instance of AllTimeInstance * * @param payload - Payload response from the API */ getInstance(payload: AllTimeResource): AllTimeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record/lastMonth.js000064400000014056151677225100015403 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.LastMonthPage = exports.LastMonthInstance = exports.LastMonthListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../../base/Page")); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); function LastMonthListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Records/LastMonth.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["category"] !== undefined) data["Category"] = params["category"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["includeSubaccounts"] !== undefined) data["IncludeSubaccounts"] = serialize.bool(params["includeSubaccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new LastMonthPage(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 LastMonthPage(instance._version, payload, 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; } exports.LastMonthListInstance = LastMonthListInstance; class LastMonthInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.asOf = payload.as_of; this.category = payload.category; this.count = payload.count; this.countUnit = payload.count_unit; this.description = payload.description; this.endDate = deserialize.iso8601Date(payload.end_date); this.price = payload.price; this.priceUnit = payload.price_unit; this.startDate = deserialize.iso8601Date(payload.start_date); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this.usage = payload.usage; this.usageUnit = payload.usage_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, asOf: this.asOf, category: this.category, count: this.count, countUnit: this.countUnit, description: this.description, endDate: this.endDate, price: this.price, priceUnit: this.priceUnit, startDate: this.startDate, subresourceUris: this.subresourceUris, uri: this.uri, usage: this.usage, usageUnit: this.usageUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LastMonthInstance = LastMonthInstance; class LastMonthPage extends Page_1.default { /** * Initialize the LastMonthPage * * @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 LastMonthInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new LastMonthInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LastMonthPage = LastMonthPage; rest/api/v2010/account/usage/record/yearly.js000064400000013770151677225100014741 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.YearlyPage = exports.YearlyInstance = exports.YearlyListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../../base/Page")); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); function YearlyListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Records/Yearly.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["category"] !== undefined) data["Category"] = params["category"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["includeSubaccounts"] !== undefined) data["IncludeSubaccounts"] = serialize.bool(params["includeSubaccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new YearlyPage(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 YearlyPage(instance._version, payload, 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; } exports.YearlyListInstance = YearlyListInstance; class YearlyInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.asOf = payload.as_of; this.category = payload.category; this.count = payload.count; this.countUnit = payload.count_unit; this.description = payload.description; this.endDate = deserialize.iso8601Date(payload.end_date); this.price = payload.price; this.priceUnit = payload.price_unit; this.startDate = deserialize.iso8601Date(payload.start_date); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this.usage = payload.usage; this.usageUnit = payload.usage_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, asOf: this.asOf, category: this.category, count: this.count, countUnit: this.countUnit, description: this.description, endDate: this.endDate, price: this.price, priceUnit: this.priceUnit, startDate: this.startDate, subresourceUris: this.subresourceUris, uri: this.uri, usage: this.usage, usageUnit: this.usageUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.YearlyInstance = YearlyInstance; class YearlyPage extends Page_1.default { /** * Initialize the YearlyPage * * @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 YearlyInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new YearlyInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.YearlyPage = YearlyPage; rest/api/v2010/account/usage/record/today.d.ts000064400000044566151677225100015017 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; export type TodayCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to each */ export interface TodayListInstanceEachOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: TodayCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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: TodayInstance, 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 TodayListInstanceOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: TodayCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 TodayListInstancePageOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: TodayCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 TodaySolution { accountSid: string; } export interface TodayListInstance { _version: V2010; _solution: TodaySolution; _uri: string; /** * Streams TodayInstance 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 { TodayListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TodayInstance, done: (err?: Error) => void) => void): void; each(params: TodayListInstanceEachOptions, callback?: (item: TodayInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TodayInstance 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: TodayPage) => any): Promise<TodayPage>; /** * Lists TodayInstance 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 { TodayListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TodayInstance[]) => any): Promise<TodayInstance[]>; list(params: TodayListInstanceOptions, callback?: (error: Error | null, items: TodayInstance[]) => any): Promise<TodayInstance[]>; /** * Retrieve a single page of TodayInstance 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 { TodayListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TodayPage) => any): Promise<TodayPage>; page(params: TodayListInstancePageOptions, callback?: (error: Error | null, items: TodayPage) => any): Promise<TodayPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TodayListInstance(version: V2010, accountSid: string): TodayListInstance; interface TodayPayload extends TwilioResponsePayload { usage_records: TodayResource[]; } interface TodayResource { account_sid: string; api_version: string; as_of: string; category: TodayCategory; count: string; count_unit: string; description: string; end_date: Date; price: number; price_unit: string; start_date: Date; subresource_uris: Record<string, string>; uri: string; usage: string; usage_unit: string; } export declare class TodayInstance { protected _version: V2010; constructor(_version: V2010, payload: TodayResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT */ asOf: string; category: TodayCategory; /** * The number of usage events, such as the number of calls. */ count: string; /** * The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. */ countUnit: string; /** * A plain-language description of the usage category. */ description: string; /** * The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ endDate: Date; /** * The total price of the usage in the currency specified in `price_unit` and associated with the account. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. */ priceUnit: string; /** * The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ startDate: Date; /** * A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). */ subresourceUris: Record<string, string>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The amount used to bill usage and measured in units described in `usage_unit`. */ usage: string; /** * The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. */ usageUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; asOf: string; category: TodayCategory; count: string; countUnit: string; description: string; endDate: Date; price: number; priceUnit: string; startDate: Date; subresourceUris: Record<string, string>; uri: string; usage: string; usageUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class TodayPage extends Page<V2010, TodayPayload, TodayResource, TodayInstance> { /** * Initialize the TodayPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: TodaySolution); /** * Build an instance of TodayInstance * * @param payload - Payload response from the API */ getInstance(payload: TodayResource): TodayInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record/lastMonth.d.ts000064400000045106151677225100015637 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; export type LastMonthCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to each */ export interface LastMonthListInstanceEachOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: LastMonthCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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: LastMonthInstance, 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 LastMonthListInstanceOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: LastMonthCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 LastMonthListInstancePageOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: LastMonthCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 LastMonthSolution { accountSid: string; } export interface LastMonthListInstance { _version: V2010; _solution: LastMonthSolution; _uri: string; /** * Streams LastMonthInstance 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 { LastMonthListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: LastMonthInstance, done: (err?: Error) => void) => void): void; each(params: LastMonthListInstanceEachOptions, callback?: (item: LastMonthInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of LastMonthInstance 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: LastMonthPage) => any): Promise<LastMonthPage>; /** * Lists LastMonthInstance 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 { LastMonthListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: LastMonthInstance[]) => any): Promise<LastMonthInstance[]>; list(params: LastMonthListInstanceOptions, callback?: (error: Error | null, items: LastMonthInstance[]) => any): Promise<LastMonthInstance[]>; /** * Retrieve a single page of LastMonthInstance 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 { LastMonthListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: LastMonthPage) => any): Promise<LastMonthPage>; page(params: LastMonthListInstancePageOptions, callback?: (error: Error | null, items: LastMonthPage) => any): Promise<LastMonthPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function LastMonthListInstance(version: V2010, accountSid: string): LastMonthListInstance; interface LastMonthPayload extends TwilioResponsePayload { usage_records: LastMonthResource[]; } interface LastMonthResource { account_sid: string; api_version: string; as_of: string; category: LastMonthCategory; count: string; count_unit: string; description: string; end_date: Date; price: number; price_unit: string; start_date: Date; subresource_uris: Record<string, string>; uri: string; usage: string; usage_unit: string; } export declare class LastMonthInstance { protected _version: V2010; constructor(_version: V2010, payload: LastMonthResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT */ asOf: string; category: LastMonthCategory; /** * The number of usage events, such as the number of calls. */ count: string; /** * The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. */ countUnit: string; /** * A plain-language description of the usage category. */ description: string; /** * The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ endDate: Date; /** * The total price of the usage in the currency specified in `price_unit` and associated with the account. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. */ priceUnit: string; /** * The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ startDate: Date; /** * A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). */ subresourceUris: Record<string, string>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The amount used to bill usage and measured in units described in `usage_unit`. */ usage: string; /** * The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. */ usageUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; asOf: string; category: LastMonthCategory; count: string; countUnit: string; description: string; endDate: Date; price: number; priceUnit: string; startDate: Date; subresourceUris: Record<string, string>; uri: string; usage: string; usageUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class LastMonthPage extends Page<V2010, LastMonthPayload, LastMonthResource, LastMonthInstance> { /** * Initialize the LastMonthPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: LastMonthSolution); /** * Build an instance of LastMonthInstance * * @param payload - Payload response from the API */ getInstance(payload: LastMonthResource): LastMonthInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record/allTime.js000064400000014012151677225100015011 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AllTimePage = exports.AllTimeInstance = exports.AllTimeListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../../base/Page")); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); function AllTimeListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Records/AllTime.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["category"] !== undefined) data["Category"] = params["category"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["includeSubaccounts"] !== undefined) data["IncludeSubaccounts"] = serialize.bool(params["includeSubaccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AllTimePage(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 AllTimePage(instance._version, payload, 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; } exports.AllTimeListInstance = AllTimeListInstance; class AllTimeInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.asOf = payload.as_of; this.category = payload.category; this.count = payload.count; this.countUnit = payload.count_unit; this.description = payload.description; this.endDate = deserialize.iso8601Date(payload.end_date); this.price = payload.price; this.priceUnit = payload.price_unit; this.startDate = deserialize.iso8601Date(payload.start_date); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this.usage = payload.usage; this.usageUnit = payload.usage_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, asOf: this.asOf, category: this.category, count: this.count, countUnit: this.countUnit, description: this.description, endDate: this.endDate, price: this.price, priceUnit: this.priceUnit, startDate: this.startDate, subresourceUris: this.subresourceUris, uri: this.uri, usage: this.usage, usageUnit: this.usageUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AllTimeInstance = AllTimeInstance; class AllTimePage extends Page_1.default { /** * Initialize the AllTimePage * * @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 AllTimeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AllTimeInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AllTimePage = AllTimePage; rest/api/v2010/account/usage/record/yesterday.js000064400000014056151677225100015443 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.YesterdayPage = exports.YesterdayInstance = exports.YesterdayListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../../base/Page")); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); function YesterdayListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Records/Yesterday.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["category"] !== undefined) data["Category"] = params["category"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["includeSubaccounts"] !== undefined) data["IncludeSubaccounts"] = serialize.bool(params["includeSubaccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new YesterdayPage(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 YesterdayPage(instance._version, payload, 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; } exports.YesterdayListInstance = YesterdayListInstance; class YesterdayInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.asOf = payload.as_of; this.category = payload.category; this.count = payload.count; this.countUnit = payload.count_unit; this.description = payload.description; this.endDate = deserialize.iso8601Date(payload.end_date); this.price = payload.price; this.priceUnit = payload.price_unit; this.startDate = deserialize.iso8601Date(payload.start_date); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this.usage = payload.usage; this.usageUnit = payload.usage_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, asOf: this.asOf, category: this.category, count: this.count, countUnit: this.countUnit, description: this.description, endDate: this.endDate, price: this.price, priceUnit: this.priceUnit, startDate: this.startDate, subresourceUris: this.subresourceUris, uri: this.uri, usage: this.usage, usageUnit: this.usageUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.YesterdayInstance = YesterdayInstance; class YesterdayPage extends Page_1.default { /** * Initialize the YesterdayPage * * @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 YesterdayInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new YesterdayInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.YesterdayPage = YesterdayPage; rest/api/v2010/account/usage/record/daily.js000064400000013746151677225100014541 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.DailyPage = exports.DailyInstance = exports.DailyListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../../base/Page")); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); function DailyListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Records/Daily.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["category"] !== undefined) data["Category"] = params["category"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["includeSubaccounts"] !== undefined) data["IncludeSubaccounts"] = serialize.bool(params["includeSubaccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DailyPage(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 DailyPage(instance._version, payload, 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; } exports.DailyListInstance = DailyListInstance; class DailyInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.asOf = payload.as_of; this.category = payload.category; this.count = payload.count; this.countUnit = payload.count_unit; this.description = payload.description; this.endDate = deserialize.iso8601Date(payload.end_date); this.price = payload.price; this.priceUnit = payload.price_unit; this.startDate = deserialize.iso8601Date(payload.start_date); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this.usage = payload.usage; this.usageUnit = payload.usage_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, asOf: this.asOf, category: this.category, count: this.count, countUnit: this.countUnit, description: this.description, endDate: this.endDate, price: this.price, priceUnit: this.priceUnit, startDate: this.startDate, subresourceUris: this.subresourceUris, uri: this.uri, usage: this.usage, usageUnit: this.usageUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DailyInstance = DailyInstance; class DailyPage extends Page_1.default { /** * Initialize the DailyPage * * @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 DailyInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DailyInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DailyPage = DailyPage; rest/api/v2010/account/usage/record/thisMonth.d.ts000064400000045106151677225100015643 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; export type ThisMonthCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to each */ export interface ThisMonthListInstanceEachOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: ThisMonthCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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: ThisMonthInstance, 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 ThisMonthListInstanceOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: ThisMonthCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 ThisMonthListInstancePageOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: ThisMonthCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 ThisMonthSolution { accountSid: string; } export interface ThisMonthListInstance { _version: V2010; _solution: ThisMonthSolution; _uri: string; /** * Streams ThisMonthInstance 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 { ThisMonthListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ThisMonthInstance, done: (err?: Error) => void) => void): void; each(params: ThisMonthListInstanceEachOptions, callback?: (item: ThisMonthInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ThisMonthInstance 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: ThisMonthPage) => any): Promise<ThisMonthPage>; /** * Lists ThisMonthInstance 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 { ThisMonthListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ThisMonthInstance[]) => any): Promise<ThisMonthInstance[]>; list(params: ThisMonthListInstanceOptions, callback?: (error: Error | null, items: ThisMonthInstance[]) => any): Promise<ThisMonthInstance[]>; /** * Retrieve a single page of ThisMonthInstance 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 { ThisMonthListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ThisMonthPage) => any): Promise<ThisMonthPage>; page(params: ThisMonthListInstancePageOptions, callback?: (error: Error | null, items: ThisMonthPage) => any): Promise<ThisMonthPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ThisMonthListInstance(version: V2010, accountSid: string): ThisMonthListInstance; interface ThisMonthPayload extends TwilioResponsePayload { usage_records: ThisMonthResource[]; } interface ThisMonthResource { account_sid: string; api_version: string; as_of: string; category: ThisMonthCategory; count: string; count_unit: string; description: string; end_date: Date; price: number; price_unit: string; start_date: Date; subresource_uris: Record<string, string>; uri: string; usage: string; usage_unit: string; } export declare class ThisMonthInstance { protected _version: V2010; constructor(_version: V2010, payload: ThisMonthResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT */ asOf: string; category: ThisMonthCategory; /** * The number of usage events, such as the number of calls. */ count: string; /** * The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. */ countUnit: string; /** * A plain-language description of the usage category. */ description: string; /** * The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ endDate: Date; /** * The total price of the usage in the currency specified in `price_unit` and associated with the account. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. */ priceUnit: string; /** * The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ startDate: Date; /** * A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). */ subresourceUris: Record<string, string>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The amount used to bill usage and measured in units described in `usage_unit`. */ usage: string; /** * The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. */ usageUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; asOf: string; category: ThisMonthCategory; count: string; countUnit: string; description: string; endDate: Date; price: number; priceUnit: string; startDate: Date; subresourceUris: Record<string, string>; uri: string; usage: string; usageUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class ThisMonthPage extends Page<V2010, ThisMonthPayload, ThisMonthResource, ThisMonthInstance> { /** * Initialize the ThisMonthPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: ThisMonthSolution); /** * Build an instance of ThisMonthInstance * * @param payload - Payload response from the API */ getInstance(payload: ThisMonthResource): ThisMonthInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record/yearly.d.ts000064400000044652151677225100015200 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; export type YearlyCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; /** * Options to pass to each */ export interface YearlyListInstanceEachOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: YearlyCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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: YearlyInstance, 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 YearlyListInstanceOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: YearlyCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 YearlyListInstancePageOptions { /** The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. */ category?: YearlyCategory; /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. */ endDate?: Date; /** Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. */ includeSubaccounts?: boolean; /** 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 YearlySolution { accountSid: string; } export interface YearlyListInstance { _version: V2010; _solution: YearlySolution; _uri: string; /** * Streams YearlyInstance 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 { YearlyListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: YearlyInstance, done: (err?: Error) => void) => void): void; each(params: YearlyListInstanceEachOptions, callback?: (item: YearlyInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of YearlyInstance 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: YearlyPage) => any): Promise<YearlyPage>; /** * Lists YearlyInstance 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 { YearlyListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: YearlyInstance[]) => any): Promise<YearlyInstance[]>; list(params: YearlyListInstanceOptions, callback?: (error: Error | null, items: YearlyInstance[]) => any): Promise<YearlyInstance[]>; /** * Retrieve a single page of YearlyInstance 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 { YearlyListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: YearlyPage) => any): Promise<YearlyPage>; page(params: YearlyListInstancePageOptions, callback?: (error: Error | null, items: YearlyPage) => any): Promise<YearlyPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function YearlyListInstance(version: V2010, accountSid: string): YearlyListInstance; interface YearlyPayload extends TwilioResponsePayload { usage_records: YearlyResource[]; } interface YearlyResource { account_sid: string; api_version: string; as_of: string; category: YearlyCategory; count: string; count_unit: string; description: string; end_date: Date; price: number; price_unit: string; start_date: Date; subresource_uris: Record<string, string>; uri: string; usage: string; usage_unit: string; } export declare class YearlyInstance { protected _version: V2010; constructor(_version: V2010, payload: YearlyResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. */ accountSid: string; /** * The API version used to create the resource. */ apiVersion: string; /** * Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT */ asOf: string; category: YearlyCategory; /** * The number of usage events, such as the number of calls. */ count: string; /** * The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. */ countUnit: string; /** * A plain-language description of the usage category. */ description: string; /** * The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ endDate: Date; /** * The total price of the usage in the currency specified in `price_unit` and associated with the account. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. */ priceUnit: string; /** * The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. */ startDate: Date; /** * A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). */ subresourceUris: Record<string, string>; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The amount used to bill usage and measured in units described in `usage_unit`. */ usage: string; /** * The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. */ usageUnit: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; asOf: string; category: YearlyCategory; count: string; countUnit: string; description: string; endDate: Date; price: number; priceUnit: string; startDate: Date; subresourceUris: Record<string, string>; uri: string; usage: string; usageUnit: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class YearlyPage extends Page<V2010, YearlyPayload, YearlyResource, YearlyInstance> { /** * Initialize the YearlyPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: YearlySolution); /** * Build an instance of YearlyInstance * * @param payload - Payload response from the API */ getInstance(payload: YearlyResource): YearlyInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage/record/thisMonth.js000064400000014056151677225100015407 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.ThisMonthPage = exports.ThisMonthInstance = exports.ThisMonthListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../../base/Page")); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); function ThisMonthListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Usage/Records/ThisMonth.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["category"] !== undefined) data["Category"] = params["category"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["includeSubaccounts"] !== undefined) data["IncludeSubaccounts"] = serialize.bool(params["includeSubaccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ThisMonthPage(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 ThisMonthPage(instance._version, payload, 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; } exports.ThisMonthListInstance = ThisMonthListInstance; class ThisMonthInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.asOf = payload.as_of; this.category = payload.category; this.count = payload.count; this.countUnit = payload.count_unit; this.description = payload.description; this.endDate = deserialize.iso8601Date(payload.end_date); this.price = payload.price; this.priceUnit = payload.price_unit; this.startDate = deserialize.iso8601Date(payload.start_date); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this.usage = payload.usage; this.usageUnit = payload.usage_unit; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, asOf: this.asOf, category: this.category, count: this.count, countUnit: this.countUnit, description: this.description, endDate: this.endDate, price: this.price, priceUnit: this.priceUnit, startDate: this.startDate, subresourceUris: this.subresourceUris, uri: this.uri, usage: this.usage, usageUnit: this.usageUnit, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ThisMonthInstance = ThisMonthInstance; class ThisMonthPage extends Page_1.default { /** * Initialize the ThisMonthPage * * @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 ThisMonthInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ThisMonthInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ThisMonthPage = ThisMonthPage; rest/api/v2010/account/outgoingCallerId.d.ts000064400000027752151677225100014546 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; /** * Options to pass to update a OutgoingCallerIdInstance */ export interface OutgoingCallerIdContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; } /** * Options to pass to each */ export interface OutgoingCallerIdListInstanceEachOptions { /** The phone number of the OutgoingCallerId resources to read. */ phoneNumber?: string; /** The string that identifies the OutgoingCallerId resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: OutgoingCallerIdInstance, 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 OutgoingCallerIdListInstanceOptions { /** The phone number of the OutgoingCallerId resources to read. */ phoneNumber?: string; /** The string that identifies the OutgoingCallerId resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface OutgoingCallerIdListInstancePageOptions { /** The phone number of the OutgoingCallerId resources to read. */ phoneNumber?: string; /** The string that identifies the OutgoingCallerId resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface OutgoingCallerIdContext { /** * Remove a OutgoingCallerIdInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a OutgoingCallerIdInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OutgoingCallerIdInstance */ fetch(callback?: (error: Error | null, item?: OutgoingCallerIdInstance) => any): Promise<OutgoingCallerIdInstance>; /** * Update a OutgoingCallerIdInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OutgoingCallerIdInstance */ update(callback?: (error: Error | null, item?: OutgoingCallerIdInstance) => any): Promise<OutgoingCallerIdInstance>; /** * Update a OutgoingCallerIdInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed OutgoingCallerIdInstance */ update(params: OutgoingCallerIdContextUpdateOptions, callback?: (error: Error | null, item?: OutgoingCallerIdInstance) => any): Promise<OutgoingCallerIdInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface OutgoingCallerIdContextSolution { accountSid: string; sid: string; } export declare class OutgoingCallerIdContextImpl implements OutgoingCallerIdContext { protected _version: V2010; protected _solution: OutgoingCallerIdContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: OutgoingCallerIdInstance) => any): Promise<OutgoingCallerIdInstance>; update(params?: OutgoingCallerIdContextUpdateOptions | ((error: Error | null, item?: OutgoingCallerIdInstance) => any), callback?: (error: Error | null, item?: OutgoingCallerIdInstance) => any): Promise<OutgoingCallerIdInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): OutgoingCallerIdContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface OutgoingCallerIdPayload extends TwilioResponsePayload { outgoing_caller_ids: OutgoingCallerIdResource[]; } interface OutgoingCallerIdResource { sid: string; date_created: Date; date_updated: Date; friendly_name: string; account_sid: string; phone_number: string; uri: string; } export declare class OutgoingCallerIdInstance { protected _version: V2010; protected _solution: OutgoingCallerIdContextSolution; protected _context?: OutgoingCallerIdContext; constructor(_version: V2010, payload: OutgoingCallerIdResource, accountSid: string, sid?: string); /** * The unique string that that we created to identify the OutgoingCallerId resource. */ sid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resource. */ accountSid: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Remove a OutgoingCallerIdInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a OutgoingCallerIdInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OutgoingCallerIdInstance */ fetch(callback?: (error: Error | null, item?: OutgoingCallerIdInstance) => any): Promise<OutgoingCallerIdInstance>; /** * Update a OutgoingCallerIdInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OutgoingCallerIdInstance */ update(callback?: (error: Error | null, item?: OutgoingCallerIdInstance) => any): Promise<OutgoingCallerIdInstance>; /** * Update a OutgoingCallerIdInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed OutgoingCallerIdInstance */ update(params: OutgoingCallerIdContextUpdateOptions, callback?: (error: Error | null, item?: OutgoingCallerIdInstance) => any): Promise<OutgoingCallerIdInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; accountSid: string; phoneNumber: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface OutgoingCallerIdSolution { accountSid: string; } export interface OutgoingCallerIdListInstance { _version: V2010; _solution: OutgoingCallerIdSolution; _uri: string; (sid: string): OutgoingCallerIdContext; get(sid: string): OutgoingCallerIdContext; /** * Streams OutgoingCallerIdInstance 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 { OutgoingCallerIdListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: OutgoingCallerIdInstance, done: (err?: Error) => void) => void): void; each(params: OutgoingCallerIdListInstanceEachOptions, callback?: (item: OutgoingCallerIdInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of OutgoingCallerIdInstance 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: OutgoingCallerIdPage) => any): Promise<OutgoingCallerIdPage>; /** * Lists OutgoingCallerIdInstance 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 { OutgoingCallerIdListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: OutgoingCallerIdInstance[]) => any): Promise<OutgoingCallerIdInstance[]>; list(params: OutgoingCallerIdListInstanceOptions, callback?: (error: Error | null, items: OutgoingCallerIdInstance[]) => any): Promise<OutgoingCallerIdInstance[]>; /** * Retrieve a single page of OutgoingCallerIdInstance 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 { OutgoingCallerIdListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: OutgoingCallerIdPage) => any): Promise<OutgoingCallerIdPage>; page(params: OutgoingCallerIdListInstancePageOptions, callback?: (error: Error | null, items: OutgoingCallerIdPage) => any): Promise<OutgoingCallerIdPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function OutgoingCallerIdListInstance(version: V2010, accountSid: string): OutgoingCallerIdListInstance; export declare class OutgoingCallerIdPage extends Page<V2010, OutgoingCallerIdPayload, OutgoingCallerIdResource, OutgoingCallerIdInstance> { /** * Initialize the OutgoingCallerIdPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: OutgoingCallerIdSolution); /** * Build an instance of OutgoingCallerIdInstance * * @param payload - Payload response from the API */ getInstance(payload: OutgoingCallerIdResource): OutgoingCallerIdInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/address.d.ts000064400000037513151677225100012734 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; import { DependentPhoneNumberListInstance } from "./address/dependentPhoneNumber"; /** * Options to pass to update a AddressInstance */ export interface AddressContextUpdateOptions { /** A descriptive string that you create to describe the address. It can be up to 64 characters long. */ friendlyName?: string; /** The name to associate with the address. */ customerName?: string; /** The number and street address of the address. */ street?: string; /** The city of the address. */ city?: string; /** The state or region of the address. */ region?: string; /** The postal code of the address. */ postalCode?: string; /** Whether to enable emergency calling on the address. Can be: `true` or `false`. */ emergencyEnabled?: boolean; /** Whether we should automatically correct the address. Can be: `true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won\\\'t alter the address you provide. */ autoCorrectAddress?: boolean; /** The additional number and street address of the address. */ streetSecondary?: string; } /** * Options to pass to create a AddressInstance */ export interface AddressListInstanceCreateOptions { /** The name to associate with the new address. */ customerName: string; /** The number and street address of the new address. */ street: string; /** The city of the new address. */ city: string; /** The state or region of the new address. */ region: string; /** The postal code of the new address. */ postalCode: string; /** The ISO country code of the new address. */ isoCountry: string; /** A descriptive string that you create to describe the new address. It can be up to 64 characters long. */ friendlyName?: string; /** Whether to enable emergency calling on the new address. Can be: `true` or `false`. */ emergencyEnabled?: boolean; /** Whether we should automatically correct the address. Can be: `true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won\\\'t alter the address you provide. */ autoCorrectAddress?: boolean; /** The additional number and street address of the address. */ streetSecondary?: string; } /** * Options to pass to each */ export interface AddressListInstanceEachOptions { /** The `customer_name` of the Address resources to read. */ customerName?: string; /** The string that identifies the Address resources to read. */ friendlyName?: string; /** The ISO country code of the Address resources to read. */ isoCountry?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AddressInstance, 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 AddressListInstanceOptions { /** The `customer_name` of the Address resources to read. */ customerName?: string; /** The string that identifies the Address resources to read. */ friendlyName?: string; /** The ISO country code of the Address resources to read. */ isoCountry?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AddressListInstancePageOptions { /** The `customer_name` of the Address resources to read. */ customerName?: string; /** The string that identifies the Address resources to read. */ friendlyName?: string; /** The ISO country code of the Address resources to read. */ isoCountry?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AddressContext { dependentPhoneNumbers: DependentPhoneNumberListInstance; /** * Remove a AddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressInstance */ fetch(callback?: (error: Error | null, item?: AddressInstance) => any): Promise<AddressInstance>; /** * Update a AddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressInstance */ update(callback?: (error: Error | null, item?: AddressInstance) => any): Promise<AddressInstance>; /** * Update a AddressInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressInstance */ update(params: AddressContextUpdateOptions, callback?: (error: Error | null, item?: AddressInstance) => any): Promise<AddressInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AddressContextSolution { accountSid: string; sid: string; } export declare class AddressContextImpl implements AddressContext { protected _version: V2010; protected _solution: AddressContextSolution; protected _uri: string; protected _dependentPhoneNumbers?: DependentPhoneNumberListInstance; constructor(_version: V2010, accountSid: string, sid: string); get dependentPhoneNumbers(): DependentPhoneNumberListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AddressInstance) => any): Promise<AddressInstance>; update(params?: AddressContextUpdateOptions | ((error: Error | null, item?: AddressInstance) => any), callback?: (error: Error | null, item?: AddressInstance) => any): Promise<AddressInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AddressContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AddressPayload extends TwilioResponsePayload { addresses: AddressResource[]; } interface AddressResource { account_sid: string; city: string; customer_name: string; date_created: Date; date_updated: Date; friendly_name: string; iso_country: string; postal_code: string; region: string; sid: string; street: string; uri: string; emergency_enabled: boolean; validated: boolean; verified: boolean; street_secondary: string; } export declare class AddressInstance { protected _version: V2010; protected _solution: AddressContextSolution; protected _context?: AddressContext; constructor(_version: V2010, payload: AddressResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource. */ accountSid: string; /** * The city in which the address is located. */ city: string; /** * The name associated with the address.This property has a maximum length of 16 4-byte characters, or 21 3-byte characters. */ customerName: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The ISO country code of the address. */ isoCountry: string; /** * The postal code of the address. */ postalCode: string; /** * The state or region of the address. */ region: string; /** * The unique string that that we created to identify the Address resource. */ sid: string; /** * The number and street address of the address. */ street: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * Whether emergency calling has been enabled on this number. */ emergencyEnabled: boolean; /** * Whether the address has been validated to comply with local regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been validated. `false` indicate the country doesn\'t require validation or the Address is not valid. */ validated: boolean; /** * Whether the address has been verified to comply with regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been verified. `false` indicate the country doesn\'t require verified or the Address is not valid. */ verified: boolean; /** * The additional number and street address of the address. */ streetSecondary: string; private get _proxy(); /** * Remove a AddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressInstance */ fetch(callback?: (error: Error | null, item?: AddressInstance) => any): Promise<AddressInstance>; /** * Update a AddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressInstance */ update(callback?: (error: Error | null, item?: AddressInstance) => any): Promise<AddressInstance>; /** * Update a AddressInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressInstance */ update(params: AddressContextUpdateOptions, callback?: (error: Error | null, item?: AddressInstance) => any): Promise<AddressInstance>; /** * Access the dependentPhoneNumbers. */ dependentPhoneNumbers(): DependentPhoneNumberListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; city: string; customerName: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; isoCountry: string; postalCode: string; region: string; sid: string; street: string; uri: string; emergencyEnabled: boolean; validated: boolean; verified: boolean; streetSecondary: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AddressSolution { accountSid: string; } export interface AddressListInstance { _version: V2010; _solution: AddressSolution; _uri: string; (sid: string): AddressContext; get(sid: string): AddressContext; /** * Create a AddressInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressInstance */ create(params: AddressListInstanceCreateOptions, callback?: (error: Error | null, item?: AddressInstance) => any): Promise<AddressInstance>; /** * Streams AddressInstance 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 { AddressListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AddressInstance, done: (err?: Error) => void) => void): void; each(params: AddressListInstanceEachOptions, callback?: (item: AddressInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AddressInstance 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: AddressPage) => any): Promise<AddressPage>; /** * Lists AddressInstance 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 { AddressListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AddressInstance[]) => any): Promise<AddressInstance[]>; list(params: AddressListInstanceOptions, callback?: (error: Error | null, items: AddressInstance[]) => any): Promise<AddressInstance[]>; /** * Retrieve a single page of AddressInstance 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 { AddressListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AddressPage) => any): Promise<AddressPage>; page(params: AddressListInstancePageOptions, callback?: (error: Error | null, items: AddressPage) => any): Promise<AddressPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AddressListInstance(version: V2010, accountSid: string): AddressListInstance; export declare class AddressPage extends Page<V2010, AddressPayload, AddressResource, AddressInstance> { /** * Initialize the AddressPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AddressSolution); /** * Build an instance of AddressInstance * * @param payload - Payload response from the API */ getInstance(payload: AddressResource): AddressInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/call.js000064400000050650151677225100011763 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.CallPage = exports.CallListInstance = exports.CallInstance = exports.CallContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const event_1 = require("./call/event"); const notification_1 = require("./call/notification"); const payment_1 = require("./call/payment"); const recording_1 = require("./call/recording"); const siprec_1 = require("./call/siprec"); const stream_1 = require("./call/stream"); const userDefinedMessage_1 = require("./call/userDefinedMessage"); const userDefinedMessageSubscription_1 = require("./call/userDefinedMessageSubscription"); class CallContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Calls/${sid}.json`; } get events() { this._events = this._events || (0, event_1.EventListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._events; } get notifications() { this._notifications = this._notifications || (0, notification_1.NotificationListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._notifications; } get payments() { this._payments = this._payments || (0, payment_1.PaymentListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._payments; } get recordings() { this._recordings = this._recordings || (0, recording_1.RecordingListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._recordings; } get siprec() { this._siprec = this._siprec || (0, siprec_1.SiprecListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._siprec; } get streams() { this._streams = this._streams || (0, stream_1.StreamListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._streams; } get userDefinedMessages() { this._userDefinedMessages = this._userDefinedMessages || (0, userDefinedMessage_1.UserDefinedMessageListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._userDefinedMessages; } get userDefinedMessageSubscriptions() { this._userDefinedMessageSubscriptions = this._userDefinedMessageSubscriptions || (0, userDefinedMessageSubscription_1.UserDefinedMessageSubscriptionListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._userDefinedMessageSubscriptions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CallInstance(operationVersion, payload, instance._solution.accountSid, 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["url"] !== undefined) data["Url"] = params["url"]; if (params["method"] !== undefined) data["Method"] = params["method"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["fallbackUrl"] !== undefined) data["FallbackUrl"] = params["fallbackUrl"]; if (params["fallbackMethod"] !== undefined) data["FallbackMethod"] = params["fallbackMethod"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["twiml"] !== undefined) data["Twiml"] = serialize.twiml(params["twiml"]); if (params["timeLimit"] !== undefined) data["TimeLimit"] = params["timeLimit"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CallInstance(operationVersion, payload, instance._solution.accountSid, 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.CallContextImpl = CallContextImpl; class CallInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.sid = payload.sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.parentCallSid = payload.parent_call_sid; this.accountSid = payload.account_sid; this.to = payload.to; this.toFormatted = payload.to_formatted; this.from = payload.from; this.fromFormatted = payload.from_formatted; this.phoneNumberSid = payload.phone_number_sid; this.status = payload.status; this.startTime = deserialize.rfc2822DateTime(payload.start_time); this.endTime = deserialize.rfc2822DateTime(payload.end_time); this.duration = payload.duration; this.price = payload.price; this.priceUnit = payload.price_unit; this.direction = payload.direction; this.answeredBy = payload.answered_by; this.apiVersion = payload.api_version; this.forwardedFrom = payload.forwarded_from; this.groupSid = payload.group_sid; this.callerName = payload.caller_name; this.queueTime = payload.queue_time; this.trunkSid = payload.trunk_sid; this.uri = payload.uri; this.subresourceUris = payload.subresource_uris; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CallContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the events. */ events() { return this._proxy.events; } /** * Access the notifications. */ notifications() { return this._proxy.notifications; } /** * Access the payments. */ payments() { return this._proxy.payments; } /** * Access the recordings. */ recordings() { return this._proxy.recordings; } /** * Access the siprec. */ siprec() { return this._proxy.siprec; } /** * Access the streams. */ streams() { return this._proxy.streams; } /** * Access the userDefinedMessages. */ userDefinedMessages() { return this._proxy.userDefinedMessages; } /** * Access the userDefinedMessageSubscriptions. */ userDefinedMessageSubscriptions() { return this._proxy.userDefinedMessageSubscriptions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, parentCallSid: this.parentCallSid, accountSid: this.accountSid, to: this.to, toFormatted: this.toFormatted, from: this.from, fromFormatted: this.fromFormatted, phoneNumberSid: this.phoneNumberSid, status: this.status, startTime: this.startTime, endTime: this.endTime, duration: this.duration, price: this.price, priceUnit: this.priceUnit, direction: this.direction, answeredBy: this.answeredBy, apiVersion: this.apiVersion, forwardedFrom: this.forwardedFrom, groupSid: this.groupSid, callerName: this.callerName, queueTime: this.queueTime, trunkSid: this.trunkSid, uri: this.uri, subresourceUris: this.subresourceUris, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CallInstance = CallInstance; function CallListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CallContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Calls.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["to"] === null || params["to"] === undefined) { throw new Error("Required parameter \"params['to']\" missing."); } if (params["from"] === null || params["from"] === undefined) { throw new Error("Required parameter \"params['from']\" missing."); } let data = {}; data["To"] = params["to"]; data["From"] = params["from"]; if (params["method"] !== undefined) data["Method"] = params["method"]; if (params["fallbackUrl"] !== undefined) data["FallbackUrl"] = params["fallbackUrl"]; if (params["fallbackMethod"] !== undefined) data["FallbackMethod"] = params["fallbackMethod"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackEvent"] !== undefined) data["StatusCallbackEvent"] = serialize.map(params["statusCallbackEvent"], (e) => e); if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["sendDigits"] !== undefined) data["SendDigits"] = params["sendDigits"]; if (params["timeout"] !== undefined) data["Timeout"] = params["timeout"]; if (params["record"] !== undefined) data["Record"] = serialize.bool(params["record"]); if (params["recordingChannels"] !== undefined) data["RecordingChannels"] = params["recordingChannels"]; if (params["recordingStatusCallback"] !== undefined) data["RecordingStatusCallback"] = params["recordingStatusCallback"]; if (params["recordingStatusCallbackMethod"] !== undefined) data["RecordingStatusCallbackMethod"] = params["recordingStatusCallbackMethod"]; if (params["sipAuthUsername"] !== undefined) data["SipAuthUsername"] = params["sipAuthUsername"]; if (params["sipAuthPassword"] !== undefined) data["SipAuthPassword"] = params["sipAuthPassword"]; if (params["machineDetection"] !== undefined) data["MachineDetection"] = params["machineDetection"]; if (params["machineDetectionTimeout"] !== undefined) data["MachineDetectionTimeout"] = params["machineDetectionTimeout"]; if (params["recordingStatusCallbackEvent"] !== undefined) data["RecordingStatusCallbackEvent"] = serialize.map(params["recordingStatusCallbackEvent"], (e) => e); if (params["trim"] !== undefined) data["Trim"] = params["trim"]; if (params["callerId"] !== undefined) data["CallerId"] = params["callerId"]; if (params["machineDetectionSpeechThreshold"] !== undefined) data["MachineDetectionSpeechThreshold"] = params["machineDetectionSpeechThreshold"]; if (params["machineDetectionSpeechEndThreshold"] !== undefined) data["MachineDetectionSpeechEndThreshold"] = params["machineDetectionSpeechEndThreshold"]; if (params["machineDetectionSilenceTimeout"] !== undefined) data["MachineDetectionSilenceTimeout"] = params["machineDetectionSilenceTimeout"]; if (params["asyncAmd"] !== undefined) data["AsyncAmd"] = params["asyncAmd"]; if (params["asyncAmdStatusCallback"] !== undefined) data["AsyncAmdStatusCallback"] = params["asyncAmdStatusCallback"]; if (params["asyncAmdStatusCallbackMethod"] !== undefined) data["AsyncAmdStatusCallbackMethod"] = params["asyncAmdStatusCallbackMethod"]; if (params["byoc"] !== undefined) data["Byoc"] = params["byoc"]; if (params["callReason"] !== undefined) data["CallReason"] = params["callReason"]; if (params["callToken"] !== undefined) data["CallToken"] = params["callToken"]; if (params["recordingTrack"] !== undefined) data["RecordingTrack"] = params["recordingTrack"]; if (params["timeLimit"] !== undefined) data["TimeLimit"] = params["timeLimit"]; if (params["url"] !== undefined) data["Url"] = params["url"]; if (params["twiml"] !== undefined) data["Twiml"] = serialize.twiml(params["twiml"]); if (params["applicationSid"] !== undefined) data["ApplicationSid"] = params["applicationSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CallInstance(operationVersion, payload, instance._solution.accountSid)); 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["to"] !== undefined) data["To"] = params["to"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["parentCallSid"] !== undefined) data["ParentCallSid"] = params["parentCallSid"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["startTime"] !== undefined) data["StartTime"] = serialize.iso8601DateTime(params["startTime"]); if (params["startTimeBefore"] !== undefined) data["StartTime<"] = serialize.iso8601DateTime(params["startTimeBefore"]); if (params["startTimeAfter"] !== undefined) data["StartTime>"] = serialize.iso8601DateTime(params["startTimeAfter"]); if (params["endTime"] !== undefined) data["EndTime"] = serialize.iso8601DateTime(params["endTime"]); if (params["endTimeBefore"] !== undefined) data["EndTime<"] = serialize.iso8601DateTime(params["endTimeBefore"]); if (params["endTimeAfter"] !== undefined) data["EndTime>"] = serialize.iso8601DateTime(params["endTimeAfter"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CallPage(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 CallPage(instance._version, payload, 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; } exports.CallListInstance = CallListInstance; class CallPage extends Page_1.default { /** * Initialize the CallPage * * @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 CallInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CallInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CallPage = CallPage; rest/api/v2010/account/address.js000064400000032747151677225100012504 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AddressPage = exports.AddressListInstance = exports.AddressInstance = exports.AddressContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const dependentPhoneNumber_1 = require("./address/dependentPhoneNumber"); class AddressContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Addresses/${sid}.json`; } get dependentPhoneNumbers() { this._dependentPhoneNumbers = this._dependentPhoneNumbers || (0, dependentPhoneNumber_1.DependentPhoneNumberListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._dependentPhoneNumbers; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AddressInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["customerName"] !== undefined) data["CustomerName"] = params["customerName"]; if (params["street"] !== undefined) data["Street"] = params["street"]; if (params["city"] !== undefined) data["City"] = params["city"]; if (params["region"] !== undefined) data["Region"] = params["region"]; if (params["postalCode"] !== undefined) data["PostalCode"] = params["postalCode"]; if (params["emergencyEnabled"] !== undefined) data["EmergencyEnabled"] = serialize.bool(params["emergencyEnabled"]); if (params["autoCorrectAddress"] !== undefined) data["AutoCorrectAddress"] = serialize.bool(params["autoCorrectAddress"]); if (params["streetSecondary"] !== undefined) data["StreetSecondary"] = params["streetSecondary"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AddressInstance(operationVersion, payload, instance._solution.accountSid, 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.AddressContextImpl = AddressContextImpl; class AddressInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.city = payload.city; this.customerName = payload.customer_name; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.isoCountry = payload.iso_country; this.postalCode = payload.postal_code; this.region = payload.region; this.sid = payload.sid; this.street = payload.street; this.uri = payload.uri; this.emergencyEnabled = payload.emergency_enabled; this.validated = payload.validated; this.verified = payload.verified; this.streetSecondary = payload.street_secondary; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AddressContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a AddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the dependentPhoneNumbers. */ dependentPhoneNumbers() { return this._proxy.dependentPhoneNumbers; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, city: this.city, customerName: this.customerName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, isoCountry: this.isoCountry, postalCode: this.postalCode, region: this.region, sid: this.sid, street: this.street, uri: this.uri, emergencyEnabled: this.emergencyEnabled, validated: this.validated, verified: this.verified, streetSecondary: this.streetSecondary, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AddressInstance = AddressInstance; function AddressListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AddressContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Addresses.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["customerName"] === null || params["customerName"] === undefined) { throw new Error("Required parameter \"params['customerName']\" missing."); } if (params["street"] === null || params["street"] === undefined) { throw new Error("Required parameter \"params['street']\" missing."); } if (params["city"] === null || params["city"] === undefined) { throw new Error("Required parameter \"params['city']\" missing."); } if (params["region"] === null || params["region"] === undefined) { throw new Error("Required parameter \"params['region']\" missing."); } if (params["postalCode"] === null || params["postalCode"] === undefined) { throw new Error("Required parameter \"params['postalCode']\" missing."); } if (params["isoCountry"] === null || params["isoCountry"] === undefined) { throw new Error("Required parameter \"params['isoCountry']\" missing."); } let data = {}; data["CustomerName"] = params["customerName"]; data["Street"] = params["street"]; data["City"] = params["city"]; data["Region"] = params["region"]; data["PostalCode"] = params["postalCode"]; data["IsoCountry"] = params["isoCountry"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["emergencyEnabled"] !== undefined) data["EmergencyEnabled"] = serialize.bool(params["emergencyEnabled"]); if (params["autoCorrectAddress"] !== undefined) data["AutoCorrectAddress"] = serialize.bool(params["autoCorrectAddress"]); if (params["streetSecondary"] !== undefined) data["StreetSecondary"] = params["streetSecondary"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AddressInstance(operationVersion, payload, instance._solution.accountSid)); 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["customerName"] !== undefined) data["CustomerName"] = params["customerName"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["isoCountry"] !== undefined) data["IsoCountry"] = params["isoCountry"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AddressPage(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 AddressPage(instance._version, payload, 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; } exports.AddressListInstance = AddressListInstance; class AddressPage extends Page_1.default { /** * Initialize the AddressPage * * @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 AddressInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AddressInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AddressPage = AddressPage; rest/api/v2010/account/message.js000064400000034471151677225100012477 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.MessagePage = exports.MessageListInstance = exports.MessageInstance = exports.MessageContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const feedback_1 = require("./message/feedback"); const media_1 = require("./message/media"); class MessageContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Messages/${sid}.json`; } get feedback() { this._feedback = this._feedback || (0, feedback_1.FeedbackListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._feedback; } get media() { this._media = this._media || (0, media_1.MediaListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._media; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.accountSid, 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["body"] !== undefined) data["Body"] = params["body"]; if (params["status"] !== undefined) data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.accountSid, 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.MessageContextImpl = MessageContextImpl; class MessageInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.body = payload.body; this.numSegments = payload.num_segments; this.direction = payload.direction; this.from = payload.from; this.to = payload.to; this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.price = payload.price; this.errorMessage = payload.error_message; this.uri = payload.uri; this.accountSid = payload.account_sid; this.numMedia = payload.num_media; this.status = payload.status; this.messagingServiceSid = payload.messaging_service_sid; this.sid = payload.sid; this.dateSent = deserialize.rfc2822DateTime(payload.date_sent); this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.errorCode = deserialize.integer(payload.error_code); this.priceUnit = payload.price_unit; this.apiVersion = payload.api_version; this.subresourceUris = payload.subresource_uris; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MessageContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the feedback. */ feedback() { return this._proxy.feedback; } /** * Access the media. */ media() { return this._proxy.media; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { body: this.body, numSegments: this.numSegments, direction: this.direction, from: this.from, to: this.to, dateUpdated: this.dateUpdated, price: this.price, errorMessage: this.errorMessage, uri: this.uri, accountSid: this.accountSid, numMedia: this.numMedia, status: this.status, messagingServiceSid: this.messagingServiceSid, sid: this.sid, dateSent: this.dateSent, dateCreated: this.dateCreated, errorCode: this.errorCode, priceUnit: this.priceUnit, apiVersion: this.apiVersion, subresourceUris: this.subresourceUris, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessageInstance = MessageInstance; function MessageListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MessageContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Messages.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["to"] === null || params["to"] === undefined) { throw new Error("Required parameter \"params['to']\" missing."); } let data = {}; data["To"] = params["to"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["applicationSid"] !== undefined) data["ApplicationSid"] = params["applicationSid"]; if (params["maxPrice"] !== undefined) data["MaxPrice"] = params["maxPrice"]; if (params["provideFeedback"] !== undefined) data["ProvideFeedback"] = serialize.bool(params["provideFeedback"]); if (params["attempt"] !== undefined) data["Attempt"] = params["attempt"]; if (params["validityPeriod"] !== undefined) data["ValidityPeriod"] = params["validityPeriod"]; if (params["forceDelivery"] !== undefined) data["ForceDelivery"] = serialize.bool(params["forceDelivery"]); if (params["contentRetention"] !== undefined) data["ContentRetention"] = params["contentRetention"]; if (params["addressRetention"] !== undefined) data["AddressRetention"] = params["addressRetention"]; if (params["smartEncoded"] !== undefined) data["SmartEncoded"] = serialize.bool(params["smartEncoded"]); if (params["persistentAction"] !== undefined) data["PersistentAction"] = serialize.map(params["persistentAction"], (e) => e); if (params["shortenUrls"] !== undefined) data["ShortenUrls"] = serialize.bool(params["shortenUrls"]); if (params["scheduleType"] !== undefined) data["ScheduleType"] = params["scheduleType"]; if (params["sendAt"] !== undefined) data["SendAt"] = serialize.iso8601DateTime(params["sendAt"]); if (params["sendAsMms"] !== undefined) data["SendAsMms"] = serialize.bool(params["sendAsMms"]); if (params["contentVariables"] !== undefined) data["ContentVariables"] = params["contentVariables"]; if (params["riskCheck"] !== undefined) data["RiskCheck"] = params["riskCheck"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["messagingServiceSid"] !== undefined) data["MessagingServiceSid"] = params["messagingServiceSid"]; if (params["body"] !== undefined) data["Body"] = params["body"]; if (params["mediaUrl"] !== undefined) data["MediaUrl"] = serialize.map(params["mediaUrl"], (e) => e); if (params["contentSid"] !== undefined) data["ContentSid"] = params["contentSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.accountSid)); 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["to"] !== undefined) data["To"] = params["to"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["dateSent"] !== undefined) data["DateSent"] = serialize.iso8601DateTime(params["dateSent"]); if (params["dateSentBefore"] !== undefined) data["DateSent<"] = serialize.iso8601DateTime(params["dateSentBefore"]); if (params["dateSentAfter"] !== undefined) data["DateSent>"] = serialize.iso8601DateTime(params["dateSentAfter"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MessagePage(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 MessagePage(instance._version, payload, 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; } exports.MessageListInstance = MessageListInstance; class MessagePage extends Page_1.default { /** * Initialize the MessagePage * * @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 MessageInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MessageInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessagePage = MessagePage; rest/api/v2010/account/connectApp.js000064400000023562151677225100013144 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.ConnectAppPage = exports.ConnectAppListInstance = exports.ConnectAppInstance = exports.ConnectAppContextImpl = void 0; 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 ConnectAppContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/ConnectApps/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ConnectAppInstance(operationVersion, payload, instance._solution.accountSid, 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["authorizeRedirectUrl"] !== undefined) data["AuthorizeRedirectUrl"] = params["authorizeRedirectUrl"]; if (params["companyName"] !== undefined) data["CompanyName"] = params["companyName"]; if (params["deauthorizeCallbackMethod"] !== undefined) data["DeauthorizeCallbackMethod"] = params["deauthorizeCallbackMethod"]; if (params["deauthorizeCallbackUrl"] !== undefined) data["DeauthorizeCallbackUrl"] = params["deauthorizeCallbackUrl"]; if (params["description"] !== undefined) data["Description"] = params["description"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["homepageUrl"] !== undefined) data["HomepageUrl"] = params["homepageUrl"]; if (params["permissions"] !== undefined) data["Permissions"] = serialize.map(params["permissions"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConnectAppInstance(operationVersion, payload, instance._solution.accountSid, 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.ConnectAppContextImpl = ConnectAppContextImpl; class ConnectAppInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.authorizeRedirectUrl = payload.authorize_redirect_url; this.companyName = payload.company_name; this.deauthorizeCallbackMethod = payload.deauthorize_callback_method; this.deauthorizeCallbackUrl = payload.deauthorize_callback_url; this.description = payload.description; this.friendlyName = payload.friendly_name; this.homepageUrl = payload.homepage_url; this.permissions = payload.permissions; this.sid = payload.sid; this.uri = payload.uri; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ConnectAppContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a ConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectAppInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, authorizeRedirectUrl: this.authorizeRedirectUrl, companyName: this.companyName, deauthorizeCallbackMethod: this.deauthorizeCallbackMethod, deauthorizeCallbackUrl: this.deauthorizeCallbackUrl, description: this.description, friendlyName: this.friendlyName, homepageUrl: this.homepageUrl, permissions: this.permissions, sid: this.sid, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConnectAppInstance = ConnectAppInstance; function ConnectAppListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ConnectAppContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/ConnectApps.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConnectAppPage(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 ConnectAppPage(instance._version, payload, 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; } exports.ConnectAppListInstance = ConnectAppListInstance; class ConnectAppPage extends Page_1.default { /** * Initialize the ConnectAppPage * * @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 ConnectAppInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ConnectAppInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConnectAppPage = ConnectAppPage; rest/api/v2010/account/sip.js000064400000005176151677225100011646 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.SipListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const credentialList_1 = require("./sip/credentialList"); const domain_1 = require("./sip/domain"); const ipAccessControlList_1 = require("./sip/ipAccessControlList"); function SipListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/SIP.json`; Object.defineProperty(instance, "credentialLists", { get: function credentialLists() { if (!instance._credentialLists) { instance._credentialLists = (0, credentialList_1.CredentialListListInstance)(instance._version, instance._solution.accountSid); } return instance._credentialLists; }, }); Object.defineProperty(instance, "domains", { get: function domains() { if (!instance._domains) { instance._domains = (0, domain_1.DomainListInstance)(instance._version, instance._solution.accountSid); } return instance._domains; }, }); Object.defineProperty(instance, "ipAccessControlLists", { get: function ipAccessControlLists() { if (!instance._ipAccessControlLists) { instance._ipAccessControlLists = (0, ipAccessControlList_1.IpAccessControlListListInstance)(instance._version, instance._solution.accountSid); } return instance._ipAccessControlLists; }, }); 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; } exports.SipListInstance = SipListInstance; rest/api/v2010/account/newKey.d.ts000064400000005604151677225100012545 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../V2010"; /** * Options to pass to create a NewKeyInstance */ export interface NewKeyListInstanceCreateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; } export interface NewKeySolution { accountSid: string; } export interface NewKeyListInstance { _version: V2010; _solution: NewKeySolution; _uri: string; /** * Create a NewKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NewKeyInstance */ create(callback?: (error: Error | null, item?: NewKeyInstance) => any): Promise<NewKeyInstance>; /** * Create a NewKeyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NewKeyInstance */ create(params: NewKeyListInstanceCreateOptions, callback?: (error: Error | null, item?: NewKeyInstance) => any): Promise<NewKeyInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NewKeyListInstance(version: V2010, accountSid: string): NewKeyListInstance; interface NewKeyResource { sid: string; friendly_name: string; date_created: Date; date_updated: Date; secret: string; } export declare class NewKeyInstance { protected _version: V2010; constructor(_version: V2010, payload: NewKeyResource, accountSid: string); /** * The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API. */ sid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The date and time in GMT that the API Key was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the new API Key was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** */ secret: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; secret: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/incomingPhoneNumber.js000064400000046546151677225100015027 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.IncomingPhoneNumberPage = exports.IncomingPhoneNumberListInstance = exports.IncomingPhoneNumberInstance = exports.IncomingPhoneNumberContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const assignedAddOn_1 = require("./incomingPhoneNumber/assignedAddOn"); const local_1 = require("./incomingPhoneNumber/local"); const mobile_1 = require("./incomingPhoneNumber/mobile"); const tollFree_1 = require("./incomingPhoneNumber/tollFree"); class IncomingPhoneNumberContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/IncomingPhoneNumbers/${sid}.json`; } get assignedAddOns() { this._assignedAddOns = this._assignedAddOns || (0, assignedAddOn_1.AssignedAddOnListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._assignedAddOns; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new IncomingPhoneNumberInstance(operationVersion, payload, instance._solution.accountSid, 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["accountSid"] !== undefined) data["AccountSid"] = params["accountSid"]; if (params["apiVersion"] !== undefined) data["ApiVersion"] = params["apiVersion"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["smsApplicationSid"] !== undefined) data["SmsApplicationSid"] = params["smsApplicationSid"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["voiceApplicationSid"] !== undefined) data["VoiceApplicationSid"] = params["voiceApplicationSid"]; if (params["voiceCallerIdLookup"] !== undefined) data["VoiceCallerIdLookup"] = serialize.bool(params["voiceCallerIdLookup"]); if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["emergencyStatus"] !== undefined) data["EmergencyStatus"] = params["emergencyStatus"]; if (params["emergencyAddressSid"] !== undefined) data["EmergencyAddressSid"] = params["emergencyAddressSid"]; if (params["trunkSid"] !== undefined) data["TrunkSid"] = params["trunkSid"]; if (params["voiceReceiveMode"] !== undefined) data["VoiceReceiveMode"] = params["voiceReceiveMode"]; if (params["identitySid"] !== undefined) data["IdentitySid"] = params["identitySid"]; if (params["addressSid"] !== undefined) data["AddressSid"] = params["addressSid"]; if (params["bundleSid"] !== undefined) data["BundleSid"] = params["bundleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IncomingPhoneNumberInstance(operationVersion, payload, instance._solution.accountSid, 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.IncomingPhoneNumberContextImpl = IncomingPhoneNumberContextImpl; class IncomingPhoneNumberInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.addressSid = payload.address_sid; this.addressRequirements = payload.address_requirements; this.apiVersion = payload.api_version; this.beta = payload.beta; this.capabilities = payload.capabilities; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.identitySid = payload.identity_sid; this.phoneNumber = payload.phone_number; this.origin = payload.origin; this.sid = payload.sid; this.smsApplicationSid = payload.sms_application_sid; this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsUrl = payload.sms_url; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.trunkSid = payload.trunk_sid; this.uri = payload.uri; this.voiceReceiveMode = payload.voice_receive_mode; this.voiceApplicationSid = payload.voice_application_sid; this.voiceCallerIdLookup = payload.voice_caller_id_lookup; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceMethod = payload.voice_method; this.voiceUrl = payload.voice_url; this.emergencyStatus = payload.emergency_status; this.emergencyAddressSid = payload.emergency_address_sid; this.emergencyAddressStatus = payload.emergency_address_status; this.bundleSid = payload.bundle_sid; this.status = payload.status; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new IncomingPhoneNumberContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a IncomingPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a IncomingPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IncomingPhoneNumberInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the assignedAddOns. */ assignedAddOns() { return this._proxy.assignedAddOns; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, addressSid: this.addressSid, addressRequirements: this.addressRequirements, apiVersion: this.apiVersion, beta: this.beta, capabilities: this.capabilities, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, identitySid: this.identitySid, phoneNumber: this.phoneNumber, origin: this.origin, sid: this.sid, smsApplicationSid: this.smsApplicationSid, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsUrl: this.smsUrl, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, trunkSid: this.trunkSid, uri: this.uri, voiceReceiveMode: this.voiceReceiveMode, voiceApplicationSid: this.voiceApplicationSid, voiceCallerIdLookup: this.voiceCallerIdLookup, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceMethod: this.voiceMethod, voiceUrl: this.voiceUrl, emergencyStatus: this.emergencyStatus, emergencyAddressSid: this.emergencyAddressSid, emergencyAddressStatus: this.emergencyAddressStatus, bundleSid: this.bundleSid, status: this.status, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IncomingPhoneNumberInstance = IncomingPhoneNumberInstance; function IncomingPhoneNumberListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new IncomingPhoneNumberContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/IncomingPhoneNumbers.json`; Object.defineProperty(instance, "local", { get: function local() { if (!instance._local) { instance._local = (0, local_1.LocalListInstance)(instance._version, instance._solution.accountSid); } return instance._local; }, }); Object.defineProperty(instance, "mobile", { get: function mobile() { if (!instance._mobile) { instance._mobile = (0, mobile_1.MobileListInstance)(instance._version, instance._solution.accountSid); } return instance._mobile; }, }); Object.defineProperty(instance, "tollFree", { get: function tollFree() { if (!instance._tollFree) { instance._tollFree = (0, tollFree_1.TollFreeListInstance)(instance._version, instance._solution.accountSid); } return instance._tollFree; }, }); instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["apiVersion"] !== undefined) data["ApiVersion"] = params["apiVersion"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["smsApplicationSid"] !== undefined) data["SmsApplicationSid"] = params["smsApplicationSid"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["voiceApplicationSid"] !== undefined) data["VoiceApplicationSid"] = params["voiceApplicationSid"]; if (params["voiceCallerIdLookup"] !== undefined) data["VoiceCallerIdLookup"] = serialize.bool(params["voiceCallerIdLookup"]); if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["emergencyStatus"] !== undefined) data["EmergencyStatus"] = params["emergencyStatus"]; if (params["emergencyAddressSid"] !== undefined) data["EmergencyAddressSid"] = params["emergencyAddressSid"]; if (params["trunkSid"] !== undefined) data["TrunkSid"] = params["trunkSid"]; if (params["identitySid"] !== undefined) data["IdentitySid"] = params["identitySid"]; if (params["addressSid"] !== undefined) data["AddressSid"] = params["addressSid"]; if (params["voiceReceiveMode"] !== undefined) data["VoiceReceiveMode"] = params["voiceReceiveMode"]; if (params["bundleSid"] !== undefined) data["BundleSid"] = params["bundleSid"]; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["areaCode"] !== undefined) data["AreaCode"] = params["areaCode"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IncomingPhoneNumberInstance(operationVersion, payload, instance._solution.accountSid)); 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["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["origin"] !== undefined) data["Origin"] = params["origin"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new IncomingPhoneNumberPage(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 IncomingPhoneNumberPage(instance._version, payload, 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; } exports.IncomingPhoneNumberListInstance = IncomingPhoneNumberListInstance; class IncomingPhoneNumberPage extends Page_1.default { /** * Initialize the IncomingPhoneNumberPage * * @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 IncomingPhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new IncomingPhoneNumberInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IncomingPhoneNumberPage = IncomingPhoneNumberPage; rest/api/v2010/account/notification.js000064400000020614151677225100013533 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.NotificationPage = exports.NotificationListInstance = exports.NotificationInstance = exports.NotificationContextImpl = void 0; 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 NotificationContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Notifications/${sid}.json`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new NotificationInstance(operationVersion, payload, instance._solution.accountSid, 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.NotificationContextImpl = NotificationContextImpl; class NotificationInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.callSid = payload.call_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.errorCode = payload.error_code; this.log = payload.log; this.messageDate = deserialize.rfc2822DateTime(payload.message_date); this.messageText = payload.message_text; this.moreInfo = payload.more_info; this.requestMethod = payload.request_method; this.requestUrl = payload.request_url; this.requestVariables = payload.request_variables; this.responseBody = payload.response_body; this.responseHeaders = payload.response_headers; this.sid = payload.sid; this.uri = payload.uri; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new NotificationContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Fetch a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, callSid: this.callSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, errorCode: this.errorCode, log: this.log, messageDate: this.messageDate, messageText: this.messageText, moreInfo: this.moreInfo, requestMethod: this.requestMethod, requestUrl: this.requestUrl, requestVariables: this.requestVariables, responseBody: this.responseBody, responseHeaders: this.responseHeaders, sid: this.sid, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NotificationInstance = NotificationInstance; function NotificationListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new NotificationContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Notifications.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["log"] !== undefined) data["Log"] = params["log"]; if (params["messageDate"] !== undefined) data["MessageDate"] = serialize.iso8601Date(params["messageDate"]); if (params["messageDateBefore"] !== undefined) data["MessageDate<"] = serialize.iso8601Date(params["messageDateBefore"]); if (params["messageDateAfter"] !== undefined) data["MessageDate>"] = serialize.iso8601Date(params["messageDateAfter"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new NotificationPage(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 NotificationPage(instance._version, payload, 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; } exports.NotificationListInstance = NotificationListInstance; class NotificationPage extends Page_1.default { /** * Initialize the NotificationPage * * @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 NotificationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new NotificationInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NotificationPage = NotificationPage; rest/api/v2010/account/recording/transcription.d.ts000064400000024665151677225100016166 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; export type TranscriptionStatus = "in-progress" | "completed" | "failed"; /** * Options to pass to each */ export interface TranscriptionListInstanceEachOptions { /** 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: TranscriptionInstance, 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 TranscriptionListInstanceOptions { /** 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 TranscriptionListInstancePageOptions { /** 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 TranscriptionContext { /** * Remove a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptionInstance */ fetch(callback?: (error: Error | null, item?: TranscriptionInstance) => any): Promise<TranscriptionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TranscriptionContextSolution { accountSid: string; recordingSid: string; sid: string; } export declare class TranscriptionContextImpl implements TranscriptionContext { protected _version: V2010; protected _solution: TranscriptionContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, recordingSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TranscriptionInstance) => any): Promise<TranscriptionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TranscriptionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TranscriptionPayload extends TwilioResponsePayload { transcriptions: TranscriptionResource[]; } interface TranscriptionResource { account_sid: string; api_version: string; date_created: Date; date_updated: Date; duration: string; price: number; price_unit: string; recording_sid: string; sid: string; status: TranscriptionStatus; transcription_text: string; type: string; uri: string; } export declare class TranscriptionInstance { protected _version: V2010; protected _solution: TranscriptionContextSolution; protected _context?: TranscriptionContext; constructor(_version: V2010, payload: TranscriptionResource, accountSid: string, recordingSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. */ accountSid: string; /** * The API version used to create the transcription. */ apiVersion: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The duration of the transcribed audio in seconds. */ duration: string; /** * The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. */ price: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. */ recordingSid: string; /** * The unique string that that we created to identify the Transcription resource. */ sid: string; status: TranscriptionStatus; /** * The text content of the transcription. */ transcriptionText: string; /** * The transcription type. */ type: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Remove a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptionInstance */ fetch(callback?: (error: Error | null, item?: TranscriptionInstance) => any): Promise<TranscriptionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; dateCreated: Date; dateUpdated: Date; duration: string; price: number; priceUnit: string; recordingSid: string; sid: string; status: TranscriptionStatus; transcriptionText: string; type: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TranscriptionSolution { accountSid: string; recordingSid: string; } export interface TranscriptionListInstance { _version: V2010; _solution: TranscriptionSolution; _uri: string; (sid: string): TranscriptionContext; get(sid: string): TranscriptionContext; /** * Streams TranscriptionInstance 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 { TranscriptionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TranscriptionInstance, done: (err?: Error) => void) => void): void; each(params: TranscriptionListInstanceEachOptions, callback?: (item: TranscriptionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TranscriptionInstance 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: TranscriptionPage) => any): Promise<TranscriptionPage>; /** * Lists TranscriptionInstance 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 { TranscriptionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TranscriptionInstance[]) => any): Promise<TranscriptionInstance[]>; list(params: TranscriptionListInstanceOptions, callback?: (error: Error | null, items: TranscriptionInstance[]) => any): Promise<TranscriptionInstance[]>; /** * Retrieve a single page of TranscriptionInstance 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 { TranscriptionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TranscriptionPage) => any): Promise<TranscriptionPage>; page(params: TranscriptionListInstancePageOptions, callback?: (error: Error | null, items: TranscriptionPage) => any): Promise<TranscriptionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TranscriptionListInstance(version: V2010, accountSid: string, recordingSid: string): TranscriptionListInstance; export declare class TranscriptionPage extends Page<V2010, TranscriptionPayload, TranscriptionResource, TranscriptionInstance> { /** * Initialize the TranscriptionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: TranscriptionSolution); /** * Build an instance of TranscriptionInstance * * @param payload - Payload response from the API */ getInstance(payload: TranscriptionResource): TranscriptionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/recording/addOnResult.js000064400000021552151677225100015247 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AddOnResultPage = exports.AddOnResultListInstance = exports.AddOnResultInstance = exports.AddOnResultContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const payload_1 = require("./addOnResult/payload"); class AddOnResultContextImpl { constructor(_version, accountSid, referenceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(referenceSid)) { throw new Error("Parameter 'referenceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, referenceSid, sid }; this._uri = `/Accounts/${accountSid}/Recordings/${referenceSid}/AddOnResults/${sid}.json`; } get payloads() { this._payloads = this._payloads || (0, payload_1.PayloadListInstance)(this._version, this._solution.accountSid, this._solution.referenceSid, this._solution.sid); return this._payloads; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AddOnResultInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.referenceSid, 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.AddOnResultContextImpl = AddOnResultContextImpl; class AddOnResultInstance { constructor(_version, payload, accountSid, referenceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.status = payload.status; this.addOnSid = payload.add_on_sid; this.addOnConfigurationSid = payload.add_on_configuration_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.dateCompleted = deserialize.rfc2822DateTime(payload.date_completed); this.referenceSid = payload.reference_sid; this.subresourceUris = payload.subresource_uris; this._solution = { accountSid, referenceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AddOnResultContextImpl(this._version, this._solution.accountSid, this._solution.referenceSid, this._solution.sid); return this._context; } /** * Remove a AddOnResultInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AddOnResultInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddOnResultInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the payloads. */ payloads() { return this._proxy.payloads; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, status: this.status, addOnSid: this.addOnSid, addOnConfigurationSid: this.addOnConfigurationSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, dateCompleted: this.dateCompleted, referenceSid: this.referenceSid, subresourceUris: this.subresourceUris, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AddOnResultInstance = AddOnResultInstance; function AddOnResultListInstance(version, accountSid, referenceSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(referenceSid)) { throw new Error("Parameter 'referenceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AddOnResultContextImpl(version, accountSid, referenceSid, sid); }; instance._version = version; instance._solution = { accountSid, referenceSid }; instance._uri = `/Accounts/${accountSid}/Recordings/${referenceSid}/AddOnResults.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AddOnResultPage(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 AddOnResultPage(instance._version, payload, 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; } exports.AddOnResultListInstance = AddOnResultListInstance; class AddOnResultPage extends Page_1.default { /** * Initialize the AddOnResultPage * * @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 AddOnResultInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AddOnResultInstance(this._version, payload, this._solution.accountSid, this._solution.referenceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AddOnResultPage = AddOnResultPage; rest/api/v2010/account/recording/addOnResult/payload.js000064400000022011151677225100016667 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.PayloadPage = exports.PayloadListInstance = exports.PayloadInstance = exports.PayloadContextImpl = void 0; 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 PayloadContextImpl { constructor(_version, accountSid, referenceSid, addOnResultSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(referenceSid)) { throw new Error("Parameter 'referenceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(addOnResultSid)) { throw new Error("Parameter 'addOnResultSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, referenceSid, addOnResultSid, sid }; this._uri = `/Accounts/${accountSid}/Recordings/${referenceSid}/AddOnResults/${addOnResultSid}/Payloads/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PayloadInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.referenceSid, instance._solution.addOnResultSid, 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.PayloadContextImpl = PayloadContextImpl; class PayloadInstance { constructor(_version, payload, accountSid, referenceSid, addOnResultSid, sid) { this._version = _version; this.sid = payload.sid; this.addOnResultSid = payload.add_on_result_sid; this.accountSid = payload.account_sid; this.label = payload.label; this.addOnSid = payload.add_on_sid; this.addOnConfigurationSid = payload.add_on_configuration_sid; this.contentType = payload.content_type; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.referenceSid = payload.reference_sid; this.subresourceUris = payload.subresource_uris; this._solution = { accountSid, referenceSid, addOnResultSid, sid: sid || this.sid, }; } get _proxy() { this._context = this._context || new PayloadContextImpl(this._version, this._solution.accountSid, this._solution.referenceSid, this._solution.addOnResultSid, this._solution.sid); return this._context; } /** * Remove a PayloadInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a PayloadInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PayloadInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, addOnResultSid: this.addOnResultSid, accountSid: this.accountSid, label: this.label, addOnSid: this.addOnSid, addOnConfigurationSid: this.addOnConfigurationSid, contentType: this.contentType, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, referenceSid: this.referenceSid, subresourceUris: this.subresourceUris, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PayloadInstance = PayloadInstance; function PayloadListInstance(version, accountSid, referenceSid, addOnResultSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(referenceSid)) { throw new Error("Parameter 'referenceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(addOnResultSid)) { throw new Error("Parameter 'addOnResultSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PayloadContextImpl(version, accountSid, referenceSid, addOnResultSid, sid); }; instance._version = version; instance._solution = { accountSid, referenceSid, addOnResultSid }; instance._uri = `/Accounts/${accountSid}/Recordings/${referenceSid}/AddOnResults/${addOnResultSid}/Payloads.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PayloadPage(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 PayloadPage(instance._version, payload, 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; } exports.PayloadListInstance = PayloadListInstance; class PayloadPage extends Page_1.default { /** * Initialize the PayloadPage * * @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 PayloadInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PayloadInstance(this._version, payload, this._solution.accountSid, this._solution.referenceSid, this._solution.addOnResultSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PayloadPage = PayloadPage; rest/api/v2010/account/recording/addOnResult/payload.d.ts000064400000023454151677225100017137 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; /** * Options to pass to each */ export interface PayloadListInstanceEachOptions { /** 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: PayloadInstance, 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 PayloadListInstanceOptions { /** 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 PayloadListInstancePageOptions { /** 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 PayloadContext { /** * Remove a PayloadInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PayloadInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PayloadInstance */ fetch(callback?: (error: Error | null, item?: PayloadInstance) => any): Promise<PayloadInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PayloadContextSolution { accountSid: string; referenceSid: string; addOnResultSid: string; sid: string; } export declare class PayloadContextImpl implements PayloadContext { protected _version: V2010; protected _solution: PayloadContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, referenceSid: string, addOnResultSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: PayloadInstance) => any): Promise<PayloadInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PayloadContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PayloadPayload extends TwilioResponsePayload { payloads: PayloadResource[]; } interface PayloadResource { sid: string; add_on_result_sid: string; account_sid: string; label: string; add_on_sid: string; add_on_configuration_sid: string; content_type: string; date_created: Date; date_updated: Date; reference_sid: string; subresource_uris: Record<string, string>; } export declare class PayloadInstance { protected _version: V2010; protected _solution: PayloadContextSolution; protected _context?: PayloadContext; constructor(_version: V2010, payload: PayloadResource, accountSid: string, referenceSid: string, addOnResultSid: string, sid?: string); /** * The unique string that that we created to identify the Recording AddOnResult Payload resource. */ sid: string; /** * The SID of the AddOnResult to which the payload belongs. */ addOnResultSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resource. */ accountSid: string; /** * The string provided by the vendor that describes the payload. */ label: string; /** * The SID of the Add-on to which the result belongs. */ addOnSid: string; /** * The SID of the Add-on configuration. */ addOnConfigurationSid: string; /** * The MIME type of the payload. */ contentType: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The SID of the recording to which the AddOnResult resource that contains the payload belongs. */ referenceSid: string; /** * A list of related resources identified by their relative URIs. */ subresourceUris: Record<string, string>; private get _proxy(); /** * Remove a PayloadInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PayloadInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PayloadInstance */ fetch(callback?: (error: Error | null, item?: PayloadInstance) => any): Promise<PayloadInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; addOnResultSid: string; accountSid: string; label: string; addOnSid: string; addOnConfigurationSid: string; contentType: string; dateCreated: Date; dateUpdated: Date; referenceSid: string; subresourceUris: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PayloadSolution { accountSid: string; referenceSid: string; addOnResultSid: string; } export interface PayloadListInstance { _version: V2010; _solution: PayloadSolution; _uri: string; (sid: string): PayloadContext; get(sid: string): PayloadContext; /** * Streams PayloadInstance 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 { PayloadListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PayloadInstance, done: (err?: Error) => void) => void): void; each(params: PayloadListInstanceEachOptions, callback?: (item: PayloadInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PayloadInstance 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: PayloadPage) => any): Promise<PayloadPage>; /** * Lists PayloadInstance 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 { PayloadListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PayloadInstance[]) => any): Promise<PayloadInstance[]>; list(params: PayloadListInstanceOptions, callback?: (error: Error | null, items: PayloadInstance[]) => any): Promise<PayloadInstance[]>; /** * Retrieve a single page of PayloadInstance 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 { PayloadListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PayloadPage) => any): Promise<PayloadPage>; page(params: PayloadListInstancePageOptions, callback?: (error: Error | null, items: PayloadPage) => any): Promise<PayloadPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PayloadListInstance(version: V2010, accountSid: string, referenceSid: string, addOnResultSid: string): PayloadListInstance; export declare class PayloadPage extends Page<V2010, PayloadPayload, PayloadResource, PayloadInstance> { /** * Initialize the PayloadPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: PayloadSolution); /** * Build an instance of PayloadInstance * * @param payload - Payload response from the API */ getInstance(payload: PayloadResource): PayloadInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/recording/transcription.js000064400000021160151677225100015715 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.TranscriptionPage = exports.TranscriptionListInstance = exports.TranscriptionInstance = exports.TranscriptionContextImpl = void 0; 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 TranscriptionContextImpl { constructor(_version, accountSid, recordingSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(recordingSid)) { throw new Error("Parameter 'recordingSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, recordingSid, sid }; this._uri = `/Accounts/${accountSid}/Recordings/${recordingSid}/Transcriptions/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TranscriptionInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.recordingSid, 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.TranscriptionContextImpl = TranscriptionContextImpl; class TranscriptionInstance { constructor(_version, payload, accountSid, recordingSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.duration = payload.duration; this.price = payload.price; this.priceUnit = payload.price_unit; this.recordingSid = payload.recording_sid; this.sid = payload.sid; this.status = payload.status; this.transcriptionText = payload.transcription_text; this.type = payload.type; this.uri = payload.uri; this._solution = { accountSid, recordingSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TranscriptionContextImpl(this._version, this._solution.accountSid, this._solution.recordingSid, this._solution.sid); return this._context; } /** * Remove a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, duration: this.duration, price: this.price, priceUnit: this.priceUnit, recordingSid: this.recordingSid, sid: this.sid, status: this.status, transcriptionText: this.transcriptionText, type: this.type, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TranscriptionInstance = TranscriptionInstance; function TranscriptionListInstance(version, accountSid, recordingSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(recordingSid)) { throw new Error("Parameter 'recordingSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TranscriptionContextImpl(version, accountSid, recordingSid, sid); }; instance._version = version; instance._solution = { accountSid, recordingSid }; instance._uri = `/Accounts/${accountSid}/Recordings/${recordingSid}/Transcriptions.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TranscriptionPage(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 TranscriptionPage(instance._version, payload, 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; } exports.TranscriptionListInstance = TranscriptionListInstance; class TranscriptionPage extends Page_1.default { /** * Initialize the TranscriptionPage * * @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 TranscriptionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TranscriptionInstance(this._version, payload, this._solution.accountSid, this._solution.recordingSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TranscriptionPage = TranscriptionPage; rest/api/v2010/account/recording/addOnResult.d.ts000064400000024233151677225100015502 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PayloadListInstance } from "./addOnResult/payload"; export type AddOnResultStatus = "canceled" | "completed" | "deleted" | "failed" | "in-progress" | "init" | "processing" | "queued"; /** * Options to pass to each */ export interface AddOnResultListInstanceEachOptions { /** 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: AddOnResultInstance, 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 AddOnResultListInstanceOptions { /** 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 AddOnResultListInstancePageOptions { /** 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 AddOnResultContext { payloads: PayloadListInstance; /** * Remove a AddOnResultInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AddOnResultInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddOnResultInstance */ fetch(callback?: (error: Error | null, item?: AddOnResultInstance) => any): Promise<AddOnResultInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AddOnResultContextSolution { accountSid: string; referenceSid: string; sid: string; } export declare class AddOnResultContextImpl implements AddOnResultContext { protected _version: V2010; protected _solution: AddOnResultContextSolution; protected _uri: string; protected _payloads?: PayloadListInstance; constructor(_version: V2010, accountSid: string, referenceSid: string, sid: string); get payloads(): PayloadListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AddOnResultInstance) => any): Promise<AddOnResultInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AddOnResultContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AddOnResultPayload extends TwilioResponsePayload { add_on_results: AddOnResultResource[]; } interface AddOnResultResource { sid: string; account_sid: string; status: AddOnResultStatus; add_on_sid: string; add_on_configuration_sid: string; date_created: Date; date_updated: Date; date_completed: Date; reference_sid: string; subresource_uris: Record<string, string>; } export declare class AddOnResultInstance { protected _version: V2010; protected _solution: AddOnResultContextSolution; protected _context?: AddOnResultContext; constructor(_version: V2010, payload: AddOnResultResource, accountSid: string, referenceSid: string, sid?: string); /** * The unique string that that we created to identify the Recording AddOnResult resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resource. */ accountSid: string; status: AddOnResultStatus; /** * The SID of the Add-on to which the result belongs. */ addOnSid: string; /** * The SID of the Add-on configuration. */ addOnConfigurationSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The date and time in GMT that the result was completed specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCompleted: Date; /** * The SID of the recording to which the AddOnResult resource belongs. */ referenceSid: string; /** * A list of related resources identified by their relative URIs. */ subresourceUris: Record<string, string>; private get _proxy(); /** * Remove a AddOnResultInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AddOnResultInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddOnResultInstance */ fetch(callback?: (error: Error | null, item?: AddOnResultInstance) => any): Promise<AddOnResultInstance>; /** * Access the payloads. */ payloads(): PayloadListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; status: AddOnResultStatus; addOnSid: string; addOnConfigurationSid: string; dateCreated: Date; dateUpdated: Date; dateCompleted: Date; referenceSid: string; subresourceUris: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AddOnResultSolution { accountSid: string; referenceSid: string; } export interface AddOnResultListInstance { _version: V2010; _solution: AddOnResultSolution; _uri: string; (sid: string): AddOnResultContext; get(sid: string): AddOnResultContext; /** * Streams AddOnResultInstance 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 { AddOnResultListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AddOnResultInstance, done: (err?: Error) => void) => void): void; each(params: AddOnResultListInstanceEachOptions, callback?: (item: AddOnResultInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AddOnResultInstance 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: AddOnResultPage) => any): Promise<AddOnResultPage>; /** * Lists AddOnResultInstance 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 { AddOnResultListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AddOnResultInstance[]) => any): Promise<AddOnResultInstance[]>; list(params: AddOnResultListInstanceOptions, callback?: (error: Error | null, items: AddOnResultInstance[]) => any): Promise<AddOnResultInstance[]>; /** * Retrieve a single page of AddOnResultInstance 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 { AddOnResultListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AddOnResultPage) => any): Promise<AddOnResultPage>; page(params: AddOnResultListInstancePageOptions, callback?: (error: Error | null, items: AddOnResultPage) => any): Promise<AddOnResultPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AddOnResultListInstance(version: V2010, accountSid: string, referenceSid: string): AddOnResultListInstance; export declare class AddOnResultPage extends Page<V2010, AddOnResultPayload, AddOnResultResource, AddOnResultInstance> { /** * Initialize the AddOnResultPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AddOnResultSolution); /** * Build an instance of AddOnResultInstance * * @param payload - Payload response from the API */ getInstance(payload: AddOnResultResource): AddOnResultInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/connectApp.d.ts000064400000030600151677225100013367 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; export type ConnectAppPermission = "get-all" | "post-all"; /** * Options to pass to update a ConnectAppInstance */ export interface ConnectAppContextUpdateOptions { /** The URL to redirect the user to after we authenticate the user and obtain authorization to access the Connect App. */ authorizeRedirectUrl?: string; /** The company name to set for the Connect App. */ companyName?: string; /** The HTTP method to use when calling `deauthorize_callback_url`. */ deauthorizeCallbackMethod?: string; /** The URL to call using the `deauthorize_callback_method` to de-authorize the Connect App. */ deauthorizeCallbackUrl?: string; /** A description of the Connect App. */ description?: string; /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** A public URL where users can obtain more information about this Connect App. */ homepageUrl?: string; /** A comma-separated list of the permissions you will request from the users of this ConnectApp. Can include: `get-all` and `post-all`. */ permissions?: Array<ConnectAppPermission>; } /** * Options to pass to each */ export interface ConnectAppListInstanceEachOptions { /** 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: ConnectAppInstance, 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 ConnectAppListInstanceOptions { /** 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 ConnectAppListInstancePageOptions { /** 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 ConnectAppContext { /** * Remove a ConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectAppInstance */ fetch(callback?: (error: Error | null, item?: ConnectAppInstance) => any): Promise<ConnectAppInstance>; /** * Update a ConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectAppInstance */ update(callback?: (error: Error | null, item?: ConnectAppInstance) => any): Promise<ConnectAppInstance>; /** * Update a ConnectAppInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectAppInstance */ update(params: ConnectAppContextUpdateOptions, callback?: (error: Error | null, item?: ConnectAppInstance) => any): Promise<ConnectAppInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConnectAppContextSolution { accountSid: string; sid: string; } export declare class ConnectAppContextImpl implements ConnectAppContext { protected _version: V2010; protected _solution: ConnectAppContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ConnectAppInstance) => any): Promise<ConnectAppInstance>; update(params?: ConnectAppContextUpdateOptions | ((error: Error | null, item?: ConnectAppInstance) => any), callback?: (error: Error | null, item?: ConnectAppInstance) => any): Promise<ConnectAppInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConnectAppContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConnectAppPayload extends TwilioResponsePayload { connect_apps: ConnectAppResource[]; } interface ConnectAppResource { account_sid: string; authorize_redirect_url: string; company_name: string; deauthorize_callback_method: string; deauthorize_callback_url: string; description: string; friendly_name: string; homepage_url: string; permissions: Array<ConnectAppPermission>; sid: string; uri: string; } export declare class ConnectAppInstance { protected _version: V2010; protected _solution: ConnectAppContextSolution; protected _context?: ConnectAppContext; constructor(_version: V2010, payload: ConnectAppResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resource. */ accountSid: string; /** * The URL we redirect the user to after we authenticate the user and obtain authorization to access the Connect App. */ authorizeRedirectUrl: string; /** * The company name set for the Connect App. */ companyName: string; /** * The HTTP method we use to call `deauthorize_callback_url`. */ deauthorizeCallbackMethod: string; /** * The URL we call using the `deauthorize_callback_method` to de-authorize the Connect App. */ deauthorizeCallbackUrl: string; /** * The description of the Connect App. */ description: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The public URL where users can obtain more information about this Connect App. */ homepageUrl: string; /** * The set of permissions that your ConnectApp requests. */ permissions: Array<ConnectAppPermission>; /** * The unique string that that we created to identify the ConnectApp resource. */ sid: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Remove a ConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectAppInstance */ fetch(callback?: (error: Error | null, item?: ConnectAppInstance) => any): Promise<ConnectAppInstance>; /** * Update a ConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectAppInstance */ update(callback?: (error: Error | null, item?: ConnectAppInstance) => any): Promise<ConnectAppInstance>; /** * Update a ConnectAppInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConnectAppInstance */ update(params: ConnectAppContextUpdateOptions, callback?: (error: Error | null, item?: ConnectAppInstance) => any): Promise<ConnectAppInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; authorizeRedirectUrl: string; companyName: string; deauthorizeCallbackMethod: string; deauthorizeCallbackUrl: string; description: string; friendlyName: string; homepageUrl: string; permissions: ConnectAppPermission[]; sid: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConnectAppSolution { accountSid: string; } export interface ConnectAppListInstance { _version: V2010; _solution: ConnectAppSolution; _uri: string; (sid: string): ConnectAppContext; get(sid: string): ConnectAppContext; /** * Streams ConnectAppInstance 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 { ConnectAppListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ConnectAppInstance, done: (err?: Error) => void) => void): void; each(params: ConnectAppListInstanceEachOptions, callback?: (item: ConnectAppInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ConnectAppInstance 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: ConnectAppPage) => any): Promise<ConnectAppPage>; /** * Lists ConnectAppInstance 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 { ConnectAppListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ConnectAppInstance[]) => any): Promise<ConnectAppInstance[]>; list(params: ConnectAppListInstanceOptions, callback?: (error: Error | null, items: ConnectAppInstance[]) => any): Promise<ConnectAppInstance[]>; /** * Retrieve a single page of ConnectAppInstance 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 { ConnectAppListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ConnectAppPage) => any): Promise<ConnectAppPage>; page(params: ConnectAppListInstancePageOptions, callback?: (error: Error | null, items: ConnectAppPage) => any): Promise<ConnectAppPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConnectAppListInstance(version: V2010, accountSid: string): ConnectAppListInstance; export declare class ConnectAppPage extends Page<V2010, ConnectAppPayload, ConnectAppResource, ConnectAppInstance> { /** * Initialize the ConnectAppPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: ConnectAppSolution); /** * Build an instance of ConnectAppInstance * * @param payload - Payload response from the API */ getInstance(payload: ConnectAppResource): ConnectAppInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/availablePhoneNumberCountry.js000064400000024223151677225100016514 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AvailablePhoneNumberCountryPage = exports.AvailablePhoneNumberCountryListInstance = exports.AvailablePhoneNumberCountryInstance = exports.AvailablePhoneNumberCountryContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const local_1 = require("./availablePhoneNumberCountry/local"); const machineToMachine_1 = require("./availablePhoneNumberCountry/machineToMachine"); const mobile_1 = require("./availablePhoneNumberCountry/mobile"); const national_1 = require("./availablePhoneNumberCountry/national"); const sharedCost_1 = require("./availablePhoneNumberCountry/sharedCost"); const tollFree_1 = require("./availablePhoneNumberCountry/tollFree"); const voip_1 = require("./availablePhoneNumberCountry/voip"); class AvailablePhoneNumberCountryContextImpl { constructor(_version, accountSid, countryCode) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(countryCode)) { throw new Error("Parameter 'countryCode' is not valid."); } this._solution = { accountSid, countryCode }; this._uri = `/Accounts/${accountSid}/AvailablePhoneNumbers/${countryCode}.json`; } get local() { this._local = this._local || (0, local_1.LocalListInstance)(this._version, this._solution.accountSid, this._solution.countryCode); return this._local; } get machineToMachine() { this._machineToMachine = this._machineToMachine || (0, machineToMachine_1.MachineToMachineListInstance)(this._version, this._solution.accountSid, this._solution.countryCode); return this._machineToMachine; } get mobile() { this._mobile = this._mobile || (0, mobile_1.MobileListInstance)(this._version, this._solution.accountSid, this._solution.countryCode); return this._mobile; } get national() { this._national = this._national || (0, national_1.NationalListInstance)(this._version, this._solution.accountSid, this._solution.countryCode); return this._national; } get sharedCost() { this._sharedCost = this._sharedCost || (0, sharedCost_1.SharedCostListInstance)(this._version, this._solution.accountSid, this._solution.countryCode); return this._sharedCost; } get tollFree() { this._tollFree = this._tollFree || (0, tollFree_1.TollFreeListInstance)(this._version, this._solution.accountSid, this._solution.countryCode); return this._tollFree; } get voip() { this._voip = this._voip || (0, voip_1.VoipListInstance)(this._version, this._solution.accountSid, this._solution.countryCode); return this._voip; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AvailablePhoneNumberCountryInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.countryCode)); 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.AvailablePhoneNumberCountryContextImpl = AvailablePhoneNumberCountryContextImpl; class AvailablePhoneNumberCountryInstance { constructor(_version, payload, accountSid, countryCode) { this._version = _version; this.countryCode = payload.country_code; this.country = payload.country; this.uri = payload.uri; this.beta = payload.beta; this.subresourceUris = payload.subresource_uris; this._solution = { accountSid, countryCode: countryCode || this.countryCode, }; } get _proxy() { this._context = this._context || new AvailablePhoneNumberCountryContextImpl(this._version, this._solution.accountSid, this._solution.countryCode); return this._context; } /** * Fetch a AvailablePhoneNumberCountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailablePhoneNumberCountryInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the local. */ local() { return this._proxy.local; } /** * Access the machineToMachine. */ machineToMachine() { return this._proxy.machineToMachine; } /** * Access the mobile. */ mobile() { return this._proxy.mobile; } /** * Access the national. */ national() { return this._proxy.national; } /** * Access the sharedCost. */ sharedCost() { return this._proxy.sharedCost; } /** * Access the tollFree. */ tollFree() { return this._proxy.tollFree; } /** * Access the voip. */ voip() { return this._proxy.voip; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { countryCode: this.countryCode, country: this.country, uri: this.uri, beta: this.beta, subresourceUris: this.subresourceUris, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailablePhoneNumberCountryInstance = AvailablePhoneNumberCountryInstance; function AvailablePhoneNumberCountryListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((countryCode) => instance.get(countryCode)); instance.get = function get(countryCode) { return new AvailablePhoneNumberCountryContextImpl(version, accountSid, countryCode); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/AvailablePhoneNumbers.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AvailablePhoneNumberCountryPage(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 AvailablePhoneNumberCountryPage(instance._version, payload, 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; } exports.AvailablePhoneNumberCountryListInstance = AvailablePhoneNumberCountryListInstance; class AvailablePhoneNumberCountryPage extends Page_1.default { /** * Initialize the AvailablePhoneNumberCountryPage * * @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 AvailablePhoneNumberCountryInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AvailablePhoneNumberCountryInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AvailablePhoneNumberCountryPage = AvailablePhoneNumberCountryPage; rest/api/v2010/account/shortCode.d.ts000064400000030715151677225100013236 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; /** * Options to pass to update a ShortCodeInstance */ export interface ShortCodeContextUpdateOptions { /** A descriptive string that you created to describe this resource. It can be up to 64 characters long. By default, the `FriendlyName` is the short code. */ friendlyName?: string; /** The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. */ apiVersion?: string; /** The URL we should call when receiving an incoming SMS message to this short code. */ smsUrl?: string; /** The HTTP method we should use when calling the `sms_url`. Can be: `GET` or `POST`. */ smsMethod?: string; /** The URL that we should call if an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl?: string; /** The HTTP method that we should use to call the `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod?: string; } /** * Options to pass to each */ export interface ShortCodeListInstanceEachOptions { /** The string that identifies the ShortCode resources to read. */ friendlyName?: string; /** Only show the ShortCode resources that match this pattern. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ shortCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ShortCodeInstance, 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 ShortCodeListInstanceOptions { /** The string that identifies the ShortCode resources to read. */ friendlyName?: string; /** Only show the ShortCode resources that match this pattern. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ shortCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ShortCodeListInstancePageOptions { /** The string that identifies the ShortCode resources to read. */ friendlyName?: string; /** Only show the ShortCode resources that match this pattern. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ shortCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ShortCodeContext { /** * Fetch a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Update a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ update(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Update a ShortCodeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ update(params: ShortCodeContextUpdateOptions, callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ShortCodeContextSolution { accountSid: string; sid: string; } export declare class ShortCodeContextImpl implements ShortCodeContext { protected _version: V2010; protected _solution: ShortCodeContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, sid: string); fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; update(params?: ShortCodeContextUpdateOptions | ((error: Error | null, item?: ShortCodeInstance) => any), callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ShortCodeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ShortCodePayload extends TwilioResponsePayload { short_codes: ShortCodeResource[]; } interface ShortCodeResource { account_sid: string; api_version: string; date_created: Date; date_updated: Date; friendly_name: string; short_code: string; sid: string; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_url: string; uri: string; } export declare class ShortCodeInstance { protected _version: V2010; protected _solution: ShortCodeContextSolution; protected _context?: ShortCodeContext; constructor(_version: V2010, payload: ShortCodeResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this ShortCode resource. */ accountSid: string; /** * The API version used to start a new TwiML session when an SMS message is sent to this short code. */ apiVersion: string; /** * The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * A string that you assigned to describe this resource. By default, the `FriendlyName` is the short code. */ friendlyName: string; /** * The short code. e.g., 894546. */ shortCode: string; /** * The unique string that that we created to identify this ShortCode resource. */ sid: string; /** * The HTTP method we use to call the `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod: string; /** * The URL that we call if an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl: string; /** * The HTTP method we use to call the `sms_url`. Can be: `GET` or `POST`. */ smsMethod: string; /** * The URL we call when receiving an incoming SMS message to this short code. */ smsUrl: string; /** * The URI of this resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Fetch a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Update a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ update(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Update a ShortCodeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ update(params: ShortCodeContextUpdateOptions, callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; shortCode: string; sid: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ShortCodeSolution { accountSid: string; } export interface ShortCodeListInstance { _version: V2010; _solution: ShortCodeSolution; _uri: string; (sid: string): ShortCodeContext; get(sid: string): ShortCodeContext; /** * Streams ShortCodeInstance 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 { ShortCodeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void; each(params: ShortCodeListInstanceEachOptions, callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ShortCodeInstance 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: ShortCodePage) => any): Promise<ShortCodePage>; /** * Lists ShortCodeInstance 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 { ShortCodeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ShortCodeInstance[]) => any): Promise<ShortCodeInstance[]>; list(params: ShortCodeListInstanceOptions, callback?: (error: Error | null, items: ShortCodeInstance[]) => any): Promise<ShortCodeInstance[]>; /** * Retrieve a single page of ShortCodeInstance 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 { ShortCodeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ShortCodePage) => any): Promise<ShortCodePage>; page(params: ShortCodeListInstancePageOptions, callback?: (error: Error | null, items: ShortCodePage) => any): Promise<ShortCodePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ShortCodeListInstance(version: V2010, accountSid: string): ShortCodeListInstance; export declare class ShortCodePage extends Page<V2010, ShortCodePayload, ShortCodeResource, ShortCodeInstance> { /** * Initialize the ShortCodePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: ShortCodeSolution); /** * Build an instance of ShortCodeInstance * * @param payload - Payload response from the API */ getInstance(payload: ShortCodeResource): ShortCodeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/conference.d.ts000064400000052741151677225100013416 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; import { ParticipantListInstance } from "./conference/participant"; import { RecordingListInstance } from "./conference/recording"; export type ConferenceReasonConferenceEnded = "conference-ended-via-api" | "participant-with-end-conference-on-exit-left" | "participant-with-end-conference-on-exit-kicked" | "last-participant-kicked" | "last-participant-left"; export type ConferenceStatus = "init" | "in-progress" | "completed"; export type ConferenceUpdateStatus = "completed"; /** * Options to pass to update a ConferenceInstance */ export interface ConferenceContextUpdateOptions { /** */ status?: ConferenceUpdateStatus; /** The URL we should call to announce something into the conference. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs. */ announceUrl?: string; /** The HTTP method used to call `announce_url`. Can be: `GET` or `POST` and the default is `POST` */ announceMethod?: string; } /** * Options to pass to each */ export interface ConferenceListInstanceEachOptions { /** Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. */ dateCreated?: Date; /** Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. */ dateCreatedBefore?: Date; /** Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. */ dateCreatedAfter?: Date; /** Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. */ dateUpdated?: Date; /** Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. */ dateUpdatedBefore?: Date; /** Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. */ dateUpdatedAfter?: Date; /** The string that identifies the Conference resources to read. */ friendlyName?: string; /** The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. */ status?: ConferenceStatus; /** 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: ConferenceInstance, 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 ConferenceListInstanceOptions { /** Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. */ dateCreated?: Date; /** Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. */ dateCreatedBefore?: Date; /** Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. */ dateCreatedAfter?: Date; /** Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. */ dateUpdated?: Date; /** Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. */ dateUpdatedBefore?: Date; /** Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. */ dateUpdatedAfter?: Date; /** The string that identifies the Conference resources to read. */ friendlyName?: string; /** The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. */ status?: ConferenceStatus; /** 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 ConferenceListInstancePageOptions { /** Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. */ dateCreated?: Date; /** Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. */ dateCreatedBefore?: Date; /** Only include conferences that were created on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read conferences that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read conferences that were created on or after midnight of this date. */ dateCreatedAfter?: Date; /** Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. */ dateUpdated?: Date; /** Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. */ dateUpdatedBefore?: Date; /** Only include conferences that were last updated on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only conferences that were last updated on this date. You can also specify an inequality, such as `DateUpdated<=YYYY-MM-DD`, to read conferences that were last updated on or before midnight of this date, and `DateUpdated>=YYYY-MM-DD` to read conferences that were last updated on or after midnight of this date. */ dateUpdatedAfter?: Date; /** The string that identifies the Conference resources to read. */ friendlyName?: string; /** The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. */ status?: ConferenceStatus; /** 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 ConferenceContext { participants: ParticipantListInstance; recordings: RecordingListInstance; /** * Fetch a ConferenceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ fetch(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Update a ConferenceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ update(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Update a ConferenceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ update(params: ConferenceContextUpdateOptions, callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConferenceContextSolution { accountSid: string; sid: string; } export declare class ConferenceContextImpl implements ConferenceContext { protected _version: V2010; protected _solution: ConferenceContextSolution; protected _uri: string; protected _participants?: ParticipantListInstance; protected _recordings?: RecordingListInstance; constructor(_version: V2010, accountSid: string, sid: string); get participants(): ParticipantListInstance; get recordings(): RecordingListInstance; fetch(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; update(params?: ConferenceContextUpdateOptions | ((error: Error | null, item?: ConferenceInstance) => any), callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConferenceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConferencePayload extends TwilioResponsePayload { conferences: ConferenceResource[]; } interface ConferenceResource { account_sid: string; date_created: Date; date_updated: Date; api_version: string; friendly_name: string; region: string; sid: string; status: ConferenceStatus; uri: string; subresource_uris: Record<string, string>; reason_conference_ended: ConferenceReasonConferenceEnded; call_sid_ending_conference: string; } export declare class ConferenceInstance { protected _version: V2010; protected _solution: ConferenceContextSolution; protected _context?: ConferenceContext; constructor(_version: V2010, payload: ConferenceResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Conference resource. */ accountSid: string; /** * The date and time in UTC that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in UTC that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The API version used to create this conference. */ apiVersion: string; /** * A string that you assigned to describe this conference room. Maximum length is 128 characters. */ friendlyName: string; /** * A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants. */ region: string; /** * The unique, Twilio-provided string used to identify this Conference resource. */ sid: string; status: ConferenceStatus; /** * The URI of this resource, relative to `https://api.twilio.com`. */ uri: string; /** * A list of related resources identified by their URIs relative to `https://api.twilio.com`. */ subresourceUris: Record<string, string>; reasonConferenceEnded: ConferenceReasonConferenceEnded; /** * The call SID that caused the conference to end. */ callSidEndingConference: string; private get _proxy(); /** * Fetch a ConferenceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ fetch(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Update a ConferenceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ update(callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Update a ConferenceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ update(params: ConferenceContextUpdateOptions, callback?: (error: Error | null, item?: ConferenceInstance) => any): Promise<ConferenceInstance>; /** * Access the participants. */ participants(): ParticipantListInstance; /** * Access the recordings. */ recordings(): RecordingListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; apiVersion: string; friendlyName: string; region: string; sid: string; status: ConferenceStatus; uri: string; subresourceUris: Record<string, string>; reasonConferenceEnded: ConferenceReasonConferenceEnded; callSidEndingConference: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConferenceSolution { accountSid: string; } export interface ConferenceListInstance { _version: V2010; _solution: ConferenceSolution; _uri: string; (sid: string): ConferenceContext; get(sid: string): ConferenceContext; /** * Streams ConferenceInstance 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 { ConferenceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ConferenceInstance, done: (err?: Error) => void) => void): void; each(params: ConferenceListInstanceEachOptions, callback?: (item: ConferenceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ConferenceInstance 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: ConferencePage) => any): Promise<ConferencePage>; /** * Lists ConferenceInstance 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 { ConferenceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ConferenceInstance[]) => any): Promise<ConferenceInstance[]>; list(params: ConferenceListInstanceOptions, callback?: (error: Error | null, items: ConferenceInstance[]) => any): Promise<ConferenceInstance[]>; /** * Retrieve a single page of ConferenceInstance 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 { ConferenceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ConferencePage) => any): Promise<ConferencePage>; page(params: ConferenceListInstancePageOptions, callback?: (error: Error | null, items: ConferencePage) => any): Promise<ConferencePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConferenceListInstance(version: V2010, accountSid: string): ConferenceListInstance; export declare class ConferencePage extends Page<V2010, ConferencePayload, ConferenceResource, ConferenceInstance> { /** * Initialize the ConferencePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: ConferenceSolution); /** * Build an instance of ConferenceInstance * * @param payload - Payload response from the API */ getInstance(payload: ConferenceResource): ConferenceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/balance.js000064400000005065151677225100012435 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.BalanceInstance = exports.BalanceListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function BalanceListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Balance.json`; instance.fetch = function fetch(callback) { let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BalanceInstance(operationVersion, payload, instance._solution.accountSid)); 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; } exports.BalanceListInstance = BalanceListInstance; class BalanceInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.balance = payload.balance; this.currency = payload.currency; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, balance: this.balance, currency: this.currency, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BalanceInstance = BalanceInstance; rest/api/v2010/account/application.d.ts000064400000046157151677225100013616 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; /** * Options to pass to update a ApplicationInstance */ export interface ApplicationContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. The default value is your account\\\'s default API version. */ apiVersion?: string; /** The URL we should call when the phone number assigned to this application receives a call. */ voiceUrl?: string; /** The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod?: string; /** The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl?: string; /** The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`. */ statusCallbackMethod?: string; /** Whether we should look up the caller\\\'s caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. */ voiceCallerIdLookup?: boolean; /** The URL we should call when the phone number receives an incoming SMS message. */ smsUrl?: string; /** The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. */ smsMethod?: string; /** The URL that we should call when an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl?: string; /** The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod?: string; /** Same as message_status_callback: The URL we should call using a POST method to send status information about SMS messages sent by the application. Deprecated, included for backwards compatibility. */ smsStatusCallback?: string; /** The URL we should call using a POST method to send message status information to your application. */ messageStatusCallback?: string; /** Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. */ publicApplicationConnectEnabled?: boolean; } /** * Options to pass to create a ApplicationInstance */ export interface ApplicationListInstanceCreateOptions { /** The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. The default value is the account\\\'s default API version. */ apiVersion?: string; /** The URL we should call when the phone number assigned to this application receives a call. */ voiceUrl?: string; /** The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod?: string; /** The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl?: string; /** The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`. */ statusCallbackMethod?: string; /** Whether we should look up the caller\\\'s caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. */ voiceCallerIdLookup?: boolean; /** The URL we should call when the phone number receives an incoming SMS message. */ smsUrl?: string; /** The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. */ smsMethod?: string; /** The URL that we should call when an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl?: string; /** The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod?: string; /** The URL we should call using a POST method to send status information about SMS messages sent by the application. */ smsStatusCallback?: string; /** The URL we should call using a POST method to send message status information to your application. */ messageStatusCallback?: string; /** A descriptive string that you create to describe the new application. It can be up to 64 characters long. */ friendlyName?: string; /** Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. */ publicApplicationConnectEnabled?: boolean; } /** * Options to pass to each */ export interface ApplicationListInstanceEachOptions { /** The string that identifies the Application resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ApplicationInstance, 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 ApplicationListInstanceOptions { /** The string that identifies the Application resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ApplicationListInstancePageOptions { /** The string that identifies the Application resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ApplicationContext { /** * Remove a ApplicationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ApplicationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApplicationInstance */ fetch(callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; /** * Update a ApplicationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApplicationInstance */ update(callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; /** * Update a ApplicationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ApplicationInstance */ update(params: ApplicationContextUpdateOptions, callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ApplicationContextSolution { accountSid: string; sid: string; } export declare class ApplicationContextImpl implements ApplicationContext { protected _version: V2010; protected _solution: ApplicationContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; update(params?: ApplicationContextUpdateOptions | ((error: Error | null, item?: ApplicationInstance) => any), callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ApplicationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ApplicationPayload extends TwilioResponsePayload { applications: ApplicationResource[]; } interface ApplicationResource { account_sid: string; api_version: string; date_created: Date; date_updated: Date; friendly_name: string; message_status_callback: string; sid: string; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_status_callback: string; sms_url: string; status_callback: string; status_callback_method: string; uri: string; voice_caller_id_lookup: boolean; voice_fallback_method: string; voice_fallback_url: string; voice_method: string; voice_url: string; public_application_connect_enabled: boolean; } export declare class ApplicationInstance { protected _version: V2010; protected _solution: ApplicationContextSolution; protected _context?: ApplicationContext; constructor(_version: V2010, payload: ApplicationResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resource. */ accountSid: string; /** * The API version used to start a new TwiML session. */ apiVersion: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The URL we call using a POST method to send message status information to your application. */ messageStatusCallback: string; /** * The unique string that that we created to identify the Application resource. */ sid: string; /** * The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod: string; /** * The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl: string; /** * The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. */ smsMethod: string; /** * The URL we call using a POST method to send status information to your application about SMS messages that refer to the application. */ smsStatusCallback: string; /** * The URL we call when the phone number receives an incoming SMS message. */ smsUrl: string; /** * The URL we call using the `status_callback_method` to send status information to your application. */ statusCallback: string; /** * The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. */ statusCallbackMethod: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * Whether we look up the caller\'s caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. */ voiceCallerIdLookup: boolean; /** * The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod: string; /** * The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl: string; /** * The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod: string; /** * The URL we call when the phone number assigned to this application receives a call. */ voiceUrl: string; /** * Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. */ publicApplicationConnectEnabled: boolean; private get _proxy(); /** * Remove a ApplicationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ApplicationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApplicationInstance */ fetch(callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; /** * Update a ApplicationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApplicationInstance */ update(callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; /** * Update a ApplicationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ApplicationInstance */ update(params: ApplicationContextUpdateOptions, callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; messageStatusCallback: string; sid: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsStatusCallback: string; smsUrl: string; statusCallback: string; statusCallbackMethod: string; uri: string; voiceCallerIdLookup: boolean; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceUrl: string; publicApplicationConnectEnabled: boolean; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ApplicationSolution { accountSid: string; } export interface ApplicationListInstance { _version: V2010; _solution: ApplicationSolution; _uri: string; (sid: string): ApplicationContext; get(sid: string): ApplicationContext; /** * Create a ApplicationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ApplicationInstance */ create(callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; /** * Create a ApplicationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ApplicationInstance */ create(params: ApplicationListInstanceCreateOptions, callback?: (error: Error | null, item?: ApplicationInstance) => any): Promise<ApplicationInstance>; /** * Streams ApplicationInstance 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 { ApplicationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ApplicationInstance, done: (err?: Error) => void) => void): void; each(params: ApplicationListInstanceEachOptions, callback?: (item: ApplicationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ApplicationInstance 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: ApplicationPage) => any): Promise<ApplicationPage>; /** * Lists ApplicationInstance 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 { ApplicationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ApplicationInstance[]) => any): Promise<ApplicationInstance[]>; list(params: ApplicationListInstanceOptions, callback?: (error: Error | null, items: ApplicationInstance[]) => any): Promise<ApplicationInstance[]>; /** * Retrieve a single page of ApplicationInstance 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 { ApplicationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ApplicationPage) => any): Promise<ApplicationPage>; page(params: ApplicationListInstancePageOptions, callback?: (error: Error | null, items: ApplicationPage) => any): Promise<ApplicationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ApplicationListInstance(version: V2010, accountSid: string): ApplicationListInstance; export declare class ApplicationPage extends Page<V2010, ApplicationPayload, ApplicationResource, ApplicationInstance> { /** * Initialize the ApplicationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: ApplicationSolution); /** * Build an instance of ApplicationInstance * * @param payload - Payload response from the API */ getInstance(payload: ApplicationResource): ApplicationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/token.d.ts000064400000006361151677225100012424 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../V2010"; export declare class ApiV2010AccountTokenIceServers { "credential"?: string; "username"?: string; "url"?: string; "urls"?: string; } /** * Options to pass to create a TokenInstance */ export interface TokenListInstanceCreateOptions { /** The duration in seconds for which the generated credentials are valid. The default value is 86400 (24 hours). */ ttl?: number; } export interface TokenSolution { accountSid: string; } export interface TokenListInstance { _version: V2010; _solution: TokenSolution; _uri: string; /** * Create a TokenInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TokenInstance */ create(callback?: (error: Error | null, item?: TokenInstance) => any): Promise<TokenInstance>; /** * Create a TokenInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TokenInstance */ create(params: TokenListInstanceCreateOptions, callback?: (error: Error | null, item?: TokenInstance) => any): Promise<TokenInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TokenListInstance(version: V2010, accountSid: string): TokenListInstance; interface TokenResource { account_sid: string; date_created: Date; date_updated: Date; ice_servers: Array<ApiV2010AccountTokenIceServers>; password: string; ttl: string; username: string; } export declare class TokenInstance { protected _version: V2010; constructor(_version: V2010, payload: TokenResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Token resource. */ accountSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * An array representing the ephemeral credentials and the STUN and TURN server URIs. */ iceServers: Array<ApiV2010AccountTokenIceServers>; /** * The temporary password that the username will use when authenticating with Twilio. */ password: string; /** * The duration in seconds for which the username and password are valid. */ ttl: string; /** * The temporary username that uniquely identifies a Token. */ username: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; iceServers: ApiV2010AccountTokenIceServers[]; password: string; ttl: string; username: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/outgoingCallerId.js000064400000021731151677225100014301 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.OutgoingCallerIdPage = exports.OutgoingCallerIdListInstance = exports.OutgoingCallerIdInstance = exports.OutgoingCallerIdContextImpl = void 0; 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 OutgoingCallerIdContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/OutgoingCallerIds/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new OutgoingCallerIdInstance(operationVersion, payload, instance._solution.accountSid, 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"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new OutgoingCallerIdInstance(operationVersion, payload, instance._solution.accountSid, 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.OutgoingCallerIdContextImpl = OutgoingCallerIdContextImpl; class OutgoingCallerIdInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.sid = payload.sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.accountSid = payload.account_sid; this.phoneNumber = payload.phone_number; this.uri = payload.uri; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new OutgoingCallerIdContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a OutgoingCallerIdInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a OutgoingCallerIdInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OutgoingCallerIdInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, accountSid: this.accountSid, phoneNumber: this.phoneNumber, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OutgoingCallerIdInstance = OutgoingCallerIdInstance; function OutgoingCallerIdListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new OutgoingCallerIdContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/OutgoingCallerIds.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["phoneNumber"] !== undefined) data["PhoneNumber"] = params["phoneNumber"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new OutgoingCallerIdPage(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 OutgoingCallerIdPage(instance._version, payload, 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; } exports.OutgoingCallerIdListInstance = OutgoingCallerIdListInstance; class OutgoingCallerIdPage extends Page_1.default { /** * Initialize the OutgoingCallerIdPage * * @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 OutgoingCallerIdInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new OutgoingCallerIdInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OutgoingCallerIdPage = OutgoingCallerIdPage; rest/api/v2010/account/key.d.ts000064400000023151151677225100012070 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; /** * Options to pass to update a KeyInstance */ export interface KeyContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; } /** * Options to pass to each */ export interface KeyListInstanceEachOptions { /** 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: KeyInstance, 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 KeyListInstanceOptions { /** 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 KeyListInstancePageOptions { /** 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 KeyContext { /** * Remove a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ fetch(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Update a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ update(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Update a KeyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ update(params: KeyContextUpdateOptions, callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface KeyContextSolution { accountSid: string; sid: string; } export declare class KeyContextImpl implements KeyContext { protected _version: V2010; protected _solution: KeyContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; update(params?: KeyContextUpdateOptions | ((error: Error | null, item?: KeyInstance) => any), callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): KeyContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface KeyPayload extends TwilioResponsePayload { keys: KeyResource[]; } interface KeyResource { sid: string; friendly_name: string; date_created: Date; date_updated: Date; } export declare class KeyInstance { protected _version: V2010; protected _solution: KeyContextSolution; protected _context?: KeyContext; constructor(_version: V2010, payload: KeyResource, accountSid: string, sid?: string); /** * The unique string that that we created to identify the Key resource. */ sid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; private get _proxy(); /** * Remove a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ fetch(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Update a KeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ update(callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Update a KeyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed KeyInstance */ update(params: KeyContextUpdateOptions, callback?: (error: Error | null, item?: KeyInstance) => any): Promise<KeyInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface KeySolution { accountSid: string; } export interface KeyListInstance { _version: V2010; _solution: KeySolution; _uri: string; (sid: string): KeyContext; get(sid: string): KeyContext; /** * Streams KeyInstance 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 { KeyListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: KeyInstance, done: (err?: Error) => void) => void): void; each(params: KeyListInstanceEachOptions, callback?: (item: KeyInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of KeyInstance 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: KeyPage) => any): Promise<KeyPage>; /** * Lists KeyInstance 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 { KeyListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: KeyInstance[]) => any): Promise<KeyInstance[]>; list(params: KeyListInstanceOptions, callback?: (error: Error | null, items: KeyInstance[]) => any): Promise<KeyInstance[]>; /** * Retrieve a single page of KeyInstance 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 { KeyListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: KeyPage) => any): Promise<KeyPage>; page(params: KeyListInstancePageOptions, callback?: (error: Error | null, items: KeyPage) => any): Promise<KeyPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function KeyListInstance(version: V2010, accountSid: string): KeyListInstance; export declare class KeyPage extends Page<V2010, KeyPayload, KeyResource, KeyInstance> { /** * Initialize the KeyPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: KeySolution); /** * Build an instance of KeyInstance * * @param payload - Payload response from the API */ getInstance(payload: KeyResource): KeyInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/notification.d.ts000064400000034427151677225100013776 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; /** * Options to pass to each */ export interface NotificationListInstanceEachOptions { /** Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. */ log?: number; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDate?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateBefore?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: NotificationInstance, 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 NotificationListInstanceOptions { /** Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. */ log?: number; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDate?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateBefore?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface NotificationListInstancePageOptions { /** Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. */ log?: number; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDate?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateBefore?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface NotificationContext { /** * Fetch a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ fetch(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface NotificationContextSolution { accountSid: string; sid: string; } export declare class NotificationContextImpl implements NotificationContext { protected _version: V2010; protected _solution: NotificationContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, sid: string); fetch(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): NotificationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface NotificationPayload extends TwilioResponsePayload { notifications: NotificationResource[]; } interface NotificationResource { account_sid: string; api_version: string; call_sid: string; date_created: Date; date_updated: Date; error_code: string; log: string; message_date: Date; message_text: string; more_info: string; request_method: string; request_url: string; request_variables: string; response_body: string; response_headers: string; sid: string; uri: string; } export declare class NotificationInstance { protected _version: V2010; protected _solution: NotificationContextSolution; protected _context?: NotificationContext; constructor(_version: V2010, payload: NotificationResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. */ accountSid: string; /** * The API version used to generate the notification. Can be empty for events that don\'t have a specific API version, such as incoming phone calls. */ apiVersion: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Notification resource is associated with. */ callSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). */ errorCode: string; /** * An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. */ log: string; /** * The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. */ messageDate: Date; /** * The text of the notification. */ messageText: string; /** * The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). */ moreInfo: string; /** * The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. */ requestMethod: string; /** * The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. */ requestUrl: string; /** * The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. */ requestVariables: string; /** * The HTTP body returned by your server. */ responseBody: string; /** * The HTTP headers returned by your server. */ responseHeaders: string; /** * The unique string that that we created to identify the Notification resource. */ sid: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Fetch a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ fetch(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; callSid: string; dateCreated: Date; dateUpdated: Date; errorCode: string; log: string; messageDate: Date; messageText: string; moreInfo: string; requestMethod: string; requestUrl: string; requestVariables: string; responseBody: string; responseHeaders: string; sid: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface NotificationSolution { accountSid: string; } export interface NotificationListInstance { _version: V2010; _solution: NotificationSolution; _uri: string; (sid: string): NotificationContext; get(sid: string): NotificationContext; /** * Streams NotificationInstance 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 { NotificationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: NotificationInstance, done: (err?: Error) => void) => void): void; each(params: NotificationListInstanceEachOptions, callback?: (item: NotificationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of NotificationInstance 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: NotificationPage) => any): Promise<NotificationPage>; /** * Lists NotificationInstance 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 { NotificationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: NotificationInstance[]) => any): Promise<NotificationInstance[]>; list(params: NotificationListInstanceOptions, callback?: (error: Error | null, items: NotificationInstance[]) => any): Promise<NotificationInstance[]>; /** * Retrieve a single page of NotificationInstance 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 { NotificationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: NotificationPage) => any): Promise<NotificationPage>; page(params: NotificationListInstancePageOptions, callback?: (error: Error | null, items: NotificationPage) => any): Promise<NotificationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NotificationListInstance(version: V2010, accountSid: string): NotificationListInstance; export declare class NotificationPage extends Page<V2010, NotificationPayload, NotificationResource, NotificationInstance> { /** * Initialize the NotificationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: NotificationSolution); /** * Build an instance of NotificationInstance * * @param payload - Payload response from the API */ getInstance(payload: NotificationResource): NotificationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/transcription.js000064400000020137151677225100013744 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.TranscriptionPage = exports.TranscriptionListInstance = exports.TranscriptionInstance = exports.TranscriptionContextImpl = void 0; 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 TranscriptionContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Transcriptions/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TranscriptionInstance(operationVersion, payload, instance._solution.accountSid, 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.TranscriptionContextImpl = TranscriptionContextImpl; class TranscriptionInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.duration = payload.duration; this.price = payload.price; this.priceUnit = payload.price_unit; this.recordingSid = payload.recording_sid; this.sid = payload.sid; this.status = payload.status; this.transcriptionText = payload.transcription_text; this.type = payload.type; this.uri = payload.uri; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TranscriptionContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TranscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, duration: this.duration, price: this.price, priceUnit: this.priceUnit, recordingSid: this.recordingSid, sid: this.sid, status: this.status, transcriptionText: this.transcriptionText, type: this.type, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TranscriptionInstance = TranscriptionInstance; function TranscriptionListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TranscriptionContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Transcriptions.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TranscriptionPage(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 TranscriptionPage(instance._version, payload, 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; } exports.TranscriptionListInstance = TranscriptionListInstance; class TranscriptionPage extends Page_1.default { /** * Initialize the TranscriptionPage * * @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 TranscriptionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TranscriptionInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TranscriptionPage = TranscriptionPage; rest/api/v2010/account/address/dependentPhoneNumber.d.ts000064400000027567151677225100017055 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; export type DependentPhoneNumberAddressRequirement = "none" | "any" | "local" | "foreign"; export type DependentPhoneNumberEmergencyStatus = "Active" | "Inactive"; /** * Options to pass to each */ export interface DependentPhoneNumberListInstanceEachOptions { /** 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: DependentPhoneNumberInstance, 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 DependentPhoneNumberListInstanceOptions { /** 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 DependentPhoneNumberListInstancePageOptions { /** 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 DependentPhoneNumberSolution { accountSid: string; addressSid: string; } export interface DependentPhoneNumberListInstance { _version: V2010; _solution: DependentPhoneNumberSolution; _uri: string; /** * Streams DependentPhoneNumberInstance 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 { DependentPhoneNumberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DependentPhoneNumberInstance, done: (err?: Error) => void) => void): void; each(params: DependentPhoneNumberListInstanceEachOptions, callback?: (item: DependentPhoneNumberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DependentPhoneNumberInstance 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: DependentPhoneNumberPage) => any): Promise<DependentPhoneNumberPage>; /** * Lists DependentPhoneNumberInstance 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 { DependentPhoneNumberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DependentPhoneNumberInstance[]) => any): Promise<DependentPhoneNumberInstance[]>; list(params: DependentPhoneNumberListInstanceOptions, callback?: (error: Error | null, items: DependentPhoneNumberInstance[]) => any): Promise<DependentPhoneNumberInstance[]>; /** * Retrieve a single page of DependentPhoneNumberInstance 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 { DependentPhoneNumberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DependentPhoneNumberPage) => any): Promise<DependentPhoneNumberPage>; page(params: DependentPhoneNumberListInstancePageOptions, callback?: (error: Error | null, items: DependentPhoneNumberPage) => any): Promise<DependentPhoneNumberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DependentPhoneNumberListInstance(version: V2010, accountSid: string, addressSid: string): DependentPhoneNumberListInstance; interface DependentPhoneNumberPayload extends TwilioResponsePayload { dependent_phone_numbers: DependentPhoneNumberResource[]; } interface DependentPhoneNumberResource { sid: string; account_sid: string; friendly_name: string; phone_number: string; voice_url: string; voice_method: string; voice_fallback_method: string; voice_fallback_url: string; voice_caller_id_lookup: boolean; date_created: Date; date_updated: Date; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_url: string; address_requirements: DependentPhoneNumberAddressRequirement; capabilities: any; status_callback: string; status_callback_method: string; api_version: string; sms_application_sid: string; voice_application_sid: string; trunk_sid: string; emergency_status: DependentPhoneNumberEmergencyStatus; emergency_address_sid: string; uri: string; } export declare class DependentPhoneNumberInstance { protected _version: V2010; constructor(_version: V2010, payload: DependentPhoneNumberResource, accountSid: string, addressSid: string); /** * The unique string that that we created to identify the DependentPhoneNumber resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DependentPhoneNumber resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl: string; /** * The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod: string; /** * The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod: string; /** * The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl: string; /** * Whether we look up the caller\'s caller-ID name from the CNAM database. Can be: `true` or `false`. Caller ID lookups can cost $0.01 each. */ voiceCallerIdLookup: boolean; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod: string; /** * The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl: string; /** * The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. */ smsMethod: string; /** * The URL we call when the phone number receives an incoming SMS message. */ smsUrl: string; addressRequirements: DependentPhoneNumberAddressRequirement; /** * The set of Boolean properties that indicates whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. */ capabilities: any; /** * The URL we call using the `status_callback_method` to send status information to your application. */ statusCallback: string; /** * The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. */ statusCallbackMethod: string; /** * The API version used to start a new TwiML session. */ apiVersion: string; /** * The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. */ smsApplicationSid: string; /** * The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid: string; /** * The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid: string; emergencyStatus: DependentPhoneNumberEmergencyStatus; /** * The SID of the emergency address configuration that we use for emergency calling from the phone number. */ emergencyAddressSid: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; phoneNumber: string; voiceUrl: string; voiceMethod: string; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceCallerIdLookup: boolean; dateCreated: Date; dateUpdated: Date; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; addressRequirements: DependentPhoneNumberAddressRequirement; capabilities: any; statusCallback: string; statusCallbackMethod: string; apiVersion: string; smsApplicationSid: string; voiceApplicationSid: string; trunkSid: string; emergencyStatus: DependentPhoneNumberEmergencyStatus; emergencyAddressSid: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class DependentPhoneNumberPage extends Page<V2010, DependentPhoneNumberPayload, DependentPhoneNumberResource, DependentPhoneNumberInstance> { /** * Initialize the DependentPhoneNumberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: DependentPhoneNumberSolution); /** * Build an instance of DependentPhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload: DependentPhoneNumberResource): DependentPhoneNumberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/address/dependentPhoneNumber.js000064400000016516151677225100016611 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.DependentPhoneNumberPage = exports.DependentPhoneNumberInstance = exports.DependentPhoneNumberListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function DependentPhoneNumberListInstance(version, accountSid, addressSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(addressSid)) { throw new Error("Parameter 'addressSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, addressSid }; instance._uri = `/Accounts/${accountSid}/Addresses/${addressSid}/DependentPhoneNumbers.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DependentPhoneNumberPage(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 DependentPhoneNumberPage(instance._version, payload, 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; } exports.DependentPhoneNumberListInstance = DependentPhoneNumberListInstance; class DependentPhoneNumberInstance { constructor(_version, payload, accountSid, addressSid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.phoneNumber = payload.phone_number; this.voiceUrl = payload.voice_url; this.voiceMethod = payload.voice_method; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceCallerIdLookup = payload.voice_caller_id_lookup; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsUrl = payload.sms_url; this.addressRequirements = payload.address_requirements; this.capabilities = payload.capabilities; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.apiVersion = payload.api_version; this.smsApplicationSid = payload.sms_application_sid; this.voiceApplicationSid = payload.voice_application_sid; this.trunkSid = payload.trunk_sid; this.emergencyStatus = payload.emergency_status; this.emergencyAddressSid = payload.emergency_address_sid; this.uri = payload.uri; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, phoneNumber: this.phoneNumber, voiceUrl: this.voiceUrl, voiceMethod: this.voiceMethod, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceCallerIdLookup: this.voiceCallerIdLookup, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsUrl: this.smsUrl, addressRequirements: this.addressRequirements, capabilities: this.capabilities, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, apiVersion: this.apiVersion, smsApplicationSid: this.smsApplicationSid, voiceApplicationSid: this.voiceApplicationSid, trunkSid: this.trunkSid, emergencyStatus: this.emergencyStatus, emergencyAddressSid: this.emergencyAddressSid, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DependentPhoneNumberInstance = DependentPhoneNumberInstance; class DependentPhoneNumberPage extends Page_1.default { /** * Initialize the DependentPhoneNumberPage * * @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 DependentPhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DependentPhoneNumberInstance(this._version, payload, this._solution.accountSid, this._solution.addressSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DependentPhoneNumberPage = DependentPhoneNumberPage; rest/api/v2010/account/sip.d.ts000064400000001744151677225100012077 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../V2010"; import { CredentialListListInstance } from "./sip/credentialList"; import { DomainListInstance } from "./sip/domain"; import { IpAccessControlListListInstance } from "./sip/ipAccessControlList"; export interface SipSolution { accountSid: string; } export interface SipListInstance { _version: V2010; _solution: SipSolution; _uri: string; _credentialLists?: CredentialListListInstance; credentialLists: CredentialListListInstance; _domains?: DomainListInstance; domains: DomainListInstance; _ipAccessControlLists?: IpAccessControlListListInstance; ipAccessControlLists: IpAccessControlListListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SipListInstance(version: V2010, accountSid: string): SipListInstance; rest/api/v2010/account/call.d.ts000064400000114152151677225100012215 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; import { EventListInstance } from "./call/event"; import { NotificationListInstance } from "./call/notification"; import { PaymentListInstance } from "./call/payment"; import { RecordingListInstance } from "./call/recording"; import { SiprecListInstance } from "./call/siprec"; import { StreamListInstance } from "./call/stream"; import { UserDefinedMessageListInstance } from "./call/userDefinedMessage"; import { UserDefinedMessageSubscriptionListInstance } from "./call/userDefinedMessageSubscription"; import TwiML from "../../../../twiml/TwiML"; export type CallStatus = "queued" | "ringing" | "in-progress" | "completed" | "busy" | "failed" | "no-answer" | "canceled"; export type CallUpdateStatus = "canceled" | "completed"; /** * Options to pass to update a CallInstance */ export interface CallContextUpdateOptions { /** The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). */ url?: string; /** The HTTP method we should use when calling the `url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. */ method?: string; /** */ status?: CallUpdateStatus; /** The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored. */ fallbackUrl?: string; /** The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. */ fallbackMethod?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). */ statusCallback?: string; /** The HTTP method we should use when requesting the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. */ statusCallbackMethod?: string; /** TwiML instructions for the call Twilio will use without fetching Twiml from url. Twiml and url parameters are mutually exclusive */ twiml?: TwiML | string; /** The maximum duration of the call in seconds. Constraints depend on account and configuration. */ timeLimit?: number; } /** * Options to pass to create a CallInstance */ export interface CallListInstanceCreateOptions { /** The phone number, SIP address, or client identifier to call. */ to: string; /** The phone number or client identifier to use as the caller id. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `From` must also be a phone number. */ from: string; /** The HTTP method we should use when calling the `url` parameter\\\'s value. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. */ method?: string; /** The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored. */ fallbackUrl?: string; /** The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. */ fallbackMethod?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). */ statusCallback?: string; /** The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored. */ statusCallbackEvent?: Array<string>; /** The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. */ statusCallbackMethod?: string; /** A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), \\\'`#`\\\', \\\'`*`\\\' and \\\'`w`\\\', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the \\\'`#`\\\' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored. */ sendDigits?: string; /** The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail. */ timeout?: number; /** Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL. */ record?: boolean; /** The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. */ recordingChannels?: string; /** The URL that we call when the recording is available to be accessed. */ recordingStatusCallback?: string; /** The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. */ recordingStatusCallbackMethod?: string; /** The username used to authenticate the caller making a SIP call. */ sipAuthUsername?: string; /** The password required to authenticate the user account specified in `sip_auth_username`. */ sipAuthPassword?: string; /** Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). */ machineDetection?: string; /** The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. */ machineDetectionTimeout?: number; /** The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space. */ recordingStatusCallbackEvent?: Array<string>; /** Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. */ trim?: string; /** The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. */ callerId?: string; /** The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. Possible Values: 1000-6000. Default: 2400. */ machineDetectionSpeechThreshold?: number; /** The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200. */ machineDetectionSpeechEndThreshold?: number; /** The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. */ machineDetectionSilenceTimeout?: number; /** Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: `true` or `false`. */ asyncAmd?: string; /** The URL that we should call using the `async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. */ asyncAmdStatusCallback?: string; /** The HTTP method we should use when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. */ asyncAmdStatusCallbackMethod?: string; /** The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) */ byoc?: string; /** The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party\\\'s phone. (Branded Calls Beta) */ callReason?: string; /** A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call\\\'s call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. */ callToken?: string; /** The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. */ recordingTrack?: string; /** The maximum duration of the call in seconds. Constraints depend on account and configuration. */ timeLimit?: number; /** The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). */ url?: string; /** TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both `twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters. */ twiml?: TwiML | string; /** The SID of the Application resource that will handle the call, if the call will be handled by an application. */ applicationSid?: string; } /** * Options to pass to each */ export interface CallListInstanceEachOptions { /** Only show calls made to this phone number, SIP address, Client identifier or SIM SID. */ to?: string; /** Only include calls from this phone number, SIP address, Client identifier or SIM SID. */ from?: string; /** Only include calls spawned by calls with this SID. */ parentCallSid?: string; /** The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. */ status?: CallStatus; /** Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. */ startTime?: Date; /** Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. */ startTimeBefore?: Date; /** Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. */ startTimeAfter?: Date; /** Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. */ endTime?: Date; /** Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. */ endTimeBefore?: Date; /** Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. */ endTimeAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CallInstance, 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 CallListInstanceOptions { /** Only show calls made to this phone number, SIP address, Client identifier or SIM SID. */ to?: string; /** Only include calls from this phone number, SIP address, Client identifier or SIM SID. */ from?: string; /** Only include calls spawned by calls with this SID. */ parentCallSid?: string; /** The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. */ status?: CallStatus; /** Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. */ startTime?: Date; /** Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. */ startTimeBefore?: Date; /** Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. */ startTimeAfter?: Date; /** Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. */ endTime?: Date; /** Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. */ endTimeBefore?: Date; /** Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. */ endTimeAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CallListInstancePageOptions { /** Only show calls made to this phone number, SIP address, Client identifier or SIM SID. */ to?: string; /** Only include calls from this phone number, SIP address, Client identifier or SIM SID. */ from?: string; /** Only include calls spawned by calls with this SID. */ parentCallSid?: string; /** The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. */ status?: CallStatus; /** Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. */ startTime?: Date; /** Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. */ startTimeBefore?: Date; /** Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. */ startTimeAfter?: Date; /** Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. */ endTime?: Date; /** Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. */ endTimeBefore?: Date; /** Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. */ endTimeAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CallContext { events: EventListInstance; notifications: NotificationListInstance; payments: PaymentListInstance; recordings: RecordingListInstance; siprec: SiprecListInstance; streams: StreamListInstance; userDefinedMessages: UserDefinedMessageListInstance; userDefinedMessageSubscriptions: UserDefinedMessageSubscriptionListInstance; /** * Remove a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ fetch(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Update a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ update(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Update a CallInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ update(params: CallContextUpdateOptions, callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CallContextSolution { accountSid: string; sid: string; } export declare class CallContextImpl implements CallContext { protected _version: V2010; protected _solution: CallContextSolution; protected _uri: string; protected _events?: EventListInstance; protected _notifications?: NotificationListInstance; protected _payments?: PaymentListInstance; protected _recordings?: RecordingListInstance; protected _siprec?: SiprecListInstance; protected _streams?: StreamListInstance; protected _userDefinedMessages?: UserDefinedMessageListInstance; protected _userDefinedMessageSubscriptions?: UserDefinedMessageSubscriptionListInstance; constructor(_version: V2010, accountSid: string, sid: string); get events(): EventListInstance; get notifications(): NotificationListInstance; get payments(): PaymentListInstance; get recordings(): RecordingListInstance; get siprec(): SiprecListInstance; get streams(): StreamListInstance; get userDefinedMessages(): UserDefinedMessageListInstance; get userDefinedMessageSubscriptions(): UserDefinedMessageSubscriptionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; update(params?: CallContextUpdateOptions | ((error: Error | null, item?: CallInstance) => any), callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CallContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CallPayload extends TwilioResponsePayload { calls: CallResource[]; } interface CallResource { sid: string; date_created: Date; date_updated: Date; parent_call_sid: string; account_sid: string; to: string; to_formatted: string; from: string; from_formatted: string; phone_number_sid: string; status: CallStatus; start_time: Date; end_time: Date; duration: string; price: string; price_unit: string; direction: string; answered_by: string; api_version: string; forwarded_from: string; group_sid: string; caller_name: string; queue_time: string; trunk_sid: string; uri: string; subresource_uris: Record<string, string>; } export declare class CallInstance { protected _version: V2010; protected _solution: CallContextSolution; protected _context?: CallContext; constructor(_version: V2010, payload: CallResource, accountSid: string, sid?: string); /** * The unique string that we created to identify this Call resource. */ sid: string; /** * The date and time in UTC that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in UTC that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The SID that identifies the call that created this leg. */ parentCallSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Call resource. */ accountSid: string; /** * The phone number, SIP address, Client identifier or SIM SID that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. */ to: string; /** * The phone number, SIP address or Client identifier that received this call. Formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). */ toFormatted: string; /** * The phone number, SIP address, Client identifier or SIM SID that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. */ from: string; /** * The calling phone number, SIP address, or Client identifier formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). */ fromFormatted: string; /** * If the call was inbound, this is the SID of the IncomingPhoneNumber resource that received the call. If the call was outbound, it is the SID of the OutgoingCallerId resource from which the call was placed. */ phoneNumberSid: string; status: CallStatus; /** * The start time of the call, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed. */ startTime: Date; /** * The time the call ended, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully. */ endTime: Date; /** * The length of the call in seconds. This value is empty for busy, failed, unanswered, or ongoing calls. */ duration: string; /** * The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. */ price: string; /** * The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls. */ priceUnit: string; /** * A string describing the direction of the call. Can be: `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `<Dial>` verb. Using [Elastic SIP Trunking](https://www.twilio.com/docs/sip-trunking), the values can be [`trunking-terminating`](https://www.twilio.com/docs/sip-trunking#termination) for outgoing calls from your communications infrastructure to the PSTN or [`trunking-originating`](https://www.twilio.com/docs/sip-trunking#origination) for incoming calls to your communications infrastructure from the PSTN. */ direction: string; /** * Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise. */ answeredBy: string; /** * The API version used to create the call. */ apiVersion: string; /** * The forwarding phone number if this call was an incoming call forwarded from another number (depends on carrier supporting forwarding). Otherwise, empty. */ forwardedFrom: string; /** * The Group SID associated with this call. If no Group is associated with the call, the field is empty. */ groupSid: string; /** * The caller\'s name if this call was an incoming call to a phone number with caller ID Lookup enabled. Otherwise, empty. */ callerName: string; /** * The wait time in milliseconds before the call is placed. */ queueTime: string; /** * The unique identifier of the trunk resource that was used for this call. The field is empty if the call was not made using a SIP trunk or if the call is not terminated. */ trunkSid: string; /** * The URI of this resource, relative to `https://api.twilio.com`. */ uri: string; /** * A list of subresources available to this call, identified by their URIs relative to `https://api.twilio.com`. */ subresourceUris: Record<string, string>; private get _proxy(); /** * Remove a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ fetch(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Update a CallInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ update(callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Update a CallInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ update(params: CallContextUpdateOptions, callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Access the events. */ events(): EventListInstance; /** * Access the notifications. */ notifications(): NotificationListInstance; /** * Access the payments. */ payments(): PaymentListInstance; /** * Access the recordings. */ recordings(): RecordingListInstance; /** * Access the siprec. */ siprec(): SiprecListInstance; /** * Access the streams. */ streams(): StreamListInstance; /** * Access the userDefinedMessages. */ userDefinedMessages(): UserDefinedMessageListInstance; /** * Access the userDefinedMessageSubscriptions. */ userDefinedMessageSubscriptions(): UserDefinedMessageSubscriptionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; dateCreated: Date; dateUpdated: Date; parentCallSid: string; accountSid: string; to: string; toFormatted: string; from: string; fromFormatted: string; phoneNumberSid: string; status: CallStatus; startTime: Date; endTime: Date; duration: string; price: string; priceUnit: string; direction: string; answeredBy: string; apiVersion: string; forwardedFrom: string; groupSid: string; callerName: string; queueTime: string; trunkSid: string; uri: string; subresourceUris: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CallSolution { accountSid: string; } export interface CallListInstance { _version: V2010; _solution: CallSolution; _uri: string; (sid: string): CallContext; get(sid: string): CallContext; /** * Create a CallInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CallInstance */ create(params: CallListInstanceCreateOptions, callback?: (error: Error | null, item?: CallInstance) => any): Promise<CallInstance>; /** * Streams CallInstance 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 { CallListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CallInstance, done: (err?: Error) => void) => void): void; each(params: CallListInstanceEachOptions, callback?: (item: CallInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CallInstance 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: CallPage) => any): Promise<CallPage>; /** * Lists CallInstance 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 { CallListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CallInstance[]) => any): Promise<CallInstance[]>; list(params: CallListInstanceOptions, callback?: (error: Error | null, items: CallInstance[]) => any): Promise<CallInstance[]>; /** * Retrieve a single page of CallInstance 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 { CallListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CallPage) => any): Promise<CallPage>; page(params: CallListInstancePageOptions, callback?: (error: Error | null, items: CallPage) => any): Promise<CallPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CallListInstance(version: V2010, accountSid: string): CallListInstance; export declare class CallPage extends Page<V2010, CallPayload, CallResource, CallInstance> { /** * Initialize the CallPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: CallSolution); /** * Build an instance of CallInstance * * @param payload - Payload response from the API */ getInstance(payload: CallResource): CallInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/conference/participant.js000064400000045066151677225100015502 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.ParticipantPage = exports.ParticipantListInstance = exports.ParticipantInstance = exports.ParticipantContextImpl = void 0; 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 ParticipantContextImpl { constructor(_version, accountSid, conferenceSid, callSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conferenceSid)) { throw new Error("Parameter 'conferenceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } this._solution = { accountSid, conferenceSid, callSid }; this._uri = `/Accounts/${accountSid}/Conferences/${conferenceSid}/Participants/${callSid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.conferenceSid, instance._solution.callSid)); 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["muted"] !== undefined) data["Muted"] = serialize.bool(params["muted"]); if (params["hold"] !== undefined) data["Hold"] = serialize.bool(params["hold"]); if (params["holdUrl"] !== undefined) data["HoldUrl"] = params["holdUrl"]; if (params["holdMethod"] !== undefined) data["HoldMethod"] = params["holdMethod"]; if (params["announceUrl"] !== undefined) data["AnnounceUrl"] = params["announceUrl"]; if (params["announceMethod"] !== undefined) data["AnnounceMethod"] = params["announceMethod"]; if (params["waitUrl"] !== undefined) data["WaitUrl"] = params["waitUrl"]; if (params["waitMethod"] !== undefined) data["WaitMethod"] = params["waitMethod"]; if (params["beepOnExit"] !== undefined) data["BeepOnExit"] = serialize.bool(params["beepOnExit"]); if (params["endConferenceOnExit"] !== undefined) data["EndConferenceOnExit"] = serialize.bool(params["endConferenceOnExit"]); if (params["coaching"] !== undefined) data["Coaching"] = serialize.bool(params["coaching"]); if (params["callSidToCoach"] !== undefined) data["CallSidToCoach"] = params["callSidToCoach"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.conferenceSid, instance._solution.callSid)); 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.ParticipantContextImpl = ParticipantContextImpl; class ParticipantInstance { constructor(_version, payload, accountSid, conferenceSid, callSid) { this._version = _version; this.accountSid = payload.account_sid; this.callSid = payload.call_sid; this.label = payload.label; this.callSidToCoach = payload.call_sid_to_coach; this.coaching = payload.coaching; this.conferenceSid = payload.conference_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.endConferenceOnExit = payload.end_conference_on_exit; this.muted = payload.muted; this.hold = payload.hold; this.startConferenceOnEnter = payload.start_conference_on_enter; this.status = payload.status; this.queueTime = payload.queue_time; this.uri = payload.uri; this._solution = { accountSid, conferenceSid, callSid: callSid || this.callSid, }; } get _proxy() { this._context = this._context || new ParticipantContextImpl(this._version, this._solution.accountSid, this._solution.conferenceSid, this._solution.callSid); return this._context; } /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, callSid: this.callSid, label: this.label, callSidToCoach: this.callSidToCoach, coaching: this.coaching, conferenceSid: this.conferenceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, endConferenceOnExit: this.endConferenceOnExit, muted: this.muted, hold: this.hold, startConferenceOnEnter: this.startConferenceOnEnter, status: this.status, queueTime: this.queueTime, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantInstance = ParticipantInstance; function ParticipantListInstance(version, accountSid, conferenceSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conferenceSid)) { throw new Error("Parameter 'conferenceSid' is not valid."); } const instance = ((callSid) => instance.get(callSid)); instance.get = function get(callSid) { return new ParticipantContextImpl(version, accountSid, conferenceSid, callSid); }; instance._version = version; instance._solution = { accountSid, conferenceSid }; instance._uri = `/Accounts/${accountSid}/Conferences/${conferenceSid}/Participants.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["from"] === null || params["from"] === undefined) { throw new Error("Required parameter \"params['from']\" missing."); } if (params["to"] === null || params["to"] === undefined) { throw new Error("Required parameter \"params['to']\" missing."); } let data = {}; data["From"] = params["from"]; data["To"] = params["to"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["statusCallbackEvent"] !== undefined) data["StatusCallbackEvent"] = serialize.map(params["statusCallbackEvent"], (e) => e); if (params["label"] !== undefined) data["Label"] = params["label"]; if (params["timeout"] !== undefined) data["Timeout"] = params["timeout"]; if (params["record"] !== undefined) data["Record"] = serialize.bool(params["record"]); if (params["muted"] !== undefined) data["Muted"] = serialize.bool(params["muted"]); if (params["beep"] !== undefined) data["Beep"] = params["beep"]; if (params["startConferenceOnEnter"] !== undefined) data["StartConferenceOnEnter"] = serialize.bool(params["startConferenceOnEnter"]); if (params["endConferenceOnExit"] !== undefined) data["EndConferenceOnExit"] = serialize.bool(params["endConferenceOnExit"]); if (params["waitUrl"] !== undefined) data["WaitUrl"] = params["waitUrl"]; if (params["waitMethod"] !== undefined) data["WaitMethod"] = params["waitMethod"]; if (params["earlyMedia"] !== undefined) data["EarlyMedia"] = serialize.bool(params["earlyMedia"]); if (params["maxParticipants"] !== undefined) data["MaxParticipants"] = params["maxParticipants"]; if (params["conferenceRecord"] !== undefined) data["ConferenceRecord"] = params["conferenceRecord"]; if (params["conferenceTrim"] !== undefined) data["ConferenceTrim"] = params["conferenceTrim"]; if (params["conferenceStatusCallback"] !== undefined) data["ConferenceStatusCallback"] = params["conferenceStatusCallback"]; if (params["conferenceStatusCallbackMethod"] !== undefined) data["ConferenceStatusCallbackMethod"] = params["conferenceStatusCallbackMethod"]; if (params["conferenceStatusCallbackEvent"] !== undefined) data["ConferenceStatusCallbackEvent"] = serialize.map(params["conferenceStatusCallbackEvent"], (e) => e); if (params["recordingChannels"] !== undefined) data["RecordingChannels"] = params["recordingChannels"]; if (params["recordingStatusCallback"] !== undefined) data["RecordingStatusCallback"] = params["recordingStatusCallback"]; if (params["recordingStatusCallbackMethod"] !== undefined) data["RecordingStatusCallbackMethod"] = params["recordingStatusCallbackMethod"]; if (params["sipAuthUsername"] !== undefined) data["SipAuthUsername"] = params["sipAuthUsername"]; if (params["sipAuthPassword"] !== undefined) data["SipAuthPassword"] = params["sipAuthPassword"]; if (params["region"] !== undefined) data["Region"] = params["region"]; if (params["conferenceRecordingStatusCallback"] !== undefined) data["ConferenceRecordingStatusCallback"] = params["conferenceRecordingStatusCallback"]; if (params["conferenceRecordingStatusCallbackMethod"] !== undefined) data["ConferenceRecordingStatusCallbackMethod"] = params["conferenceRecordingStatusCallbackMethod"]; if (params["recordingStatusCallbackEvent"] !== undefined) data["RecordingStatusCallbackEvent"] = serialize.map(params["recordingStatusCallbackEvent"], (e) => e); if (params["conferenceRecordingStatusCallbackEvent"] !== undefined) data["ConferenceRecordingStatusCallbackEvent"] = serialize.map(params["conferenceRecordingStatusCallbackEvent"], (e) => e); if (params["coaching"] !== undefined) data["Coaching"] = serialize.bool(params["coaching"]); if (params["callSidToCoach"] !== undefined) data["CallSidToCoach"] = params["callSidToCoach"]; if (params["jitterBufferSize"] !== undefined) data["JitterBufferSize"] = params["jitterBufferSize"]; if (params["byoc"] !== undefined) data["Byoc"] = params["byoc"]; if (params["callerId"] !== undefined) data["CallerId"] = params["callerId"]; if (params["callReason"] !== undefined) data["CallReason"] = params["callReason"]; if (params["recordingTrack"] !== undefined) data["RecordingTrack"] = params["recordingTrack"]; if (params["timeLimit"] !== undefined) data["TimeLimit"] = params["timeLimit"]; if (params["machineDetection"] !== undefined) data["MachineDetection"] = params["machineDetection"]; if (params["machineDetectionTimeout"] !== undefined) data["MachineDetectionTimeout"] = params["machineDetectionTimeout"]; if (params["machineDetectionSpeechThreshold"] !== undefined) data["MachineDetectionSpeechThreshold"] = params["machineDetectionSpeechThreshold"]; if (params["machineDetectionSpeechEndThreshold"] !== undefined) data["MachineDetectionSpeechEndThreshold"] = params["machineDetectionSpeechEndThreshold"]; if (params["machineDetectionSilenceTimeout"] !== undefined) data["MachineDetectionSilenceTimeout"] = params["machineDetectionSilenceTimeout"]; if (params["amdStatusCallback"] !== undefined) data["AmdStatusCallback"] = params["amdStatusCallback"]; if (params["amdStatusCallbackMethod"] !== undefined) data["AmdStatusCallbackMethod"] = params["amdStatusCallbackMethod"]; if (params["trim"] !== undefined) data["Trim"] = params["trim"]; if (params["callToken"] !== undefined) data["CallToken"] = params["callToken"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.conferenceSid)); 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["muted"] !== undefined) data["Muted"] = serialize.bool(params["muted"]); if (params["hold"] !== undefined) data["Hold"] = serialize.bool(params["hold"]); if (params["coaching"] !== undefined) data["Coaching"] = serialize.bool(params["coaching"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantPage(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 ParticipantPage(instance._version, payload, 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; } exports.ParticipantListInstance = ParticipantListInstance; class ParticipantPage extends Page_1.default { /** * Initialize the ParticipantPage * * @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 ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ParticipantInstance(this._version, payload, this._solution.accountSid, this._solution.conferenceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantPage = ParticipantPage; rest/api/v2010/account/conference/participant.d.ts000064400000071104151677225100015726 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; export type ParticipantStatus = "queued" | "connecting" | "ringing" | "connected" | "complete" | "failed"; /** * Options to pass to update a ParticipantInstance */ export interface ParticipantContextUpdateOptions { /** Whether the participant should be muted. Can be `true` or `false`. `true` will mute the participant, and `false` will un-mute them. Anything value other than `true` or `false` is interpreted as `false`. */ muted?: boolean; /** Whether the participant should be on hold. Can be: `true` or `false`. `true` puts the participant on hold, and `false` lets them rejoin the conference. */ hold?: boolean; /** The URL we call using the `hold_method` for music that plays when the participant is on hold. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs. */ holdUrl?: string; /** The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`. */ holdMethod?: string; /** The URL we call using the `announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs. */ announceUrl?: string; /** The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`. */ announceMethod?: string; /** The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains `<Play>`, `<Say>`, `<Pause>`, or `<Redirect>` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). */ waitUrl?: string; /** The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. */ waitMethod?: string; /** Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`. */ beepOnExit?: boolean; /** Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. */ endConferenceOnExit?: boolean; /** Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. */ coaching?: boolean; /** The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. */ callSidToCoach?: string; } /** * Options to pass to create a ParticipantInstance */ export interface ParticipantListInstanceCreateOptions { /** The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `from` must also be a phone number. If `to` is sip address, this value of `from` should be a username portion to be used to populate the P-Asserted-Identity header that is passed to the SIP endpoint. */ from: string; /** The phone number, SIP address, or Client identifier that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `sip:name@company.com`. Client identifiers are formatted `client:name`. [Custom parameters](https://www.twilio.com/docs/voice/api/conference-participant-resource#custom-parameters) may also be specified. */ to: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `GET` and `POST` and defaults to `POST`. */ statusCallbackMethod?: string; /** The conference state changes that should generate a call to `status_callback`. Can be: `initiated`, `ringing`, `answered`, and `completed`. Separate multiple values with a space. The default value is `completed`. */ statusCallbackEvent?: Array<string>; /** A label for this participant. If one is supplied, it may subsequently be used to fetch, update or delete the participant. */ label?: string; /** The number of seconds that we should allow the phone to ring before assuming there is no answer. Can be an integer between `5` and `600`, inclusive. The default value is `60`. We always add a 5-second timeout buffer to outgoing calls, so value of 10 would result in an actual timeout that was closer to 15 seconds. */ timeout?: number; /** Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`. */ record?: boolean; /** Whether the agent is muted in the conference. Can be `true` or `false` and the default is `false`. */ muted?: boolean; /** Whether to play a notification beep to the conference when the participant joins. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. */ beep?: string; /** Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. */ startConferenceOnEnter?: boolean; /** Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. */ endConferenceOnExit?: boolean; /** The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). */ waitUrl?: string; /** The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. */ waitMethod?: string; /** Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. Can be: `true` or `false` and defaults to `true`. */ earlyMedia?: boolean; /** The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. */ maxParticipants?: number; /** Whether to record the conference the participant is joining. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. */ conferenceRecord?: string; /** Whether to trim leading and trailing silence from the conference recording. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. */ conferenceTrim?: string; /** The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. */ conferenceStatusCallback?: string; /** The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ conferenceStatusCallbackMethod?: string; /** The conference state changes that should generate a call to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `modify`, `speaker`, and `announcement`. Separate multiple values with a space. Defaults to `start end`. */ conferenceStatusCallbackEvent?: Array<string>; /** The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. */ recordingChannels?: string; /** The URL that we should call using the `recording_status_callback_method` when the recording status changes. */ recordingStatusCallback?: string; /** The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ recordingStatusCallbackMethod?: string; /** The SIP username used for authentication. */ sipAuthUsername?: string; /** The SIP password for authentication. */ sipAuthPassword?: string; /** The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. */ region?: string; /** The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. */ conferenceRecordingStatusCallback?: string; /** The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ conferenceRecordingStatusCallbackMethod?: string; /** The recording state changes that should generate a call to `recording_status_callback`. Can be: `started`, `in-progress`, `paused`, `resumed`, `stopped`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `\\\'in-progress completed failed\\\'`. */ recordingStatusCallbackEvent?: Array<string>; /** The conference recording state changes that generate a call to `conference_recording_status_callback`. Can be: `in-progress`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `\\\'in-progress completed failed\\\'` */ conferenceRecordingStatusCallbackEvent?: Array<string>; /** Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. */ coaching?: boolean; /** The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. */ callSidToCoach?: string; /** Jitter buffer size for the connecting participant. Twilio will use this setting to apply Jitter Buffer before participant\\\'s audio is mixed into the conference. Can be: `off`, `small`, `medium`, and `large`. Default to `large`. */ jitterBufferSize?: string; /** The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) */ byoc?: string; /** The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `callerId` must also be a phone number. If `to` is sip address, this value of `callerId` should be a username portion to be used to populate the From header that is passed to the SIP endpoint. */ callerId?: string; /** The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party\\\'s phone. (Branded Calls Beta) */ callReason?: string; /** The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is sent from Twilio. `both` records the audio that is received and sent by Twilio. */ recordingTrack?: string; /** The maximum duration of the call in seconds. Constraints depend on account and configuration. */ timeLimit?: number; /** Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). */ machineDetection?: string; /** The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. */ machineDetectionTimeout?: number; /** The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. Possible Values: 1000-6000. Default: 2400. */ machineDetectionSpeechThreshold?: number; /** The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200. */ machineDetectionSpeechEndThreshold?: number; /** The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. */ machineDetectionSilenceTimeout?: number; /** The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. */ amdStatusCallback?: string; /** The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. */ amdStatusCallbackMethod?: string; /** Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. */ trim?: string; /** A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call\\\'s call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. */ callToken?: string; } /** * Options to pass to each */ export interface ParticipantListInstanceEachOptions { /** Whether to return only participants that are muted. Can be: `true` or `false`. */ muted?: boolean; /** Whether to return only participants that are on hold. Can be: `true` or `false`. */ hold?: boolean; /** Whether to return only participants who are coaching another call. Can be: `true` or `false`. */ coaching?: boolean; /** 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: ParticipantInstance, 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 ParticipantListInstanceOptions { /** Whether to return only participants that are muted. Can be: `true` or `false`. */ muted?: boolean; /** Whether to return only participants that are on hold. Can be: `true` or `false`. */ hold?: boolean; /** Whether to return only participants who are coaching another call. Can be: `true` or `false`. */ coaching?: boolean; /** 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 ParticipantListInstancePageOptions { /** Whether to return only participants that are muted. Can be: `true` or `false`. */ muted?: boolean; /** Whether to return only participants that are on hold. Can be: `true` or `false`. */ hold?: boolean; /** Whether to return only participants who are coaching another call. Can be: `true` or `false`. */ coaching?: boolean; /** 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 ParticipantContext { /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(params: ParticipantContextUpdateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ParticipantContextSolution { accountSid: string; conferenceSid: string; callSid: string; } export declare class ParticipantContextImpl implements ParticipantContext { protected _version: V2010; protected _solution: ParticipantContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, conferenceSid: string, callSid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; update(params?: ParticipantContextUpdateOptions | ((error: Error | null, item?: ParticipantInstance) => any), callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ParticipantContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ParticipantPayload extends TwilioResponsePayload { participants: ParticipantResource[]; } interface ParticipantResource { account_sid: string; call_sid: string; label: string; call_sid_to_coach: string; coaching: boolean; conference_sid: string; date_created: Date; date_updated: Date; end_conference_on_exit: boolean; muted: boolean; hold: boolean; start_conference_on_enter: boolean; status: ParticipantStatus; queue_time: string; uri: string; } export declare class ParticipantInstance { protected _version: V2010; protected _solution: ParticipantContextSolution; protected _context?: ParticipantContext; constructor(_version: V2010, payload: ParticipantResource, accountSid: string, conferenceSid: string, callSid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. */ accountSid: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Participant resource is associated with. */ callSid: string; /** * The user-specified label of this participant, if one was given when the participant was created. This may be used to fetch, update or delete the participant. */ label: string; /** * The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. */ callSidToCoach: string; /** * Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. */ coaching: boolean; /** * The SID of the conference the participant is in. */ conferenceSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * Whether the conference ends when the participant leaves. Can be: `true` or `false` and the default is `false`. If `true`, the conference ends and all other participants drop out when the participant leaves. */ endConferenceOnExit: boolean; /** * Whether the participant is muted. Can be `true` or `false`. */ muted: boolean; /** * Whether the participant is on hold. Can be `true` or `false`. */ hold: boolean; /** * Whether the conference starts when the participant joins the conference, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. */ startConferenceOnEnter: boolean; status: ParticipantStatus; /** * The wait time in milliseconds before participant\'s call is placed. Only available in the response to a create participant request. */ queueTime: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(params: ParticipantContextUpdateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; callSid: string; label: string; callSidToCoach: string; coaching: boolean; conferenceSid: string; dateCreated: Date; dateUpdated: Date; endConferenceOnExit: boolean; muted: boolean; hold: boolean; startConferenceOnEnter: boolean; status: ParticipantStatus; queueTime: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ParticipantSolution { accountSid: string; conferenceSid: string; } export interface ParticipantListInstance { _version: V2010; _solution: ParticipantSolution; _uri: string; (callSid: string): ParticipantContext; get(callSid: string): ParticipantContext; /** * Create a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ create(params: ParticipantListInstanceCreateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Streams ParticipantInstance 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 { ParticipantListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; each(params: ParticipantListInstanceEachOptions, callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ParticipantInstance 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: ParticipantPage) => any): Promise<ParticipantPage>; /** * Lists ParticipantInstance 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 { ParticipantListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; list(params: ParticipantListInstanceOptions, callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; /** * Retrieve a single page of ParticipantInstance 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 { ParticipantListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; page(params: ParticipantListInstancePageOptions, callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ParticipantListInstance(version: V2010, accountSid: string, conferenceSid: string): ParticipantListInstance; export declare class ParticipantPage extends Page<V2010, ParticipantPayload, ParticipantResource, ParticipantInstance> { /** * Initialize the ParticipantPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: ParticipantSolution); /** * Build an instance of ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload: ParticipantResource): ParticipantInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/conference/recording.js000064400000025064151677225100015134 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.RecordingPage = exports.RecordingListInstance = exports.RecordingInstance = exports.RecordingContextImpl = void 0; 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 RecordingContextImpl { constructor(_version, accountSid, conferenceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conferenceSid)) { throw new Error("Parameter 'conferenceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, conferenceSid, sid }; this._uri = `/Accounts/${accountSid}/Conferences/${conferenceSid}/Recordings/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.conferenceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; if (params["pauseBehavior"] !== undefined) data["PauseBehavior"] = params["pauseBehavior"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.conferenceSid, 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.RecordingContextImpl = RecordingContextImpl; class RecordingInstance { constructor(_version, payload, accountSid, conferenceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.callSid = payload.call_sid; this.conferenceSid = payload.conference_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.startTime = deserialize.rfc2822DateTime(payload.start_time); this.duration = payload.duration; this.sid = payload.sid; this.price = payload.price; this.priceUnit = payload.price_unit; this.status = payload.status; this.channels = deserialize.integer(payload.channels); this.source = payload.source; this.errorCode = deserialize.integer(payload.error_code); this.encryptionDetails = payload.encryption_details; this.uri = payload.uri; this._solution = { accountSid, conferenceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RecordingContextImpl(this._version, this._solution.accountSid, this._solution.conferenceSid, this._solution.sid); return this._context; } /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, callSid: this.callSid, conferenceSid: this.conferenceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, startTime: this.startTime, duration: this.duration, sid: this.sid, price: this.price, priceUnit: this.priceUnit, status: this.status, channels: this.channels, source: this.source, errorCode: this.errorCode, encryptionDetails: this.encryptionDetails, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingInstance = RecordingInstance; function RecordingListInstance(version, accountSid, conferenceSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conferenceSid)) { throw new Error("Parameter 'conferenceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RecordingContextImpl(version, accountSid, conferenceSid, sid); }; instance._version = version; instance._solution = { accountSid, conferenceSid }; instance._uri = `/Accounts/${accountSid}/Conferences/${conferenceSid}/Recordings.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601Date(params["dateCreated"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreated<"] = serialize.iso8601Date(params["dateCreatedBefore"]); if (params["dateCreatedAfter"] !== undefined) data["DateCreated>"] = serialize.iso8601Date(params["dateCreatedAfter"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingPage(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 RecordingPage(instance._version, payload, 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; } exports.RecordingListInstance = RecordingListInstance; class RecordingPage extends Page_1.default { /** * Initialize the RecordingPage * * @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 RecordingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RecordingInstance(this._version, payload, this._solution.accountSid, this._solution.conferenceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingPage = RecordingPage; rest/api/v2010/account/conference/recording.d.ts000064400000037336151677225100015375 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; export type RecordingSource = "DialVerb" | "Conference" | "OutboundAPI" | "Trunking" | "RecordVerb" | "StartCallRecordingAPI" | "StartConferenceRecordingAPI"; export type RecordingStatus = "in-progress" | "paused" | "stopped" | "processing" | "completed" | "absent"; /** * Options to pass to update a RecordingInstance */ export interface RecordingContextUpdateOptions { /** */ status: RecordingStatus; /** Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. */ pauseBehavior?: string; } /** * Options to pass to each */ export interface RecordingListInstanceEachOptions { /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreated?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedBefore?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: RecordingInstance, 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 RecordingListInstanceOptions { /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreated?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedBefore?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface RecordingListInstancePageOptions { /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreated?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedBefore?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface RecordingContext { /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Update a RecordingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RecordingContextSolution { accountSid: string; conferenceSid: string; sid: string; } export declare class RecordingContextImpl implements RecordingContext { protected _version: V2010; protected _solution: RecordingContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, conferenceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RecordingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RecordingPayload extends TwilioResponsePayload { recordings: RecordingResource[]; } interface RecordingResource { account_sid: string; api_version: string; call_sid: string; conference_sid: string; date_created: Date; date_updated: Date; start_time: Date; duration: string; sid: string; price: string; price_unit: string; status: RecordingStatus; channels: number; source: RecordingSource; error_code: number; encryption_details: any; uri: string; } export declare class RecordingInstance { protected _version: V2010; protected _solution: RecordingContextSolution; protected _context?: RecordingContext; constructor(_version: V2010, payload: RecordingResource, accountSid: string, conferenceSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resource. */ accountSid: string; /** * The API version used to create the recording. */ apiVersion: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Conference Recording resource is associated with. */ callSid: string; /** * The Conference SID that identifies the conference associated with the recording. */ conferenceSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ startTime: Date; /** * The length of the recording in seconds. */ duration: string; /** * The unique string that that we created to identify the Conference Recording resource. */ sid: string; /** * The one-time cost of creating the recording in the `price_unit` currency. */ price: string; /** * The currency used in the `price` property. Example: `USD`. */ priceUnit: string; status: RecordingStatus; /** * The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. */ channels: number; source: RecordingSource; /** * The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. */ errorCode: number; /** * How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. */ encryptionDetails: any; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Update a RecordingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; callSid: string; conferenceSid: string; dateCreated: Date; dateUpdated: Date; startTime: Date; duration: string; sid: string; price: string; priceUnit: string; status: RecordingStatus; channels: number; source: RecordingSource; errorCode: number; encryptionDetails: any; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RecordingSolution { accountSid: string; conferenceSid: string; } export interface RecordingListInstance { _version: V2010; _solution: RecordingSolution; _uri: string; (sid: string): RecordingContext; get(sid: string): RecordingContext; /** * Streams RecordingInstance 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 { RecordingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RecordingInstance, done: (err?: Error) => void) => void): void; each(params: RecordingListInstanceEachOptions, callback?: (item: RecordingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RecordingInstance 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: RecordingPage) => any): Promise<RecordingPage>; /** * Lists RecordingInstance 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 { RecordingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RecordingInstance[]) => any): Promise<RecordingInstance[]>; list(params: RecordingListInstanceOptions, callback?: (error: Error | null, items: RecordingInstance[]) => any): Promise<RecordingInstance[]>; /** * Retrieve a single page of RecordingInstance 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 { RecordingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RecordingPage) => any): Promise<RecordingPage>; page(params: RecordingListInstancePageOptions, callback?: (error: Error | null, items: RecordingPage) => any): Promise<RecordingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RecordingListInstance(version: V2010, accountSid: string, conferenceSid: string): RecordingListInstance; export declare class RecordingPage extends Page<V2010, RecordingPayload, RecordingResource, RecordingInstance> { /** * Initialize the RecordingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: RecordingSolution); /** * Build an instance of RecordingInstance * * @param payload - Payload response from the API */ getInstance(payload: RecordingResource): RecordingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/usage.d.ts000064400000017632151677225100012413 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../V2010"; import { RecordListInstance } from "./usage/record"; import { TriggerListInstance } from "./usage/trigger"; export type UsageCategory = "a2p-registration-fees" | "agent-conference" | "amazon-polly" | "answering-machine-detection" | "authy-authentications" | "authy-calls-outbound" | "authy-monthly-fees" | "authy-phone-intelligence" | "authy-phone-verifications" | "authy-sms-outbound" | "call-progess-events" | "calleridlookups" | "calls" | "calls-client" | "calls-globalconference" | "calls-inbound" | "calls-inbound-local" | "calls-inbound-mobile" | "calls-inbound-tollfree" | "calls-outbound" | "calls-pay-verb-transactions" | "calls-recordings" | "calls-sip" | "calls-sip-inbound" | "calls-sip-outbound" | "calls-transfers" | "carrier-lookups" | "conversations" | "conversations-api-requests" | "conversations-conversation-events" | "conversations-endpoint-connectivity" | "conversations-events" | "conversations-participant-events" | "conversations-participants" | "cps" | "flex-usage" | "fraud-lookups" | "group-rooms" | "group-rooms-data-track" | "group-rooms-encrypted-media-recorded" | "group-rooms-media-downloaded" | "group-rooms-media-recorded" | "group-rooms-media-routed" | "group-rooms-media-stored" | "group-rooms-participant-minutes" | "group-rooms-recorded-minutes" | "imp-v1-usage" | "lookups" | "marketplace" | "marketplace-algorithmia-named-entity-recognition" | "marketplace-cadence-transcription" | "marketplace-cadence-translation" | "marketplace-capio-speech-to-text" | "marketplace-convriza-ababa" | "marketplace-deepgram-phrase-detector" | "marketplace-digital-segment-business-info" | "marketplace-facebook-offline-conversions" | "marketplace-google-speech-to-text" | "marketplace-ibm-watson-message-insights" | "marketplace-ibm-watson-message-sentiment" | "marketplace-ibm-watson-recording-analysis" | "marketplace-ibm-watson-tone-analyzer" | "marketplace-icehook-systems-scout" | "marketplace-infogroup-dataaxle-bizinfo" | "marketplace-keen-io-contact-center-analytics" | "marketplace-marchex-cleancall" | "marketplace-marchex-sentiment-analysis-for-sms" | "marketplace-marketplace-nextcaller-social-id" | "marketplace-mobile-commons-opt-out-classifier" | "marketplace-nexiwave-voicemail-to-text" | "marketplace-nextcaller-advanced-caller-identification" | "marketplace-nomorobo-spam-score" | "marketplace-payfone-tcpa-compliance" | "marketplace-remeeting-automatic-speech-recognition" | "marketplace-tcpa-defense-solutions-blacklist-feed" | "marketplace-telo-opencnam" | "marketplace-truecnam-true-spam" | "marketplace-twilio-caller-name-lookup-us" | "marketplace-twilio-carrier-information-lookup" | "marketplace-voicebase-pci" | "marketplace-voicebase-transcription" | "marketplace-voicebase-transcription-custom-vocabulary" | "marketplace-whitepages-pro-caller-identification" | "marketplace-whitepages-pro-phone-intelligence" | "marketplace-whitepages-pro-phone-reputation" | "marketplace-wolfarm-spoken-results" | "marketplace-wolfram-short-answer" | "marketplace-ytica-contact-center-reporting-analytics" | "mediastorage" | "mms" | "mms-inbound" | "mms-inbound-longcode" | "mms-inbound-shortcode" | "mms-messages-carrierfees" | "mms-outbound" | "mms-outbound-longcode" | "mms-outbound-shortcode" | "monitor-reads" | "monitor-storage" | "monitor-writes" | "notify" | "notify-actions-attempts" | "notify-channels" | "number-format-lookups" | "pchat" | "pchat-users" | "peer-to-peer-rooms-participant-minutes" | "pfax" | "pfax-minutes" | "pfax-minutes-inbound" | "pfax-minutes-outbound" | "pfax-pages" | "phonenumbers" | "phonenumbers-cps" | "phonenumbers-emergency" | "phonenumbers-local" | "phonenumbers-mobile" | "phonenumbers-setups" | "phonenumbers-tollfree" | "premiumsupport" | "proxy" | "proxy-active-sessions" | "pstnconnectivity" | "pv" | "pv-composition-media-downloaded" | "pv-composition-media-encrypted" | "pv-composition-media-stored" | "pv-composition-minutes" | "pv-recording-compositions" | "pv-room-participants" | "pv-room-participants-au1" | "pv-room-participants-br1" | "pv-room-participants-ie1" | "pv-room-participants-jp1" | "pv-room-participants-sg1" | "pv-room-participants-us1" | "pv-room-participants-us2" | "pv-rooms" | "pv-sip-endpoint-registrations" | "recordings" | "recordingstorage" | "rooms-group-bandwidth" | "rooms-group-minutes" | "rooms-peer-to-peer-minutes" | "shortcodes" | "shortcodes-customerowned" | "shortcodes-mms-enablement" | "shortcodes-mps" | "shortcodes-random" | "shortcodes-uk" | "shortcodes-vanity" | "small-group-rooms" | "small-group-rooms-data-track" | "small-group-rooms-participant-minutes" | "sms" | "sms-inbound" | "sms-inbound-longcode" | "sms-inbound-shortcode" | "sms-messages-carrierfees" | "sms-messages-features" | "sms-messages-features-senderid" | "sms-outbound" | "sms-outbound-content-inspection" | "sms-outbound-longcode" | "sms-outbound-shortcode" | "speech-recognition" | "studio-engagements" | "sync" | "sync-actions" | "sync-endpoint-hours" | "sync-endpoint-hours-above-daily-cap" | "taskrouter-tasks" | "totalprice" | "transcriptions" | "trunking-cps" | "trunking-emergency-calls" | "trunking-origination" | "trunking-origination-local" | "trunking-origination-mobile" | "trunking-origination-tollfree" | "trunking-recordings" | "trunking-secure" | "trunking-termination" | "tts-google" | "turnmegabytes" | "turnmegabytes-australia" | "turnmegabytes-brasil" | "turnmegabytes-germany" | "turnmegabytes-india" | "turnmegabytes-ireland" | "turnmegabytes-japan" | "turnmegabytes-singapore" | "turnmegabytes-useast" | "turnmegabytes-uswest" | "twilio-interconnect" | "verify-push" | "verify-totp" | "verify-whatsapp-conversations-business-initiated" | "video-recordings" | "virtual-agent" | "voice-insights" | "voice-insights-client-insights-on-demand-minute" | "voice-insights-ptsn-insights-on-demand-minute" | "voice-insights-sip-interface-insights-on-demand-minute" | "voice-insights-sip-trunking-insights-on-demand-minute" | "voice-intelligence" | "voice-intelligence-transcription" | "voice-intelligence-operators" | "wireless" | "wireless-orders" | "wireless-orders-artwork" | "wireless-orders-bulk" | "wireless-orders-esim" | "wireless-orders-starter" | "wireless-usage" | "wireless-usage-commands" | "wireless-usage-commands-africa" | "wireless-usage-commands-asia" | "wireless-usage-commands-centralandsouthamerica" | "wireless-usage-commands-europe" | "wireless-usage-commands-home" | "wireless-usage-commands-northamerica" | "wireless-usage-commands-oceania" | "wireless-usage-commands-roaming" | "wireless-usage-data" | "wireless-usage-data-africa" | "wireless-usage-data-asia" | "wireless-usage-data-centralandsouthamerica" | "wireless-usage-data-custom-additionalmb" | "wireless-usage-data-custom-first5mb" | "wireless-usage-data-domestic-roaming" | "wireless-usage-data-europe" | "wireless-usage-data-individual-additionalgb" | "wireless-usage-data-individual-firstgb" | "wireless-usage-data-international-roaming-canada" | "wireless-usage-data-international-roaming-india" | "wireless-usage-data-international-roaming-mexico" | "wireless-usage-data-northamerica" | "wireless-usage-data-oceania" | "wireless-usage-data-pooled" | "wireless-usage-data-pooled-downlink" | "wireless-usage-data-pooled-uplink" | "wireless-usage-mrc" | "wireless-usage-mrc-custom" | "wireless-usage-mrc-individual" | "wireless-usage-mrc-pooled" | "wireless-usage-mrc-suspended" | "wireless-usage-sms" | "wireless-usage-voice"; export interface UsageSolution { accountSid: string; } export interface UsageListInstance { _version: V2010; _solution: UsageSolution; _uri: string; _records?: RecordListInstance; records: RecordListInstance; _triggers?: TriggerListInstance; triggers: TriggerListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UsageListInstance(version: V2010, accountSid: string): UsageListInstance; rest/api/v2010/account/queue/member.d.ts000064400000022210151677225100013666 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; /** * Options to pass to update a MemberInstance */ export interface MemberContextUpdateOptions { /** The absolute URL of the Queue resource. */ url: string; /** How to pass the update request data. Can be `GET` or `POST` and the default is `POST`. `POST` sends the data as encoded form data and `GET` sends the data as query parameters. */ method?: string; } /** * Options to pass to each */ export interface MemberListInstanceEachOptions { /** 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: MemberInstance, 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 MemberListInstanceOptions { /** 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 MemberListInstancePageOptions { /** 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 MemberContext { /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MemberContextSolution { accountSid: string; queueSid: string; callSid: string; } export declare class MemberContextImpl implements MemberContext { protected _version: V2010; protected _solution: MemberContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, queueSid: string, callSid: string); fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MemberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MemberPayload extends TwilioResponsePayload { queue_members: MemberResource[]; } interface MemberResource { call_sid: string; date_enqueued: Date; position: number; uri: string; wait_time: number; queue_sid: string; } export declare class MemberInstance { protected _version: V2010; protected _solution: MemberContextSolution; protected _context?: MemberContext; constructor(_version: V2010, payload: MemberResource, accountSid: string, queueSid: string, callSid?: string); /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Member resource is associated with. */ callSid: string; /** * The date that the member was enqueued, given in RFC 2822 format. */ dateEnqueued: Date; /** * This member\'s current position in the queue. */ position: number; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The number of seconds the member has been in the queue. */ waitTime: number; /** * The SID of the Queue the member is in. */ queueSid: string; private get _proxy(); /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Update a MemberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ update(params: MemberContextUpdateOptions, callback?: (error: Error | null, item?: MemberInstance) => any): Promise<MemberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { callSid: string; dateEnqueued: Date; position: number; uri: string; waitTime: number; queueSid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MemberSolution { accountSid: string; queueSid: string; } export interface MemberListInstance { _version: V2010; _solution: MemberSolution; _uri: string; (callSid: string): MemberContext; get(callSid: string): MemberContext; /** * Streams MemberInstance 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 { MemberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; each(params: MemberListInstanceEachOptions, callback?: (item: MemberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MemberInstance 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: MemberPage) => any): Promise<MemberPage>; /** * Lists MemberInstance 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 { MemberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; list(params: MemberListInstanceOptions, callback?: (error: Error | null, items: MemberInstance[]) => any): Promise<MemberInstance[]>; /** * Retrieve a single page of MemberInstance 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 { MemberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; page(params: MemberListInstancePageOptions, callback?: (error: Error | null, items: MemberPage) => any): Promise<MemberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MemberListInstance(version: V2010, accountSid: string, queueSid: string): MemberListInstance; export declare class MemberPage extends Page<V2010, MemberPayload, MemberResource, MemberInstance> { /** * Initialize the MemberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: MemberSolution); /** * Build an instance of MemberInstance * * @param payload - Payload response from the API */ getInstance(payload: MemberResource): MemberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/queue/member.js000064400000020726151677225100013444 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.MemberPage = exports.MemberListInstance = exports.MemberInstance = exports.MemberContextImpl = void 0; 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 MemberContextImpl { constructor(_version, accountSid, queueSid, callSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(queueSid)) { throw new Error("Parameter 'queueSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } this._solution = { accountSid, queueSid, callSid }; this._uri = `/Accounts/${accountSid}/Queues/${queueSid}/Members/${callSid}.json`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.queueSid, instance._solution.callSid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["url"] === null || params["url"] === undefined) { throw new Error("Required parameter \"params['url']\" missing."); } let data = {}; data["Url"] = params["url"]; if (params["method"] !== undefined) data["Method"] = params["method"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MemberInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.queueSid, instance._solution.callSid)); 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.MemberContextImpl = MemberContextImpl; class MemberInstance { constructor(_version, payload, accountSid, queueSid, callSid) { this._version = _version; this.callSid = payload.call_sid; this.dateEnqueued = deserialize.rfc2822DateTime(payload.date_enqueued); this.position = deserialize.integer(payload.position); this.uri = payload.uri; this.waitTime = deserialize.integer(payload.wait_time); this.queueSid = payload.queue_sid; this._solution = { accountSid, queueSid, callSid: callSid || this.callSid }; } get _proxy() { this._context = this._context || new MemberContextImpl(this._version, this._solution.accountSid, this._solution.queueSid, this._solution.callSid); return this._context; } /** * Fetch a MemberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MemberInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { callSid: this.callSid, dateEnqueued: this.dateEnqueued, position: this.position, uri: this.uri, waitTime: this.waitTime, queueSid: this.queueSid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberInstance = MemberInstance; function MemberListInstance(version, accountSid, queueSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(queueSid)) { throw new Error("Parameter 'queueSid' is not valid."); } const instance = ((callSid) => instance.get(callSid)); instance.get = function get(callSid) { return new MemberContextImpl(version, accountSid, queueSid, callSid); }; instance._version = version; instance._solution = { accountSid, queueSid }; instance._uri = `/Accounts/${accountSid}/Queues/${queueSid}/Members.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MemberPage(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 MemberPage(instance._version, payload, 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; } exports.MemberListInstance = MemberListInstance; class MemberPage extends Page_1.default { /** * Initialize the MemberPage * * @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 MemberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MemberInstance(this._version, payload, this._solution.accountSid, this._solution.queueSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MemberPage = MemberPage; rest/api/v2010/account/sip/credentialList/credential.d.ts000064400000027655151677225100017170 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; /** * Options to pass to update a CredentialInstance */ export interface CredentialContextUpdateOptions { /** The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg `IWasAtSignal2018`) */ password?: string; } /** * Options to pass to create a CredentialInstance */ export interface CredentialListInstanceCreateOptions { /** The username that will be passed when authenticating SIP requests. The username should be sent in response to Twilio\\\'s challenge of the initial INVITE. It can be up to 32 characters long. */ username: string; /** The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg `IWasAtSignal2018`) */ password: string; } /** * Options to pass to each */ export interface CredentialListInstanceEachOptions { /** 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: CredentialInstance, 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 CredentialListInstanceOptions { /** 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 CredentialListInstancePageOptions { /** 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 CredentialContext { /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialContextSolution { accountSid: string; credentialListSid: string; sid: string; } export declare class CredentialContextImpl implements CredentialContext { protected _version: V2010; protected _solution: CredentialContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, credentialListSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; update(params?: CredentialContextUpdateOptions | ((error: Error | null, item?: CredentialInstance) => any), callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialPayload extends TwilioResponsePayload { credentials: CredentialResource[]; } interface CredentialResource { sid: string; account_sid: string; credential_list_sid: string; username: string; date_created: Date; date_updated: Date; uri: string; } export declare class CredentialInstance { protected _version: V2010; protected _solution: CredentialContextSolution; protected _context?: CredentialContext; constructor(_version: V2010, payload: CredentialResource, accountSid: string, credentialListSid: string, sid?: string); /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The unique id of the Account that is responsible for this resource. */ accountSid: string; /** * The unique id that identifies the credential list that includes this credential. */ credentialListSid: string; /** * The username for this credential. */ username: string; /** * The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateCreated: Date; /** * The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateUpdated: Date; /** * The URI for this resource, relative to `https://api.twilio.com` */ uri: string; private get _proxy(); /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; credentialListSid: string; username: string; dateCreated: Date; dateUpdated: Date; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialSolution { accountSid: string; credentialListSid: string; } export interface CredentialListInstance { _version: V2010; _solution: CredentialSolution; _uri: string; (sid: string): CredentialContext; get(sid: string): CredentialContext; /** * Create a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ create(params: CredentialListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Streams CredentialInstance 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 { CredentialListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListInstanceEachOptions, callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialInstance 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: CredentialPage) => any): Promise<CredentialPage>; /** * Lists CredentialInstance 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 { CredentialListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; list(params: CredentialListInstanceOptions, callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; /** * Retrieve a single page of CredentialInstance 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 { CredentialListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; page(params: CredentialListInstancePageOptions, callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListInstance(version: V2010, accountSid: string, credentialListSid: string): CredentialListInstance; export declare class CredentialPage extends Page<V2010, CredentialPayload, CredentialResource, CredentialInstance> { /** * Initialize the CredentialPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: CredentialSolution); /** * Build an instance of CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialResource): CredentialInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/sip/credentialList/credential.js000064400000024737151677225100016732 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.CredentialPage = exports.CredentialListInstance = exports.CredentialInstance = exports.CredentialContextImpl = void 0; 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 CredentialContextImpl { constructor(_version, accountSid, credentialListSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(credentialListSid)) { throw new Error("Parameter 'credentialListSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, credentialListSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/CredentialLists/${credentialListSid}/Credentials/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.credentialListSid, 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["password"] !== undefined) data["Password"] = params["password"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.credentialListSid, 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.CredentialContextImpl = CredentialContextImpl; class CredentialInstance { constructor(_version, payload, accountSid, credentialListSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.credentialListSid = payload.credential_list_sid; this.username = payload.username; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.uri = payload.uri; this._solution = { accountSid, credentialListSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CredentialContextImpl(this._version, this._solution.accountSid, this._solution.credentialListSid, this._solution.sid); return this._context; } /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, credentialListSid: this.credentialListSid, username: this.username, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialInstance = CredentialInstance; function CredentialListInstance(version, accountSid, credentialListSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(credentialListSid)) { throw new Error("Parameter 'credentialListSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialContextImpl(version, accountSid, credentialListSid, sid); }; instance._version = version; instance._solution = { accountSid, credentialListSid }; instance._uri = `/Accounts/${accountSid}/SIP/CredentialLists/${credentialListSid}/Credentials.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["username"] === null || params["username"] === undefined) { throw new Error("Required parameter \"params['username']\" missing."); } if (params["password"] === null || params["password"] === undefined) { throw new Error("Required parameter \"params['password']\" missing."); } let data = {}; data["Username"] = params["username"]; data["Password"] = params["password"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.credentialListSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialPage(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 CredentialPage(instance._version, payload, 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; } exports.CredentialListInstance = CredentialListInstance; class CredentialPage extends Page_1.default { /** * Initialize the CredentialPage * * @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 CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialInstance(this._version, payload, this._solution.accountSid, this._solution.credentialListSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialPage = CredentialPage; rest/api/v2010/account/sip/domain.js000064400000036434151677225100013116 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.DomainPage = exports.DomainListInstance = exports.DomainInstance = exports.DomainContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const authTypes_1 = require("./domain/authTypes"); const credentialListMapping_1 = require("./domain/credentialListMapping"); const ipAccessControlListMapping_1 = require("./domain/ipAccessControlListMapping"); class DomainContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/Domains/${sid}.json`; } get auth() { this._auth = this._auth || (0, authTypes_1.AuthTypesListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._auth; } get credentialListMappings() { this._credentialListMappings = this._credentialListMappings || (0, credentialListMapping_1.CredentialListMappingListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._credentialListMappings; } get ipAccessControlListMappings() { this._ipAccessControlListMappings = this._ipAccessControlListMappings || (0, ipAccessControlListMapping_1.IpAccessControlListMappingListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._ipAccessControlListMappings; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DomainInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceStatusCallbackMethod"] !== undefined) data["VoiceStatusCallbackMethod"] = params["voiceStatusCallbackMethod"]; if (params["voiceStatusCallbackUrl"] !== undefined) data["VoiceStatusCallbackUrl"] = params["voiceStatusCallbackUrl"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["sipRegistration"] !== undefined) data["SipRegistration"] = serialize.bool(params["sipRegistration"]); if (params["domainName"] !== undefined) data["DomainName"] = params["domainName"]; if (params["emergencyCallingEnabled"] !== undefined) data["EmergencyCallingEnabled"] = serialize.bool(params["emergencyCallingEnabled"]); if (params["secure"] !== undefined) data["Secure"] = serialize.bool(params["secure"]); if (params["byocTrunkSid"] !== undefined) data["ByocTrunkSid"] = params["byocTrunkSid"]; if (params["emergencyCallerSid"] !== undefined) data["EmergencyCallerSid"] = params["emergencyCallerSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DomainInstance(operationVersion, payload, instance._solution.accountSid, 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.DomainContextImpl = DomainContextImpl; class DomainInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.authType = payload.auth_type; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.domainName = payload.domain_name; this.friendlyName = payload.friendly_name; this.sid = payload.sid; this.uri = payload.uri; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceMethod = payload.voice_method; this.voiceStatusCallbackMethod = payload.voice_status_callback_method; this.voiceStatusCallbackUrl = payload.voice_status_callback_url; this.voiceUrl = payload.voice_url; this.subresourceUris = payload.subresource_uris; this.sipRegistration = payload.sip_registration; this.emergencyCallingEnabled = payload.emergency_calling_enabled; this.secure = payload.secure; this.byocTrunkSid = payload.byoc_trunk_sid; this.emergencyCallerSid = payload.emergency_caller_sid; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new DomainContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a DomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the auth. */ auth() { return this._proxy.auth; } /** * Access the credentialListMappings. */ credentialListMappings() { return this._proxy.credentialListMappings; } /** * Access the ipAccessControlListMappings. */ ipAccessControlListMappings() { return this._proxy.ipAccessControlListMappings; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, authType: this.authType, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, domainName: this.domainName, friendlyName: this.friendlyName, sid: this.sid, uri: this.uri, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceMethod: this.voiceMethod, voiceStatusCallbackMethod: this.voiceStatusCallbackMethod, voiceStatusCallbackUrl: this.voiceStatusCallbackUrl, voiceUrl: this.voiceUrl, subresourceUris: this.subresourceUris, sipRegistration: this.sipRegistration, emergencyCallingEnabled: this.emergencyCallingEnabled, secure: this.secure, byocTrunkSid: this.byocTrunkSid, emergencyCallerSid: this.emergencyCallerSid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DomainInstance = DomainInstance; function DomainListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new DomainContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/SIP/Domains.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["domainName"] === null || params["domainName"] === undefined) { throw new Error("Required parameter \"params['domainName']\" missing."); } let data = {}; data["DomainName"] = params["domainName"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["voiceStatusCallbackUrl"] !== undefined) data["VoiceStatusCallbackUrl"] = params["voiceStatusCallbackUrl"]; if (params["voiceStatusCallbackMethod"] !== undefined) data["VoiceStatusCallbackMethod"] = params["voiceStatusCallbackMethod"]; if (params["sipRegistration"] !== undefined) data["SipRegistration"] = serialize.bool(params["sipRegistration"]); if (params["emergencyCallingEnabled"] !== undefined) data["EmergencyCallingEnabled"] = serialize.bool(params["emergencyCallingEnabled"]); if (params["secure"] !== undefined) data["Secure"] = serialize.bool(params["secure"]); if (params["byocTrunkSid"] !== undefined) data["ByocTrunkSid"] = params["byocTrunkSid"]; if (params["emergencyCallerSid"] !== undefined) data["EmergencyCallerSid"] = params["emergencyCallerSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DomainInstance(operationVersion, payload, instance._solution.accountSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DomainPage(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 DomainPage(instance._version, payload, 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; } exports.DomainListInstance = DomainListInstance; class DomainPage extends Page_1.default { /** * Initialize the DomainPage * * @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 DomainInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DomainInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DomainPage = DomainPage; rest/api/v2010/account/sip/ipAccessControlList.js000064400000024650151677225100015573 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.IpAccessControlListPage = exports.IpAccessControlListListInstance = exports.IpAccessControlListInstance = exports.IpAccessControlListContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const ipAddress_1 = require("./ipAccessControlList/ipAddress"); class IpAccessControlListContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/IpAccessControlLists/${sid}.json`; } get ipAddresses() { this._ipAddresses = this._ipAddresses || (0, ipAddress_1.IpAddressListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._ipAddresses; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new IpAccessControlListInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IpAccessControlListInstance(operationVersion, payload, instance._solution.accountSid, 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.IpAccessControlListContextImpl = IpAccessControlListContextImpl; class IpAccessControlListInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new IpAccessControlListContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the ipAddresses. */ ipAddresses() { return this._proxy.ipAddresses; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, subresourceUris: this.subresourceUris, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpAccessControlListInstance = IpAccessControlListInstance; function IpAccessControlListListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new IpAccessControlListContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/SIP/IpAccessControlLists.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IpAccessControlListInstance(operationVersion, payload, instance._solution.accountSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new IpAccessControlListPage(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 IpAccessControlListPage(instance._version, payload, 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; } exports.IpAccessControlListListInstance = IpAccessControlListListInstance; class IpAccessControlListPage extends Page_1.default { /** * Initialize the IpAccessControlListPage * * @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 IpAccessControlListInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new IpAccessControlListInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpAccessControlListPage = IpAccessControlListPage; rest/api/v2010/account/sip/credentialList.d.ts000064400000027062151677225100015046 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { CredentialListInstance as CredentialListInstanceImport } from "./credentialList/credential"; /** * Options to pass to update a CredentialListInstance */ export interface CredentialListContextUpdateOptions { /** A human readable descriptive text for a CredentialList, up to 64 characters long. */ friendlyName: string; } /** * Options to pass to create a CredentialListInstance */ export interface CredentialListListInstanceCreateOptions { /** A human readable descriptive text that describes the CredentialList, up to 64 characters long. */ friendlyName: string; } /** * Options to pass to each */ export interface CredentialListListInstanceEachOptions { /** 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: CredentialListInstance, 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 CredentialListListInstanceOptions { /** 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 CredentialListListInstancePageOptions { /** 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 CredentialListContext { credentials: CredentialListInstanceImport; /** * Remove a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ fetch(callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Update a CredentialListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ update(params: CredentialListContextUpdateOptions, callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialListContextSolution { accountSid: string; sid: string; } export declare class CredentialListContextImpl implements CredentialListContext { protected _version: V2010; protected _solution: CredentialListContextSolution; protected _uri: string; protected _credentials?: CredentialListInstanceImport; constructor(_version: V2010, accountSid: string, sid: string); get credentials(): CredentialListInstanceImport; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; update(params: CredentialListContextUpdateOptions, callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialListContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialListPayload extends TwilioResponsePayload { credential_lists: CredentialListResource[]; } interface CredentialListResource { account_sid: string; date_created: Date; date_updated: Date; friendly_name: string; sid: string; subresource_uris: Record<string, string>; uri: string; } export declare class CredentialListInstance { protected _version: V2010; protected _solution: CredentialListContextSolution; protected _context?: CredentialListContext; constructor(_version: V2010, payload: CredentialListResource, accountSid: string, sid?: string); /** * The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. */ accountSid: string; /** * The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateCreated: Date; /** * The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateUpdated: Date; /** * A human readable descriptive text that describes the CredentialList, up to 64 characters long. */ friendlyName: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * A list of credentials associated with this credential list. */ subresourceUris: Record<string, string>; /** * The URI for this resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Remove a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ fetch(callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Update a CredentialListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ update(params: CredentialListContextUpdateOptions, callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Access the credentials. */ credentials(): CredentialListInstanceImport; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; sid: string; subresourceUris: Record<string, string>; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialListSolution { accountSid: string; } export interface CredentialListListInstance { _version: V2010; _solution: CredentialListSolution; _uri: string; (sid: string): CredentialListContext; get(sid: string): CredentialListContext; /** * Create a CredentialListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ create(params: CredentialListListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Streams CredentialListInstance 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 { CredentialListListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialListInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListListInstanceEachOptions, callback?: (item: CredentialListInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialListInstance 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: CredentialListPage) => any): Promise<CredentialListPage>; /** * Lists CredentialListInstance 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 { CredentialListListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialListInstance[]) => any): Promise<CredentialListInstance[]>; list(params: CredentialListListInstanceOptions, callback?: (error: Error | null, items: CredentialListInstance[]) => any): Promise<CredentialListInstance[]>; /** * Retrieve a single page of CredentialListInstance 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 { CredentialListListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialListPage) => any): Promise<CredentialListPage>; page(params: CredentialListListInstancePageOptions, callback?: (error: Error | null, items: CredentialListPage) => any): Promise<CredentialListPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListListInstance(version: V2010, accountSid: string): CredentialListListInstance; export declare class CredentialListPage extends Page<V2010, CredentialListPayload, CredentialListResource, CredentialListInstance> { /** * Initialize the CredentialListPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: CredentialListSolution); /** * Build an instance of CredentialListInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialListResource): CredentialListInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/sip/ipAccessControlList.d.ts000064400000027651151677225100016033 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { IpAddressListInstance } from "./ipAccessControlList/ipAddress"; /** * Options to pass to update a IpAccessControlListInstance */ export interface IpAccessControlListContextUpdateOptions { /** A human readable descriptive text, up to 255 characters long. */ friendlyName: string; } /** * Options to pass to create a IpAccessControlListInstance */ export interface IpAccessControlListListInstanceCreateOptions { /** A human readable descriptive text that describes the IpAccessControlList, up to 255 characters long. */ friendlyName: string; } /** * Options to pass to each */ export interface IpAccessControlListListInstanceEachOptions { /** 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: IpAccessControlListInstance, 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 IpAccessControlListListInstanceOptions { /** 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 IpAccessControlListListInstancePageOptions { /** 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 IpAccessControlListContext { ipAddresses: IpAddressListInstance; /** * Remove a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ fetch(callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Update a IpAccessControlListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ update(params: IpAccessControlListContextUpdateOptions, callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface IpAccessControlListContextSolution { accountSid: string; sid: string; } export declare class IpAccessControlListContextImpl implements IpAccessControlListContext { protected _version: V2010; protected _solution: IpAccessControlListContextSolution; protected _uri: string; protected _ipAddresses?: IpAddressListInstance; constructor(_version: V2010, accountSid: string, sid: string); get ipAddresses(): IpAddressListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; update(params: IpAccessControlListContextUpdateOptions, callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): IpAccessControlListContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface IpAccessControlListPayload extends TwilioResponsePayload { ip_access_control_lists: IpAccessControlListResource[]; } interface IpAccessControlListResource { sid: string; account_sid: string; friendly_name: string; date_created: Date; date_updated: Date; subresource_uris: Record<string, string>; uri: string; } export declare class IpAccessControlListInstance { protected _version: V2010; protected _solution: IpAccessControlListContextSolution; protected _context?: IpAccessControlListContext; constructor(_version: V2010, payload: IpAccessControlListResource, accountSid: string, sid?: string); /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. */ accountSid: string; /** * A human readable descriptive text, up to 255 characters long. */ friendlyName: string; /** * The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateCreated: Date; /** * The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateUpdated: Date; /** * A list of the IpAddress resources associated with this IP access control list resource. */ subresourceUris: Record<string, string>; /** * The URI for this resource, relative to `https://api.twilio.com` */ uri: string; private get _proxy(); /** * Remove a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ fetch(callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Update a IpAccessControlListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ update(params: IpAccessControlListContextUpdateOptions, callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Access the ipAddresses. */ ipAddresses(): IpAddressListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; subresourceUris: Record<string, string>; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface IpAccessControlListSolution { accountSid: string; } export interface IpAccessControlListListInstance { _version: V2010; _solution: IpAccessControlListSolution; _uri: string; (sid: string): IpAccessControlListContext; get(sid: string): IpAccessControlListContext; /** * Create a IpAccessControlListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ create(params: IpAccessControlListListInstanceCreateOptions, callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Streams IpAccessControlListInstance 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 { IpAccessControlListListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: IpAccessControlListInstance, done: (err?: Error) => void) => void): void; each(params: IpAccessControlListListInstanceEachOptions, callback?: (item: IpAccessControlListInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of IpAccessControlListInstance 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: IpAccessControlListPage) => any): Promise<IpAccessControlListPage>; /** * Lists IpAccessControlListInstance 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 { IpAccessControlListListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: IpAccessControlListInstance[]) => any): Promise<IpAccessControlListInstance[]>; list(params: IpAccessControlListListInstanceOptions, callback?: (error: Error | null, items: IpAccessControlListInstance[]) => any): Promise<IpAccessControlListInstance[]>; /** * Retrieve a single page of IpAccessControlListInstance 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 { IpAccessControlListListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: IpAccessControlListPage) => any): Promise<IpAccessControlListPage>; page(params: IpAccessControlListListInstancePageOptions, callback?: (error: Error | null, items: IpAccessControlListPage) => any): Promise<IpAccessControlListPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function IpAccessControlListListInstance(version: V2010, accountSid: string): IpAccessControlListListInstance; export declare class IpAccessControlListPage extends Page<V2010, IpAccessControlListPayload, IpAccessControlListResource, IpAccessControlListInstance> { /** * Initialize the IpAccessControlListPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: IpAccessControlListSolution); /** * Build an instance of IpAccessControlListInstance * * @param payload - Payload response from the API */ getInstance(payload: IpAccessControlListResource): IpAccessControlListInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/sip/domain.d.ts000064400000046075151677225100013354 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { AuthTypesListInstance } from "./domain/authTypes"; import { CredentialListMappingListInstance } from "./domain/credentialListMapping"; import { IpAccessControlListMappingListInstance } from "./domain/ipAccessControlListMapping"; /** * Options to pass to update a DomainInstance */ export interface DomainContextUpdateOptions { /** A descriptive string that you created to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod?: string; /** The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`. */ voiceFallbackUrl?: string; /** The HTTP method we should use to call `voice_url` */ voiceMethod?: string; /** The HTTP method we should use to call `voice_status_callback_url`. Can be: `GET` or `POST`. */ voiceStatusCallbackMethod?: string; /** The URL that we should call to pass status parameters (such as call ended) to your application. */ voiceStatusCallbackUrl?: string; /** The URL we should call when the domain receives a call. */ voiceUrl?: string; /** Whether to allow SIP Endpoints to register with the domain to receive calls. Can be `true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not. */ sipRegistration?: boolean; /** The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \\\"-\\\" and must end with `sip.twilio.com`. */ domainName?: string; /** Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. */ emergencyCallingEnabled?: boolean; /** Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. */ secure?: boolean; /** The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. */ byocTrunkSid?: string; /** Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. */ emergencyCallerSid?: string; } /** * Options to pass to create a DomainInstance */ export interface DomainListInstanceCreateOptions { /** The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \\\"-\\\" and must end with `sip.twilio.com`. */ domainName: string; /** A descriptive string that you created to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The URL we should when the domain receives a call. */ voiceUrl?: string; /** The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod?: string; /** The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`. */ voiceFallbackUrl?: string; /** The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod?: string; /** The URL that we should call to pass status parameters (such as call ended) to your application. */ voiceStatusCallbackUrl?: string; /** The HTTP method we should use to call `voice_status_callback_url`. Can be: `GET` or `POST`. */ voiceStatusCallbackMethod?: string; /** Whether to allow SIP Endpoints to register with the domain to receive calls. Can be `true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not. */ sipRegistration?: boolean; /** Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. */ emergencyCallingEnabled?: boolean; /** Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. */ secure?: boolean; /** The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. */ byocTrunkSid?: string; /** Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. */ emergencyCallerSid?: string; } /** * Options to pass to each */ export interface DomainListInstanceEachOptions { /** 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: DomainInstance, 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 DomainListInstanceOptions { /** 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 DomainListInstancePageOptions { /** 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 DomainContext { auth: AuthTypesListInstance; credentialListMappings: CredentialListMappingListInstance; ipAccessControlListMappings: IpAccessControlListMappingListInstance; /** * Remove a DomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainInstance */ fetch(callback?: (error: Error | null, item?: DomainInstance) => any): Promise<DomainInstance>; /** * Update a DomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainInstance */ update(callback?: (error: Error | null, item?: DomainInstance) => any): Promise<DomainInstance>; /** * Update a DomainInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainInstance */ update(params: DomainContextUpdateOptions, callback?: (error: Error | null, item?: DomainInstance) => any): Promise<DomainInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DomainContextSolution { accountSid: string; sid: string; } export declare class DomainContextImpl implements DomainContext { protected _version: V2010; protected _solution: DomainContextSolution; protected _uri: string; protected _auth?: AuthTypesListInstance; protected _credentialListMappings?: CredentialListMappingListInstance; protected _ipAccessControlListMappings?: IpAccessControlListMappingListInstance; constructor(_version: V2010, accountSid: string, sid: string); get auth(): AuthTypesListInstance; get credentialListMappings(): CredentialListMappingListInstance; get ipAccessControlListMappings(): IpAccessControlListMappingListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DomainInstance) => any): Promise<DomainInstance>; update(params?: DomainContextUpdateOptions | ((error: Error | null, item?: DomainInstance) => any), callback?: (error: Error | null, item?: DomainInstance) => any): Promise<DomainInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DomainContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DomainPayload extends TwilioResponsePayload { domains: DomainResource[]; } interface DomainResource { account_sid: string; api_version: string; auth_type: string; date_created: Date; date_updated: Date; domain_name: string; friendly_name: string; sid: string; uri: string; voice_fallback_method: string; voice_fallback_url: string; voice_method: string; voice_status_callback_method: string; voice_status_callback_url: string; voice_url: string; subresource_uris: Record<string, string>; sip_registration: boolean; emergency_calling_enabled: boolean; secure: boolean; byoc_trunk_sid: string; emergency_caller_sid: string; } export declare class DomainInstance { protected _version: V2010; protected _solution: DomainContextSolution; protected _context?: DomainContext; constructor(_version: V2010, payload: DomainResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource. */ accountSid: string; /** * The API version used to process the call. */ apiVersion: string; /** * The types of authentication you have mapped to your domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If you have both defined for your domain, both will be returned in a comma delimited string. If `auth_type` is not defined, the domain will not be able to receive any traffic. */ authType: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \"-\" and must end with `sip.twilio.com`. */ domainName: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The unique string that that we created to identify the SipDomain resource. */ sid: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod: string; /** * The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. */ voiceFallbackUrl: string; /** * The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod: string; /** * The HTTP method we use to call `voice_status_callback_url`. Either `GET` or `POST`. */ voiceStatusCallbackMethod: string; /** * The URL that we call to pass status parameters (such as call ended) to your application. */ voiceStatusCallbackUrl: string; /** * The URL we call using the `voice_method` when the domain receives a call. */ voiceUrl: string; /** * A list of mapping resources associated with the SIP Domain resource identified by their relative URIs. */ subresourceUris: Record<string, string>; /** * Whether to allow SIP Endpoints to register with the domain to receive calls. */ sipRegistration: boolean; /** * Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. */ emergencyCallingEnabled: boolean; /** * Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. */ secure: boolean; /** * The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. */ byocTrunkSid: string; /** * Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. */ emergencyCallerSid: string; private get _proxy(); /** * Remove a DomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainInstance */ fetch(callback?: (error: Error | null, item?: DomainInstance) => any): Promise<DomainInstance>; /** * Update a DomainInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainInstance */ update(callback?: (error: Error | null, item?: DomainInstance) => any): Promise<DomainInstance>; /** * Update a DomainInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainInstance */ update(params: DomainContextUpdateOptions, callback?: (error: Error | null, item?: DomainInstance) => any): Promise<DomainInstance>; /** * Access the auth. */ auth(): AuthTypesListInstance; /** * Access the credentialListMappings. */ credentialListMappings(): CredentialListMappingListInstance; /** * Access the ipAccessControlListMappings. */ ipAccessControlListMappings(): IpAccessControlListMappingListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; authType: string; dateCreated: Date; dateUpdated: Date; domainName: string; friendlyName: string; sid: string; uri: string; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceStatusCallbackMethod: string; voiceStatusCallbackUrl: string; voiceUrl: string; subresourceUris: Record<string, string>; sipRegistration: boolean; emergencyCallingEnabled: boolean; secure: boolean; byocTrunkSid: string; emergencyCallerSid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DomainSolution { accountSid: string; } export interface DomainListInstance { _version: V2010; _solution: DomainSolution; _uri: string; (sid: string): DomainContext; get(sid: string): DomainContext; /** * Create a DomainInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainInstance */ create(params: DomainListInstanceCreateOptions, callback?: (error: Error | null, item?: DomainInstance) => any): Promise<DomainInstance>; /** * Streams DomainInstance 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 { DomainListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DomainInstance, done: (err?: Error) => void) => void): void; each(params: DomainListInstanceEachOptions, callback?: (item: DomainInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DomainInstance 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: DomainPage) => any): Promise<DomainPage>; /** * Lists DomainInstance 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 { DomainListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DomainInstance[]) => any): Promise<DomainInstance[]>; list(params: DomainListInstanceOptions, callback?: (error: Error | null, items: DomainInstance[]) => any): Promise<DomainInstance[]>; /** * Retrieve a single page of DomainInstance 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 { DomainListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DomainPage) => any): Promise<DomainPage>; page(params: DomainListInstancePageOptions, callback?: (error: Error | null, items: DomainPage) => any): Promise<DomainPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DomainListInstance(version: V2010, accountSid: string): DomainListInstance; export declare class DomainPage extends Page<V2010, DomainPayload, DomainResource, DomainInstance> { /** * Initialize the DomainPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: DomainSolution); /** * Build an instance of DomainInstance * * @param payload - Payload response from the API */ getInstance(payload: DomainResource): DomainInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/sip/credentialList.js000064400000024414151677225100014610 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.CredentialListPage = exports.CredentialListListInstance = exports.CredentialListInstance = exports.CredentialListContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const credential_1 = require("./credentialList/credential"); class CredentialListContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/CredentialLists/${sid}.json`; } get credentials() { this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._credentials; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialListInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialListInstance(operationVersion, payload, instance._solution.accountSid, 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.CredentialListContextImpl = CredentialListContextImpl; class CredentialListInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.sid = payload.sid; this.subresourceUris = payload.subresource_uris; this.uri = payload.uri; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CredentialListContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the credentials. */ credentials() { return this._proxy.credentials; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, sid: this.sid, subresourceUris: this.subresourceUris, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialListInstance = CredentialListInstance; function CredentialListListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialListContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/SIP/CredentialLists.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialListInstance(operationVersion, payload, instance._solution.accountSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialListPage(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 CredentialListPage(instance._version, payload, 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; } exports.CredentialListListInstance = CredentialListListInstance; class CredentialListPage extends Page_1.default { /** * Initialize the CredentialListPage * * @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 CredentialListInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialListInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialListPage = CredentialListPage; rest/api/v2010/account/sip/domain/authTypes.d.ts000064400000001651151677225100015331 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../../../V2010"; import { AuthTypeCallsListInstance } from "./authTypes/authTypeCalls"; import { AuthTypeRegistrationsListInstance } from "./authTypes/authTypeRegistrations"; export interface AuthTypesSolution { accountSid: string; domainSid: string; } export interface AuthTypesListInstance { _version: V2010; _solution: AuthTypesSolution; _uri: string; _calls?: AuthTypeCallsListInstance; calls: AuthTypeCallsListInstance; _registrations?: AuthTypeRegistrationsListInstance; registrations: AuthTypeRegistrationsListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthTypesListInstance(version: V2010, accountSid: string, domainSid: string): AuthTypesListInstance; rest/api/v2010/account/sip/domain/ipAccessControlListMapping.d.ts000064400000025643151677225100020615 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; /** * Options to pass to create a IpAccessControlListMappingInstance */ export interface IpAccessControlListMappingListInstanceCreateOptions { /** The unique id of the IP access control list to map to the SIP domain. */ ipAccessControlListSid: string; } /** * Options to pass to each */ export interface IpAccessControlListMappingListInstanceEachOptions { /** 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: IpAccessControlListMappingInstance, 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 IpAccessControlListMappingListInstanceOptions { /** 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 IpAccessControlListMappingListInstancePageOptions { /** 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 IpAccessControlListMappingContext { /** * Remove a IpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListMappingInstance */ fetch(callback?: (error: Error | null, item?: IpAccessControlListMappingInstance) => any): Promise<IpAccessControlListMappingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface IpAccessControlListMappingContextSolution { accountSid: string; domainSid: string; sid: string; } export declare class IpAccessControlListMappingContextImpl implements IpAccessControlListMappingContext { protected _version: V2010; protected _solution: IpAccessControlListMappingContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, domainSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: IpAccessControlListMappingInstance) => any): Promise<IpAccessControlListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): IpAccessControlListMappingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface IpAccessControlListMappingPayload extends TwilioResponsePayload { ip_access_control_list_mappings: IpAccessControlListMappingResource[]; } interface IpAccessControlListMappingResource { account_sid: string; date_created: Date; date_updated: Date; domain_sid: string; friendly_name: string; sid: string; uri: string; } export declare class IpAccessControlListMappingInstance { protected _version: V2010; protected _solution: IpAccessControlListMappingContextSolution; protected _context?: IpAccessControlListMappingContext; constructor(_version: V2010, payload: IpAccessControlListMappingResource, accountSid: string, domainSid: string, sid?: string); /** * The unique id of the Account that is responsible for this resource. */ accountSid: string; /** * The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateCreated: Date; /** * The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateUpdated: Date; /** * The unique string that is created to identify the SipDomain resource. */ domainSid: string; /** * A human readable descriptive text for this resource, up to 64 characters long. */ friendlyName: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The URI for this resource, relative to `https://api.twilio.com` */ uri: string; private get _proxy(); /** * Remove a IpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListMappingInstance */ fetch(callback?: (error: Error | null, item?: IpAccessControlListMappingInstance) => any): Promise<IpAccessControlListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; domainSid: string; friendlyName: string; sid: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface IpAccessControlListMappingSolution { accountSid: string; domainSid: string; } export interface IpAccessControlListMappingListInstance { _version: V2010; _solution: IpAccessControlListMappingSolution; _uri: string; (sid: string): IpAccessControlListMappingContext; get(sid: string): IpAccessControlListMappingContext; /** * Create a IpAccessControlListMappingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListMappingInstance */ create(params: IpAccessControlListMappingListInstanceCreateOptions, callback?: (error: Error | null, item?: IpAccessControlListMappingInstance) => any): Promise<IpAccessControlListMappingInstance>; /** * Streams IpAccessControlListMappingInstance 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 { IpAccessControlListMappingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: IpAccessControlListMappingInstance, done: (err?: Error) => void) => void): void; each(params: IpAccessControlListMappingListInstanceEachOptions, callback?: (item: IpAccessControlListMappingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of IpAccessControlListMappingInstance 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: IpAccessControlListMappingPage) => any): Promise<IpAccessControlListMappingPage>; /** * Lists IpAccessControlListMappingInstance 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 { IpAccessControlListMappingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: IpAccessControlListMappingInstance[]) => any): Promise<IpAccessControlListMappingInstance[]>; list(params: IpAccessControlListMappingListInstanceOptions, callback?: (error: Error | null, items: IpAccessControlListMappingInstance[]) => any): Promise<IpAccessControlListMappingInstance[]>; /** * Retrieve a single page of IpAccessControlListMappingInstance 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 { IpAccessControlListMappingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: IpAccessControlListMappingPage) => any): Promise<IpAccessControlListMappingPage>; page(params: IpAccessControlListMappingListInstancePageOptions, callback?: (error: Error | null, items: IpAccessControlListMappingPage) => any): Promise<IpAccessControlListMappingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function IpAccessControlListMappingListInstance(version: V2010, accountSid: string, domainSid: string): IpAccessControlListMappingListInstance; export declare class IpAccessControlListMappingPage extends Page<V2010, IpAccessControlListMappingPayload, IpAccessControlListMappingResource, IpAccessControlListMappingInstance> { /** * Initialize the IpAccessControlListMappingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: IpAccessControlListMappingSolution); /** * Build an instance of IpAccessControlListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload: IpAccessControlListMappingResource): IpAccessControlListMappingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/sip/domain/ipAccessControlListMapping.js000064400000023122151677225100020347 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.IpAccessControlListMappingPage = exports.IpAccessControlListMappingListInstance = exports.IpAccessControlListMappingInstance = exports.IpAccessControlListMappingContextImpl = void 0; 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 IpAccessControlListMappingContextImpl { constructor(_version, accountSid, domainSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, domainSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/IpAccessControlListMappings/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new IpAccessControlListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid, 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.IpAccessControlListMappingContextImpl = IpAccessControlListMappingContextImpl; class IpAccessControlListMappingInstance { constructor(_version, payload, accountSid, domainSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.domainSid = payload.domain_sid; this.friendlyName = payload.friendly_name; this.sid = payload.sid; this.uri = payload.uri; this._solution = { accountSid, domainSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new IpAccessControlListMappingContextImpl(this._version, this._solution.accountSid, this._solution.domainSid, this._solution.sid); return this._context; } /** * Remove a IpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a IpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListMappingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, domainSid: this.domainSid, friendlyName: this.friendlyName, sid: this.sid, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpAccessControlListMappingInstance = IpAccessControlListMappingInstance; function IpAccessControlListMappingListInstance(version, accountSid, domainSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new IpAccessControlListMappingContextImpl(version, accountSid, domainSid, sid); }; instance._version = version; instance._solution = { accountSid, domainSid }; instance._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/IpAccessControlListMappings.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["ipAccessControlListSid"] === null || params["ipAccessControlListSid"] === undefined) { throw new Error("Required parameter \"params['ipAccessControlListSid']\" missing."); } let data = {}; data["IpAccessControlListSid"] = params["ipAccessControlListSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IpAccessControlListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new IpAccessControlListMappingPage(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 IpAccessControlListMappingPage(instance._version, payload, 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; } exports.IpAccessControlListMappingListInstance = IpAccessControlListMappingListInstance; class IpAccessControlListMappingPage extends Page_1.default { /** * Initialize the IpAccessControlListMappingPage * * @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 IpAccessControlListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new IpAccessControlListMappingInstance(this._version, payload, this._solution.accountSid, this._solution.domainSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpAccessControlListMappingPage = IpAccessControlListMappingPage; rest/api/v2010/account/sip/domain/credentialListMapping.d.ts000064400000025104151677225100017624 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; /** * Options to pass to create a CredentialListMappingInstance */ export interface CredentialListMappingListInstanceCreateOptions { /** A 34 character string that uniquely identifies the CredentialList resource to map to the SIP domain. */ credentialListSid: string; } /** * Options to pass to each */ export interface CredentialListMappingListInstanceEachOptions { /** 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: CredentialListMappingInstance, 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 CredentialListMappingListInstanceOptions { /** 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 CredentialListMappingListInstancePageOptions { /** 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 CredentialListMappingContext { /** * Remove a CredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListMappingInstance */ fetch(callback?: (error: Error | null, item?: CredentialListMappingInstance) => any): Promise<CredentialListMappingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialListMappingContextSolution { accountSid: string; domainSid: string; sid: string; } export declare class CredentialListMappingContextImpl implements CredentialListMappingContext { protected _version: V2010; protected _solution: CredentialListMappingContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, domainSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialListMappingInstance) => any): Promise<CredentialListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialListMappingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialListMappingPayload extends TwilioResponsePayload { credential_list_mappings: CredentialListMappingResource[]; } interface CredentialListMappingResource { account_sid: string; date_created: Date; date_updated: Date; domain_sid: string; friendly_name: string; sid: string; uri: string; } export declare class CredentialListMappingInstance { protected _version: V2010; protected _solution: CredentialListMappingContextSolution; protected _context?: CredentialListMappingContext; constructor(_version: V2010, payload: CredentialListMappingResource, accountSid: string, domainSid: string, sid?: string); /** * The unique id of the Account that is responsible for this resource. */ accountSid: string; /** * The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateCreated: Date; /** * The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateUpdated: Date; /** * The unique string that is created to identify the SipDomain resource. */ domainSid: string; /** * A human readable descriptive text for this resource, up to 64 characters long. */ friendlyName: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The URI for this resource, relative to `https://api.twilio.com` */ uri: string; private get _proxy(); /** * Remove a CredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListMappingInstance */ fetch(callback?: (error: Error | null, item?: CredentialListMappingInstance) => any): Promise<CredentialListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; domainSid: string; friendlyName: string; sid: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialListMappingSolution { accountSid: string; domainSid: string; } export interface CredentialListMappingListInstance { _version: V2010; _solution: CredentialListMappingSolution; _uri: string; (sid: string): CredentialListMappingContext; get(sid: string): CredentialListMappingContext; /** * Create a CredentialListMappingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListMappingInstance */ create(params: CredentialListMappingListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialListMappingInstance) => any): Promise<CredentialListMappingInstance>; /** * Streams CredentialListMappingInstance 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 { CredentialListMappingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialListMappingInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListMappingListInstanceEachOptions, callback?: (item: CredentialListMappingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialListMappingInstance 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: CredentialListMappingPage) => any): Promise<CredentialListMappingPage>; /** * Lists CredentialListMappingInstance 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 { CredentialListMappingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialListMappingInstance[]) => any): Promise<CredentialListMappingInstance[]>; list(params: CredentialListMappingListInstanceOptions, callback?: (error: Error | null, items: CredentialListMappingInstance[]) => any): Promise<CredentialListMappingInstance[]>; /** * Retrieve a single page of CredentialListMappingInstance 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 { CredentialListMappingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialListMappingPage) => any): Promise<CredentialListMappingPage>; page(params: CredentialListMappingListInstancePageOptions, callback?: (error: Error | null, items: CredentialListMappingPage) => any): Promise<CredentialListMappingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListMappingListInstance(version: V2010, accountSid: string, domainSid: string): CredentialListMappingListInstance; export declare class CredentialListMappingPage extends Page<V2010, CredentialListMappingPayload, CredentialListMappingResource, CredentialListMappingInstance> { /** * Initialize the CredentialListMappingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: CredentialListMappingSolution); /** * Build an instance of CredentialListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialListMappingResource): CredentialListMappingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/sip/domain/credentialListMapping.js000064400000022643151677225100017375 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.CredentialListMappingPage = exports.CredentialListMappingListInstance = exports.CredentialListMappingInstance = exports.CredentialListMappingContextImpl = void 0; 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 CredentialListMappingContextImpl { constructor(_version, accountSid, domainSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, domainSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/CredentialListMappings/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid, 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.CredentialListMappingContextImpl = CredentialListMappingContextImpl; class CredentialListMappingInstance { constructor(_version, payload, accountSid, domainSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.domainSid = payload.domain_sid; this.friendlyName = payload.friendly_name; this.sid = payload.sid; this.uri = payload.uri; this._solution = { accountSid, domainSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CredentialListMappingContextImpl(this._version, this._solution.accountSid, this._solution.domainSid, this._solution.sid); return this._context; } /** * Remove a CredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListMappingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, domainSid: this.domainSid, friendlyName: this.friendlyName, sid: this.sid, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialListMappingInstance = CredentialListMappingInstance; function CredentialListMappingListInstance(version, accountSid, domainSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialListMappingContextImpl(version, accountSid, domainSid, sid); }; instance._version = version; instance._solution = { accountSid, domainSid }; instance._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/CredentialListMappings.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["credentialListSid"] === null || params["credentialListSid"] === undefined) { throw new Error("Required parameter \"params['credentialListSid']\" missing."); } let data = {}; data["CredentialListSid"] = params["credentialListSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialListMappingPage(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 CredentialListMappingPage(instance._version, payload, 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; } exports.CredentialListMappingListInstance = CredentialListMappingListInstance; class CredentialListMappingPage extends Page_1.default { /** * Initialize the CredentialListMappingPage * * @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 CredentialListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialListMappingInstance(this._version, payload, this._solution.accountSid, this._solution.domainSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialListMappingPage = CredentialListMappingPage; rest/api/v2010/account/sip/domain/authTypes/authTypeCalls.d.ts000064400000002202151677225100020104 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../../../../V2010"; import { AuthCallsCredentialListMappingListInstance } from "./authTypeCalls/authCallsCredentialListMapping"; import { AuthCallsIpAccessControlListMappingListInstance } from "./authTypeCalls/authCallsIpAccessControlListMapping"; export interface AuthTypeCallsSolution { accountSid: string; domainSid: string; } export interface AuthTypeCallsListInstance { _version: V2010; _solution: AuthTypeCallsSolution; _uri: string; _credentialListMappings?: AuthCallsCredentialListMappingListInstance; credentialListMappings: AuthCallsCredentialListMappingListInstance; _ipAccessControlListMappings?: AuthCallsIpAccessControlListMappingListInstance; ipAccessControlListMappings: AuthCallsIpAccessControlListMappingListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthTypeCallsListInstance(version: V2010, accountSid: string, domainSid: string): AuthTypeCallsListInstance; rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsIpAccessControlListMapping.d.ts000064400000026411151677225100027160 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../../../base/Page"; import Response from "../../../../../../../../http/response"; import V2010 from "../../../../../../V2010"; /** * Options to pass to create a AuthCallsIpAccessControlListMappingInstance */ export interface AuthCallsIpAccessControlListMappingListInstanceCreateOptions { /** The SID of the IpAccessControlList resource to map to the SIP domain. */ ipAccessControlListSid: string; } /** * Options to pass to each */ export interface AuthCallsIpAccessControlListMappingListInstanceEachOptions { /** 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: AuthCallsIpAccessControlListMappingInstance, 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 AuthCallsIpAccessControlListMappingListInstanceOptions { /** 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 AuthCallsIpAccessControlListMappingListInstancePageOptions { /** 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 AuthCallsIpAccessControlListMappingContext { /** * Remove a AuthCallsIpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AuthCallsIpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthCallsIpAccessControlListMappingInstance */ fetch(callback?: (error: Error | null, item?: AuthCallsIpAccessControlListMappingInstance) => any): Promise<AuthCallsIpAccessControlListMappingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AuthCallsIpAccessControlListMappingContextSolution { accountSid: string; domainSid: string; sid: string; } export declare class AuthCallsIpAccessControlListMappingContextImpl implements AuthCallsIpAccessControlListMappingContext { protected _version: V2010; protected _solution: AuthCallsIpAccessControlListMappingContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, domainSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AuthCallsIpAccessControlListMappingInstance) => any): Promise<AuthCallsIpAccessControlListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AuthCallsIpAccessControlListMappingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AuthCallsIpAccessControlListMappingPayload extends TwilioResponsePayload { contents: AuthCallsIpAccessControlListMappingResource[]; } interface AuthCallsIpAccessControlListMappingResource { account_sid: string; date_created: Date; date_updated: Date; friendly_name: string; sid: string; } export declare class AuthCallsIpAccessControlListMappingInstance { protected _version: V2010; protected _solution: AuthCallsIpAccessControlListMappingContextSolution; protected _context?: AuthCallsIpAccessControlListMappingContext; constructor(_version: V2010, payload: AuthCallsIpAccessControlListMappingResource, accountSid: string, domainSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resource. */ accountSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The unique string that that we created to identify the IpAccessControlListMapping resource. */ sid: string; private get _proxy(); /** * Remove a AuthCallsIpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AuthCallsIpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthCallsIpAccessControlListMappingInstance */ fetch(callback?: (error: Error | null, item?: AuthCallsIpAccessControlListMappingInstance) => any): Promise<AuthCallsIpAccessControlListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; sid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AuthCallsIpAccessControlListMappingSolution { accountSid: string; domainSid: string; } export interface AuthCallsIpAccessControlListMappingListInstance { _version: V2010; _solution: AuthCallsIpAccessControlListMappingSolution; _uri: string; (sid: string): AuthCallsIpAccessControlListMappingContext; get(sid: string): AuthCallsIpAccessControlListMappingContext; /** * Create a AuthCallsIpAccessControlListMappingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthCallsIpAccessControlListMappingInstance */ create(params: AuthCallsIpAccessControlListMappingListInstanceCreateOptions, callback?: (error: Error | null, item?: AuthCallsIpAccessControlListMappingInstance) => any): Promise<AuthCallsIpAccessControlListMappingInstance>; /** * Streams AuthCallsIpAccessControlListMappingInstance 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 { AuthCallsIpAccessControlListMappingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AuthCallsIpAccessControlListMappingInstance, done: (err?: Error) => void) => void): void; each(params: AuthCallsIpAccessControlListMappingListInstanceEachOptions, callback?: (item: AuthCallsIpAccessControlListMappingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AuthCallsIpAccessControlListMappingInstance 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: AuthCallsIpAccessControlListMappingPage) => any): Promise<AuthCallsIpAccessControlListMappingPage>; /** * Lists AuthCallsIpAccessControlListMappingInstance 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 { AuthCallsIpAccessControlListMappingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AuthCallsIpAccessControlListMappingInstance[]) => any): Promise<AuthCallsIpAccessControlListMappingInstance[]>; list(params: AuthCallsIpAccessControlListMappingListInstanceOptions, callback?: (error: Error | null, items: AuthCallsIpAccessControlListMappingInstance[]) => any): Promise<AuthCallsIpAccessControlListMappingInstance[]>; /** * Retrieve a single page of AuthCallsIpAccessControlListMappingInstance 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 { AuthCallsIpAccessControlListMappingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AuthCallsIpAccessControlListMappingPage) => any): Promise<AuthCallsIpAccessControlListMappingPage>; page(params: AuthCallsIpAccessControlListMappingListInstancePageOptions, callback?: (error: Error | null, items: AuthCallsIpAccessControlListMappingPage) => any): Promise<AuthCallsIpAccessControlListMappingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthCallsIpAccessControlListMappingListInstance(version: V2010, accountSid: string, domainSid: string): AuthCallsIpAccessControlListMappingListInstance; export declare class AuthCallsIpAccessControlListMappingPage extends Page<V2010, AuthCallsIpAccessControlListMappingPayload, AuthCallsIpAccessControlListMappingResource, AuthCallsIpAccessControlListMappingInstance> { /** * Initialize the AuthCallsIpAccessControlListMappingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AuthCallsIpAccessControlListMappingSolution); /** * Build an instance of AuthCallsIpAccessControlListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload: AuthCallsIpAccessControlListMappingResource): AuthCallsIpAccessControlListMappingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsCredentialListMapping.js000064400000023076151677225100025747 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AuthCallsCredentialListMappingPage = exports.AuthCallsCredentialListMappingListInstance = exports.AuthCallsCredentialListMappingInstance = exports.AuthCallsCredentialListMappingContextImpl = void 0; 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 AuthCallsCredentialListMappingContextImpl { constructor(_version, accountSid, domainSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, domainSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/Auth/Calls/CredentialListMappings/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AuthCallsCredentialListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid, 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.AuthCallsCredentialListMappingContextImpl = AuthCallsCredentialListMappingContextImpl; class AuthCallsCredentialListMappingInstance { constructor(_version, payload, accountSid, domainSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.sid = payload.sid; this._solution = { accountSid, domainSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AuthCallsCredentialListMappingContextImpl(this._version, this._solution.accountSid, this._solution.domainSid, this._solution.sid); return this._context; } /** * Remove a AuthCallsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AuthCallsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthCallsCredentialListMappingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, sid: this.sid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthCallsCredentialListMappingInstance = AuthCallsCredentialListMappingInstance; function AuthCallsCredentialListMappingListInstance(version, accountSid, domainSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AuthCallsCredentialListMappingContextImpl(version, accountSid, domainSid, sid); }; instance._version = version; instance._solution = { accountSid, domainSid }; instance._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/Auth/Calls/CredentialListMappings.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["credentialListSid"] === null || params["credentialListSid"] === undefined) { throw new Error("Required parameter \"params['credentialListSid']\" missing."); } let data = {}; data["CredentialListSid"] = params["credentialListSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AuthCallsCredentialListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AuthCallsCredentialListMappingPage(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 AuthCallsCredentialListMappingPage(instance._version, payload, 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; } exports.AuthCallsCredentialListMappingListInstance = AuthCallsCredentialListMappingListInstance; class AuthCallsCredentialListMappingPage extends Page_1.default { /** * Initialize the AuthCallsCredentialListMappingPage * * @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 AuthCallsCredentialListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AuthCallsCredentialListMappingInstance(this._version, payload, this._solution.accountSid, this._solution.domainSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthCallsCredentialListMappingPage = AuthCallsCredentialListMappingPage; rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsIpAccessControlListMapping.js000064400000023355151677225100026730 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AuthCallsIpAccessControlListMappingPage = exports.AuthCallsIpAccessControlListMappingListInstance = exports.AuthCallsIpAccessControlListMappingInstance = exports.AuthCallsIpAccessControlListMappingContextImpl = void 0; 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 AuthCallsIpAccessControlListMappingContextImpl { constructor(_version, accountSid, domainSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, domainSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/Auth/Calls/IpAccessControlListMappings/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AuthCallsIpAccessControlListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid, 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.AuthCallsIpAccessControlListMappingContextImpl = AuthCallsIpAccessControlListMappingContextImpl; class AuthCallsIpAccessControlListMappingInstance { constructor(_version, payload, accountSid, domainSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.sid = payload.sid; this._solution = { accountSid, domainSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AuthCallsIpAccessControlListMappingContextImpl(this._version, this._solution.accountSid, this._solution.domainSid, this._solution.sid); return this._context; } /** * Remove a AuthCallsIpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AuthCallsIpAccessControlListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthCallsIpAccessControlListMappingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, sid: this.sid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthCallsIpAccessControlListMappingInstance = AuthCallsIpAccessControlListMappingInstance; function AuthCallsIpAccessControlListMappingListInstance(version, accountSid, domainSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AuthCallsIpAccessControlListMappingContextImpl(version, accountSid, domainSid, sid); }; instance._version = version; instance._solution = { accountSid, domainSid }; instance._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/Auth/Calls/IpAccessControlListMappings.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["ipAccessControlListSid"] === null || params["ipAccessControlListSid"] === undefined) { throw new Error("Required parameter \"params['ipAccessControlListSid']\" missing."); } let data = {}; data["IpAccessControlListSid"] = params["ipAccessControlListSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AuthCallsIpAccessControlListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AuthCallsIpAccessControlListMappingPage(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 AuthCallsIpAccessControlListMappingPage(instance._version, payload, 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; } exports.AuthCallsIpAccessControlListMappingListInstance = AuthCallsIpAccessControlListMappingListInstance; class AuthCallsIpAccessControlListMappingPage extends Page_1.default { /** * Initialize the AuthCallsIpAccessControlListMappingPage * * @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 AuthCallsIpAccessControlListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AuthCallsIpAccessControlListMappingInstance(this._version, payload, this._solution.accountSid, this._solution.domainSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthCallsIpAccessControlListMappingPage = AuthCallsIpAccessControlListMappingPage; rest/api/v2010/account/sip/domain/authTypes/authTypeCalls/authCallsCredentialListMapping.d.ts000064400000025603151677225100026201 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../../../base/Page"; import Response from "../../../../../../../../http/response"; import V2010 from "../../../../../../V2010"; /** * Options to pass to create a AuthCallsCredentialListMappingInstance */ export interface AuthCallsCredentialListMappingListInstanceCreateOptions { /** The SID of the CredentialList resource to map to the SIP domain. */ credentialListSid: string; } /** * Options to pass to each */ export interface AuthCallsCredentialListMappingListInstanceEachOptions { /** 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: AuthCallsCredentialListMappingInstance, 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 AuthCallsCredentialListMappingListInstanceOptions { /** 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 AuthCallsCredentialListMappingListInstancePageOptions { /** 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 AuthCallsCredentialListMappingContext { /** * Remove a AuthCallsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AuthCallsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthCallsCredentialListMappingInstance */ fetch(callback?: (error: Error | null, item?: AuthCallsCredentialListMappingInstance) => any): Promise<AuthCallsCredentialListMappingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AuthCallsCredentialListMappingContextSolution { accountSid: string; domainSid: string; sid: string; } export declare class AuthCallsCredentialListMappingContextImpl implements AuthCallsCredentialListMappingContext { protected _version: V2010; protected _solution: AuthCallsCredentialListMappingContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, domainSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AuthCallsCredentialListMappingInstance) => any): Promise<AuthCallsCredentialListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AuthCallsCredentialListMappingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AuthCallsCredentialListMappingPayload extends TwilioResponsePayload { contents: AuthCallsCredentialListMappingResource[]; } interface AuthCallsCredentialListMappingResource { account_sid: string; date_created: Date; date_updated: Date; friendly_name: string; sid: string; } export declare class AuthCallsCredentialListMappingInstance { protected _version: V2010; protected _solution: AuthCallsCredentialListMappingContextSolution; protected _context?: AuthCallsCredentialListMappingContext; constructor(_version: V2010, payload: AuthCallsCredentialListMappingResource, accountSid: string, domainSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. */ accountSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The unique string that that we created to identify the CredentialListMapping resource. */ sid: string; private get _proxy(); /** * Remove a AuthCallsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AuthCallsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthCallsCredentialListMappingInstance */ fetch(callback?: (error: Error | null, item?: AuthCallsCredentialListMappingInstance) => any): Promise<AuthCallsCredentialListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; sid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AuthCallsCredentialListMappingSolution { accountSid: string; domainSid: string; } export interface AuthCallsCredentialListMappingListInstance { _version: V2010; _solution: AuthCallsCredentialListMappingSolution; _uri: string; (sid: string): AuthCallsCredentialListMappingContext; get(sid: string): AuthCallsCredentialListMappingContext; /** * Create a AuthCallsCredentialListMappingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthCallsCredentialListMappingInstance */ create(params: AuthCallsCredentialListMappingListInstanceCreateOptions, callback?: (error: Error | null, item?: AuthCallsCredentialListMappingInstance) => any): Promise<AuthCallsCredentialListMappingInstance>; /** * Streams AuthCallsCredentialListMappingInstance 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 { AuthCallsCredentialListMappingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AuthCallsCredentialListMappingInstance, done: (err?: Error) => void) => void): void; each(params: AuthCallsCredentialListMappingListInstanceEachOptions, callback?: (item: AuthCallsCredentialListMappingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AuthCallsCredentialListMappingInstance 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: AuthCallsCredentialListMappingPage) => any): Promise<AuthCallsCredentialListMappingPage>; /** * Lists AuthCallsCredentialListMappingInstance 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 { AuthCallsCredentialListMappingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AuthCallsCredentialListMappingInstance[]) => any): Promise<AuthCallsCredentialListMappingInstance[]>; list(params: AuthCallsCredentialListMappingListInstanceOptions, callback?: (error: Error | null, items: AuthCallsCredentialListMappingInstance[]) => any): Promise<AuthCallsCredentialListMappingInstance[]>; /** * Retrieve a single page of AuthCallsCredentialListMappingInstance 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 { AuthCallsCredentialListMappingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AuthCallsCredentialListMappingPage) => any): Promise<AuthCallsCredentialListMappingPage>; page(params: AuthCallsCredentialListMappingListInstancePageOptions, callback?: (error: Error | null, items: AuthCallsCredentialListMappingPage) => any): Promise<AuthCallsCredentialListMappingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthCallsCredentialListMappingListInstance(version: V2010, accountSid: string, domainSid: string): AuthCallsCredentialListMappingListInstance; export declare class AuthCallsCredentialListMappingPage extends Page<V2010, AuthCallsCredentialListMappingPayload, AuthCallsCredentialListMappingResource, AuthCallsCredentialListMappingInstance> { /** * Initialize the AuthCallsCredentialListMappingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AuthCallsCredentialListMappingSolution); /** * Build an instance of AuthCallsCredentialListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload: AuthCallsCredentialListMappingResource): AuthCallsCredentialListMappingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; v2010/account/sip/domain/authTypes/authTypeRegistrations/authRegistrationsCredentialListMapping.d.ts000064400000026723151677225100031524 0ustar00rest/api/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../../../base/Page"; import Response from "../../../../../../../../http/response"; import V2010 from "../../../../../../V2010"; /** * Options to pass to create a AuthRegistrationsCredentialListMappingInstance */ export interface AuthRegistrationsCredentialListMappingListInstanceCreateOptions { /** The SID of the CredentialList resource to map to the SIP domain. */ credentialListSid: string; } /** * Options to pass to each */ export interface AuthRegistrationsCredentialListMappingListInstanceEachOptions { /** 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: AuthRegistrationsCredentialListMappingInstance, 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 AuthRegistrationsCredentialListMappingListInstanceOptions { /** 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 AuthRegistrationsCredentialListMappingListInstancePageOptions { /** 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 AuthRegistrationsCredentialListMappingContext { /** * Remove a AuthRegistrationsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AuthRegistrationsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthRegistrationsCredentialListMappingInstance */ fetch(callback?: (error: Error | null, item?: AuthRegistrationsCredentialListMappingInstance) => any): Promise<AuthRegistrationsCredentialListMappingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AuthRegistrationsCredentialListMappingContextSolution { accountSid: string; domainSid: string; sid: string; } export declare class AuthRegistrationsCredentialListMappingContextImpl implements AuthRegistrationsCredentialListMappingContext { protected _version: V2010; protected _solution: AuthRegistrationsCredentialListMappingContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, domainSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AuthRegistrationsCredentialListMappingInstance) => any): Promise<AuthRegistrationsCredentialListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AuthRegistrationsCredentialListMappingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AuthRegistrationsCredentialListMappingPayload extends TwilioResponsePayload { contents: AuthRegistrationsCredentialListMappingResource[]; } interface AuthRegistrationsCredentialListMappingResource { account_sid: string; date_created: Date; date_updated: Date; friendly_name: string; sid: string; } export declare class AuthRegistrationsCredentialListMappingInstance { protected _version: V2010; protected _solution: AuthRegistrationsCredentialListMappingContextSolution; protected _context?: AuthRegistrationsCredentialListMappingContext; constructor(_version: V2010, payload: AuthRegistrationsCredentialListMappingResource, accountSid: string, domainSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. */ accountSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The unique string that that we created to identify the CredentialListMapping resource. */ sid: string; private get _proxy(); /** * Remove a AuthRegistrationsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AuthRegistrationsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthRegistrationsCredentialListMappingInstance */ fetch(callback?: (error: Error | null, item?: AuthRegistrationsCredentialListMappingInstance) => any): Promise<AuthRegistrationsCredentialListMappingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; sid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AuthRegistrationsCredentialListMappingSolution { accountSid: string; domainSid: string; } export interface AuthRegistrationsCredentialListMappingListInstance { _version: V2010; _solution: AuthRegistrationsCredentialListMappingSolution; _uri: string; (sid: string): AuthRegistrationsCredentialListMappingContext; get(sid: string): AuthRegistrationsCredentialListMappingContext; /** * Create a AuthRegistrationsCredentialListMappingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthRegistrationsCredentialListMappingInstance */ create(params: AuthRegistrationsCredentialListMappingListInstanceCreateOptions, callback?: (error: Error | null, item?: AuthRegistrationsCredentialListMappingInstance) => any): Promise<AuthRegistrationsCredentialListMappingInstance>; /** * Streams AuthRegistrationsCredentialListMappingInstance 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 { AuthRegistrationsCredentialListMappingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AuthRegistrationsCredentialListMappingInstance, done: (err?: Error) => void) => void): void; each(params: AuthRegistrationsCredentialListMappingListInstanceEachOptions, callback?: (item: AuthRegistrationsCredentialListMappingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AuthRegistrationsCredentialListMappingInstance 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: AuthRegistrationsCredentialListMappingPage) => any): Promise<AuthRegistrationsCredentialListMappingPage>; /** * Lists AuthRegistrationsCredentialListMappingInstance 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 { AuthRegistrationsCredentialListMappingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AuthRegistrationsCredentialListMappingInstance[]) => any): Promise<AuthRegistrationsCredentialListMappingInstance[]>; list(params: AuthRegistrationsCredentialListMappingListInstanceOptions, callback?: (error: Error | null, items: AuthRegistrationsCredentialListMappingInstance[]) => any): Promise<AuthRegistrationsCredentialListMappingInstance[]>; /** * Retrieve a single page of AuthRegistrationsCredentialListMappingInstance 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 { AuthRegistrationsCredentialListMappingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AuthRegistrationsCredentialListMappingPage) => any): Promise<AuthRegistrationsCredentialListMappingPage>; page(params: AuthRegistrationsCredentialListMappingListInstancePageOptions, callback?: (error: Error | null, items: AuthRegistrationsCredentialListMappingPage) => any): Promise<AuthRegistrationsCredentialListMappingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthRegistrationsCredentialListMappingListInstance(version: V2010, accountSid: string, domainSid: string): AuthRegistrationsCredentialListMappingListInstance; export declare class AuthRegistrationsCredentialListMappingPage extends Page<V2010, AuthRegistrationsCredentialListMappingPayload, AuthRegistrationsCredentialListMappingResource, AuthRegistrationsCredentialListMappingInstance> { /** * Initialize the AuthRegistrationsCredentialListMappingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AuthRegistrationsCredentialListMappingSolution); /** * Build an instance of AuthRegistrationsCredentialListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload: AuthRegistrationsCredentialListMappingResource): AuthRegistrationsCredentialListMappingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; v2010/account/sip/domain/authTypes/authTypeRegistrations/authRegistrationsCredentialListMapping.js000064400000023456151677225100031270 0ustar00rest/api"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AuthRegistrationsCredentialListMappingPage = exports.AuthRegistrationsCredentialListMappingListInstance = exports.AuthRegistrationsCredentialListMappingInstance = exports.AuthRegistrationsCredentialListMappingContextImpl = void 0; 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 AuthRegistrationsCredentialListMappingContextImpl { constructor(_version, accountSid, domainSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, domainSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/Auth/Registrations/CredentialListMappings/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AuthRegistrationsCredentialListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid, 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.AuthRegistrationsCredentialListMappingContextImpl = AuthRegistrationsCredentialListMappingContextImpl; class AuthRegistrationsCredentialListMappingInstance { constructor(_version, payload, accountSid, domainSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.sid = payload.sid; this._solution = { accountSid, domainSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AuthRegistrationsCredentialListMappingContextImpl(this._version, this._solution.accountSid, this._solution.domainSid, this._solution.sid); return this._context; } /** * Remove a AuthRegistrationsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AuthRegistrationsCredentialListMappingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthRegistrationsCredentialListMappingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, sid: this.sid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthRegistrationsCredentialListMappingInstance = AuthRegistrationsCredentialListMappingInstance; function AuthRegistrationsCredentialListMappingListInstance(version, accountSid, domainSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AuthRegistrationsCredentialListMappingContextImpl(version, accountSid, domainSid, sid); }; instance._version = version; instance._solution = { accountSid, domainSid }; instance._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/Auth/Registrations/CredentialListMappings.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["credentialListSid"] === null || params["credentialListSid"] === undefined) { throw new Error("Required parameter \"params['credentialListSid']\" missing."); } let data = {}; data["CredentialListSid"] = params["credentialListSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AuthRegistrationsCredentialListMappingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.domainSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AuthRegistrationsCredentialListMappingPage(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 AuthRegistrationsCredentialListMappingPage(instance._version, payload, 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; } exports.AuthRegistrationsCredentialListMappingListInstance = AuthRegistrationsCredentialListMappingListInstance; class AuthRegistrationsCredentialListMappingPage extends Page_1.default { /** * Initialize the AuthRegistrationsCredentialListMappingPage * * @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 AuthRegistrationsCredentialListMappingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AuthRegistrationsCredentialListMappingInstance(this._version, payload, this._solution.accountSid, this._solution.domainSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthRegistrationsCredentialListMappingPage = AuthRegistrationsCredentialListMappingPage; rest/api/v2010/account/sip/domain/authTypes/authTypeRegistrations.d.ts000064400000001665151677225100021717 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../../../../V2010"; import { AuthRegistrationsCredentialListMappingListInstance } from "./authTypeRegistrations/authRegistrationsCredentialListMapping"; export interface AuthTypeRegistrationsSolution { accountSid: string; domainSid: string; } export interface AuthTypeRegistrationsListInstance { _version: V2010; _solution: AuthTypeRegistrationsSolution; _uri: string; _credentialListMappings?: AuthRegistrationsCredentialListMappingListInstance; credentialListMappings: AuthRegistrationsCredentialListMappingListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthTypeRegistrationsListInstance(version: V2010, accountSid: string, domainSid: string): AuthTypeRegistrationsListInstance; rest/api/v2010/account/sip/domain/authTypes/authTypeCalls.js000064400000005520151677225100017656 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AuthTypeCallsListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../../../base/deserialize"); const serialize = require("../../../../../../../base/serialize"); const utility_1 = require("../../../../../../../base/utility"); const authCallsCredentialListMapping_1 = require("./authTypeCalls/authCallsCredentialListMapping"); const authCallsIpAccessControlListMapping_1 = require("./authTypeCalls/authCallsIpAccessControlListMapping"); function AuthTypeCallsListInstance(version, accountSid, domainSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, domainSid }; instance._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/Auth/Calls.json`; Object.defineProperty(instance, "credentialListMappings", { get: function credentialListMappings() { if (!instance._credentialListMappings) { instance._credentialListMappings = (0, authCallsCredentialListMapping_1.AuthCallsCredentialListMappingListInstance)(instance._version, instance._solution.accountSid, instance._solution.domainSid); } return instance._credentialListMappings; }, }); Object.defineProperty(instance, "ipAccessControlListMappings", { get: function ipAccessControlListMappings() { if (!instance._ipAccessControlListMappings) { instance._ipAccessControlListMappings = (0, authCallsIpAccessControlListMapping_1.AuthCallsIpAccessControlListMappingListInstance)(instance._version, instance._solution.accountSid, instance._solution.domainSid); } return instance._ipAccessControlListMappings; }, }); 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; } exports.AuthTypeCallsListInstance = AuthTypeCallsListInstance; rest/api/v2010/account/sip/domain/authTypes/authTypeRegistrations.js000064400000004452151677225100021460 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AuthTypeRegistrationsListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../../../base/deserialize"); const serialize = require("../../../../../../../base/serialize"); const utility_1 = require("../../../../../../../base/utility"); const authRegistrationsCredentialListMapping_1 = require("./authTypeRegistrations/authRegistrationsCredentialListMapping"); function AuthTypeRegistrationsListInstance(version, accountSid, domainSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, domainSid }; instance._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/Auth/Registrations.json`; Object.defineProperty(instance, "credentialListMappings", { get: function credentialListMappings() { if (!instance._credentialListMappings) { instance._credentialListMappings = (0, authRegistrationsCredentialListMapping_1.AuthRegistrationsCredentialListMappingListInstance)(instance._version, instance._solution.accountSid, instance._solution.domainSid); } return instance._credentialListMappings; }, }); 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; } exports.AuthTypeRegistrationsListInstance = AuthTypeRegistrationsListInstance; rest/api/v2010/account/sip/domain/authTypes.js000064400000004752151677225100015102 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AuthTypesListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); const authTypeCalls_1 = require("./authTypes/authTypeCalls"); const authTypeRegistrations_1 = require("./authTypes/authTypeRegistrations"); function AuthTypesListInstance(version, accountSid, domainSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, domainSid }; instance._uri = `/Accounts/${accountSid}/SIP/Domains/${domainSid}/Auth.json`; Object.defineProperty(instance, "calls", { get: function calls() { if (!instance._calls) { instance._calls = (0, authTypeCalls_1.AuthTypeCallsListInstance)(instance._version, instance._solution.accountSid, instance._solution.domainSid); } return instance._calls; }, }); Object.defineProperty(instance, "registrations", { get: function registrations() { if (!instance._registrations) { instance._registrations = (0, authTypeRegistrations_1.AuthTypeRegistrationsListInstance)(instance._version, instance._solution.accountSid, instance._solution.domainSid); } return instance._registrations; }, }); 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; } exports.AuthTypesListInstance = AuthTypesListInstance; rest/api/v2010/account/sip/ipAccessControlList/ipAddress.d.ts000064400000031444151677225100017744 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V2010 from "../../../../V2010"; /** * Options to pass to update a IpAddressInstance */ export interface IpAddressContextUpdateOptions { /** An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. */ ipAddress?: string; /** A human readable descriptive text for this resource, up to 255 characters long. */ friendlyName?: string; /** An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. */ cidrPrefixLength?: number; } /** * Options to pass to create a IpAddressInstance */ export interface IpAddressListInstanceCreateOptions { /** A human readable descriptive text for this resource, up to 255 characters long. */ friendlyName: string; /** An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. */ ipAddress: string; /** An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. */ cidrPrefixLength?: number; } /** * Options to pass to each */ export interface IpAddressListInstanceEachOptions { /** 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: IpAddressInstance, 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 IpAddressListInstanceOptions { /** 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 IpAddressListInstancePageOptions { /** 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 IpAddressContext { /** * Remove a IpAddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpAddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAddressInstance */ fetch(callback?: (error: Error | null, item?: IpAddressInstance) => any): Promise<IpAddressInstance>; /** * Update a IpAddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAddressInstance */ update(callback?: (error: Error | null, item?: IpAddressInstance) => any): Promise<IpAddressInstance>; /** * Update a IpAddressInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAddressInstance */ update(params: IpAddressContextUpdateOptions, callback?: (error: Error | null, item?: IpAddressInstance) => any): Promise<IpAddressInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface IpAddressContextSolution { accountSid: string; ipAccessControlListSid: string; sid: string; } export declare class IpAddressContextImpl implements IpAddressContext { protected _version: V2010; protected _solution: IpAddressContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, ipAccessControlListSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: IpAddressInstance) => any): Promise<IpAddressInstance>; update(params?: IpAddressContextUpdateOptions | ((error: Error | null, item?: IpAddressInstance) => any), callback?: (error: Error | null, item?: IpAddressInstance) => any): Promise<IpAddressInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): IpAddressContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface IpAddressPayload extends TwilioResponsePayload { ip_addresses: IpAddressResource[]; } interface IpAddressResource { sid: string; account_sid: string; friendly_name: string; ip_address: string; cidr_prefix_length: number; ip_access_control_list_sid: string; date_created: Date; date_updated: Date; uri: string; } export declare class IpAddressInstance { protected _version: V2010; protected _solution: IpAddressContextSolution; protected _context?: IpAddressContext; constructor(_version: V2010, payload: IpAddressResource, accountSid: string, ipAccessControlListSid: string, sid?: string); /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The unique id of the Account that is responsible for this resource. */ accountSid: string; /** * A human readable descriptive text for this resource, up to 255 characters long. */ friendlyName: string; /** * An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. */ ipAddress: string; /** * An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. */ cidrPrefixLength: number; /** * The unique id of the IpAccessControlList resource that includes this resource. */ ipAccessControlListSid: string; /** * The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateCreated: Date; /** * The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ dateUpdated: Date; /** * The URI for this resource, relative to `https://api.twilio.com` */ uri: string; private get _proxy(); /** * Remove a IpAddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpAddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAddressInstance */ fetch(callback?: (error: Error | null, item?: IpAddressInstance) => any): Promise<IpAddressInstance>; /** * Update a IpAddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAddressInstance */ update(callback?: (error: Error | null, item?: IpAddressInstance) => any): Promise<IpAddressInstance>; /** * Update a IpAddressInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAddressInstance */ update(params: IpAddressContextUpdateOptions, callback?: (error: Error | null, item?: IpAddressInstance) => any): Promise<IpAddressInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; ipAddress: string; cidrPrefixLength: number; ipAccessControlListSid: string; dateCreated: Date; dateUpdated: Date; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface IpAddressSolution { accountSid: string; ipAccessControlListSid: string; } export interface IpAddressListInstance { _version: V2010; _solution: IpAddressSolution; _uri: string; (sid: string): IpAddressContext; get(sid: string): IpAddressContext; /** * Create a IpAddressInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAddressInstance */ create(params: IpAddressListInstanceCreateOptions, callback?: (error: Error | null, item?: IpAddressInstance) => any): Promise<IpAddressInstance>; /** * Streams IpAddressInstance 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 { IpAddressListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: IpAddressInstance, done: (err?: Error) => void) => void): void; each(params: IpAddressListInstanceEachOptions, callback?: (item: IpAddressInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of IpAddressInstance 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: IpAddressPage) => any): Promise<IpAddressPage>; /** * Lists IpAddressInstance 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 { IpAddressListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: IpAddressInstance[]) => any): Promise<IpAddressInstance[]>; list(params: IpAddressListInstanceOptions, callback?: (error: Error | null, items: IpAddressInstance[]) => any): Promise<IpAddressInstance[]>; /** * Retrieve a single page of IpAddressInstance 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 { IpAddressListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: IpAddressPage) => any): Promise<IpAddressPage>; page(params: IpAddressListInstancePageOptions, callback?: (error: Error | null, items: IpAddressPage) => any): Promise<IpAddressPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function IpAddressListInstance(version: V2010, accountSid: string, ipAccessControlListSid: string): IpAddressListInstance; export declare class IpAddressPage extends Page<V2010, IpAddressPayload, IpAddressResource, IpAddressInstance> { /** * Initialize the IpAddressPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: IpAddressSolution); /** * Build an instance of IpAddressInstance * * @param payload - Payload response from the API */ getInstance(payload: IpAddressResource): IpAddressInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/sip/ipAccessControlList/ipAddress.js000064400000026333151677225100017511 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.IpAddressPage = exports.IpAddressListInstance = exports.IpAddressInstance = exports.IpAddressContextImpl = void 0; 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 IpAddressContextImpl { constructor(_version, accountSid, ipAccessControlListSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(ipAccessControlListSid)) { throw new Error("Parameter 'ipAccessControlListSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, ipAccessControlListSid, sid }; this._uri = `/Accounts/${accountSid}/SIP/IpAccessControlLists/${ipAccessControlListSid}/IpAddresses/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new IpAddressInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.ipAccessControlListSid, 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["ipAddress"] !== undefined) data["IpAddress"] = params["ipAddress"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["cidrPrefixLength"] !== undefined) data["CidrPrefixLength"] = params["cidrPrefixLength"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IpAddressInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.ipAccessControlListSid, 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.IpAddressContextImpl = IpAddressContextImpl; class IpAddressInstance { constructor(_version, payload, accountSid, ipAccessControlListSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.ipAddress = payload.ip_address; this.cidrPrefixLength = deserialize.integer(payload.cidr_prefix_length); this.ipAccessControlListSid = payload.ip_access_control_list_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.uri = payload.uri; this._solution = { accountSid, ipAccessControlListSid, sid: sid || this.sid, }; } get _proxy() { this._context = this._context || new IpAddressContextImpl(this._version, this._solution.accountSid, this._solution.ipAccessControlListSid, this._solution.sid); return this._context; } /** * Remove a IpAddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a IpAddressInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAddressInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, ipAddress: this.ipAddress, cidrPrefixLength: this.cidrPrefixLength, ipAccessControlListSid: this.ipAccessControlListSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpAddressInstance = IpAddressInstance; function IpAddressListInstance(version, accountSid, ipAccessControlListSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(ipAccessControlListSid)) { throw new Error("Parameter 'ipAccessControlListSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new IpAddressContextImpl(version, accountSid, ipAccessControlListSid, sid); }; instance._version = version; instance._solution = { accountSid, ipAccessControlListSid }; instance._uri = `/Accounts/${accountSid}/SIP/IpAccessControlLists/${ipAccessControlListSid}/IpAddresses.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["ipAddress"] === null || params["ipAddress"] === undefined) { throw new Error("Required parameter \"params['ipAddress']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["IpAddress"] = params["ipAddress"]; if (params["cidrPrefixLength"] !== undefined) data["CidrPrefixLength"] = params["cidrPrefixLength"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IpAddressInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.ipAccessControlListSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new IpAddressPage(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 IpAddressPage(instance._version, payload, 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; } exports.IpAddressListInstance = IpAddressListInstance; class IpAddressPage extends Page_1.default { /** * Initialize the IpAddressPage * * @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 IpAddressInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new IpAddressInstance(this._version, payload, this._solution.accountSid, this._solution.ipAccessControlListSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpAddressPage = IpAddressPage; rest/api/v2010/account/message.d.ts000064400000065623151677225100012736 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; import { FeedbackListInstance } from "./message/feedback"; import { MediaListInstance } from "./message/media"; export type MessageAddressRetention = "retain" | "obfuscate"; export type MessageContentRetention = "retain" | "discard"; export type MessageDirection = "inbound" | "outbound-api" | "outbound-call" | "outbound-reply"; export type MessageRiskCheck = "enable" | "disable"; export type MessageScheduleType = "fixed"; export type MessageStatus = "queued" | "sending" | "sent" | "failed" | "delivered" | "undelivered" | "receiving" | "received" | "accepted" | "scheduled" | "read" | "partially_delivered" | "canceled"; export type MessageUpdateStatus = "canceled"; /** * Options to pass to update a MessageInstance */ export interface MessageContextUpdateOptions { /** The new `body` of the Message resource. To redact the text content of a Message, this parameter\\\'s value must be an empty string */ body?: string; /** */ status?: MessageUpdateStatus; } /** * Options to pass to create a MessageInstance */ export interface MessageListInstanceCreateOptions { /** The recipient\\\'s phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (for SMS/MMS) or [channel address](https://www.twilio.com/docs/messaging/channels), e.g. `whatsapp:+15552229999`. */ to: string; /** The URL of the endpoint to which Twilio sends [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url). URL must contain a valid hostname and underscores are not allowed. If you include this parameter with the `messaging_service_sid`, Twilio uses this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource). */ statusCallback?: string; /** The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App\\\'s `message_status_callback` URL. Note that the `status_callback` parameter of a request takes priority over the `application_sid` parameter; if both are included `application_sid` is ignored. */ applicationSid?: string; /** [OBSOLETE] This parameter will no longer have any effect as of 2024-06-03. */ maxPrice?: number; /** Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. */ provideFeedback?: boolean; /** Total number of attempts made (including this request) to send the message regardless of the provider used */ attempt?: number; /** The maximum length in seconds that the Message can remain in Twilio\\\'s outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `36000`. Default value is `36000`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) */ validityPeriod?: number; /** Reserved */ forceDelivery?: boolean; /** */ contentRetention?: MessageContentRetention; /** */ addressRetention?: MessageAddressRetention; /** Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. */ smartEncoded?: boolean; /** Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). */ persistentAction?: Array<string>; /** For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. */ shortenUrls?: boolean; /** */ scheduleType?: MessageScheduleType; /** The time that Twilio will send the message. Must be in ISO 8601 format. */ sendAt?: Date; /** If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. */ sendAsMms?: boolean; /** For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template\\\'s default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. */ contentVariables?: string; /** */ riskCheck?: MessageRiskCheck; /** The sender\\\'s Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service\\\'s Sender Pool) or you can provide a specific sender from your Sender Pool. */ from?: string; /** The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service\\\'s Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. */ messagingServiceSid?: string; /** The text content of the outgoing message. Can be up to 1,600 characters in length. SMS only: If the `body` contains more than 160 [GSM-7](https://www.twilio.com/docs/glossary/what-is-gsm-7-character-encoding) characters (or 70 [UCS-2](https://www.twilio.com/docs/glossary/what-is-ucs-2-character-encoding) characters), the message is segmented and charged accordingly. For long `body` text, consider using the [send_as_mms parameter](https://www.twilio.com/blog/mms-for-long-text-messages). */ body?: string; /** The URL of media to include in the Message content. `jpeg`, `jpg`, `gif`, and `png` file types are fully supported by Twilio and content is formatted for delivery on destination devices. The media size limit is 5 MB for supported file types (`jpeg`, `jpg`, `png`, `gif`) and 500 KB for [other types](https://www.twilio.com/docs/messaging/guides/accepted-mime-types) of accepted media. To send more than one image in the message, provide multiple `media_url` parameters in the POST request. You can include up to ten `media_url` parameters per message. [International](https://support.twilio.com/hc/en-us/articles/223179808-Sending-and-receiving-MMS-messages) and [carrier](https://support.twilio.com/hc/en-us/articles/223133707-Is-MMS-supported-for-all-carriers-in-US-and-Canada-) limits apply. */ mediaUrl?: Array<string>; /** For [Content Editor/API](https://www.twilio.com/docs/content) only: The SID of the Content Template to be used with the Message, e.g., `HXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`. If this parameter is not provided, a Content Template is not used. Find the SID in the Console on the Content Editor page. For Content API users, the SID is found in Twilio\\\'s response when [creating the Template](https://www.twilio.com/docs/content/content-api-resources#create-templates) or by [fetching your Templates](https://www.twilio.com/docs/content/content-api-resources#fetch-all-content-resources). */ contentSid?: string; } /** * Options to pass to each */ export interface MessageListInstanceEachOptions { /** Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` */ to?: string; /** Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` */ from?: string; /** Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). */ dateSent?: Date; /** Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). */ dateSentBefore?: Date; /** Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). */ dateSentAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: MessageInstance, 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 MessageListInstanceOptions { /** Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` */ to?: string; /** Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` */ from?: string; /** Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). */ dateSent?: Date; /** Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). */ dateSentBefore?: Date; /** Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). */ dateSentAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface MessageListInstancePageOptions { /** Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` */ to?: string; /** Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` */ from?: string; /** Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). */ dateSent?: Date; /** Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). */ dateSentBefore?: Date; /** Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). */ dateSentAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface MessageContext { feedback: FeedbackListInstance; media: MediaListInstance; /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MessageContextSolution { accountSid: string; sid: string; } export declare class MessageContextImpl implements MessageContext { protected _version: V2010; protected _solution: MessageContextSolution; protected _uri: string; protected _feedback?: FeedbackListInstance; protected _media?: MediaListInstance; constructor(_version: V2010, accountSid: string, sid: string); get feedback(): FeedbackListInstance; get media(): MediaListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; update(params?: MessageContextUpdateOptions | ((error: Error | null, item?: MessageInstance) => any), callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MessageContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MessagePayload extends TwilioResponsePayload { messages: MessageResource[]; } interface MessageResource { body: string; num_segments: string; direction: MessageDirection; from: string; to: string; date_updated: Date; price: string; error_message: string; uri: string; account_sid: string; num_media: string; status: MessageStatus; messaging_service_sid: string; sid: string; date_sent: Date; date_created: Date; error_code: number; price_unit: string; api_version: string; subresource_uris: Record<string, string>; } export declare class MessageInstance { protected _version: V2010; protected _solution: MessageContextSolution; protected _context?: MessageContext; constructor(_version: V2010, payload: MessageResource, accountSid: string, sid?: string); /** * The text content of the message */ body: string; /** * The number of segments that make up the complete message. SMS message bodies that exceed the [character limit](https://www.twilio.com/docs/glossary/what-sms-character-limit) are segmented and charged as multiple messages. Note: For messages sent via a Messaging Service, `num_segments` is initially `0`, since a sender hasn\'t yet been assigned. */ numSegments: string; direction: MessageDirection; /** * The sender\'s phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). For incoming messages, this is the number or channel address of the sender. For outgoing messages, this value is a Twilio phone number, alphanumeric sender ID, short code, or channel address from which the message is sent. */ from: string; /** * The recipient\'s phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format) or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g. `whatsapp:+15552229999`) */ to: string; /** * The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was last updated */ dateUpdated: Date; /** * The amount billed for the message in the currency specified by `price_unit`. The `price` is populated after the message has been sent/received, and may not be immediately availalble. View the [Pricing page](https://www.twilio.com/en-us/pricing) for more details. */ price: string; /** * The description of the `error_code` if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. */ errorMessage: string; /** * The URI of the Message resource, relative to `https://api.twilio.com`. */ uri: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource */ accountSid: string; /** * The number of media files associated with the Message resource. */ numMedia: string; status: MessageStatus; /** * The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. A unique default value is assigned if a Messaging Service is not used. */ messagingServiceSid: string; /** * The unique, Twilio-provided string that identifies the Message resource. */ sid: string; /** * The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message was sent. For an outgoing message, this is when Twilio sent the message. For an incoming message, this is when Twilio sent the HTTP request to your incoming message webhook URL. */ dateSent: Date; /** * The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was created */ dateCreated: Date; /** * The [error code](https://www.twilio.com/docs/api/errors) returned if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. */ errorCode: number; /** * The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). */ priceUnit: string; /** * The API version used to process the Message */ apiVersion: string; /** * A list of related resources identified by their URIs relative to `https://api.twilio.com` */ subresourceUris: Record<string, string>; private get _proxy(); /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Access the feedback. */ feedback(): FeedbackListInstance; /** * Access the media. */ media(): MediaListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { body: string; numSegments: string; direction: MessageDirection; from: string; to: string; dateUpdated: Date; price: string; errorMessage: string; uri: string; accountSid: string; numMedia: string; status: MessageStatus; messagingServiceSid: string; sid: string; dateSent: Date; dateCreated: Date; errorCode: number; priceUnit: string; apiVersion: string; subresourceUris: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MessageSolution { accountSid: string; } export interface MessageListInstance { _version: V2010; _solution: MessageSolution; _uri: string; (sid: string): MessageContext; get(sid: string): MessageContext; /** * Create a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(params: MessageListInstanceCreateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Streams MessageInstance 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 { MessageListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; each(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MessageInstance 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: MessagePage) => any): Promise<MessagePage>; /** * Lists MessageInstance 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 { MessageListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; list(params: MessageListInstanceOptions, callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; /** * Retrieve a single page of MessageInstance 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 { MessageListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; page(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessageListInstance(version: V2010, accountSid: string): MessageListInstance; export declare class MessagePage extends Page<V2010, MessagePayload, MessageResource, MessageInstance> { /** * Initialize the MessagePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: MessageSolution); /** * Build an instance of MessageInstance * * @param payload - Payload response from the API */ getInstance(payload: MessageResource): MessageInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/availablePhoneNumberCountry/machineToMachine.js000064400000017516151677225100021717 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.MachineToMachinePage = exports.MachineToMachineInstance = exports.MachineToMachineListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function MachineToMachineListInstance(version, accountSid, countryCode) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(countryCode)) { throw new Error("Parameter 'countryCode' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, countryCode }; instance._uri = `/Accounts/${accountSid}/AvailablePhoneNumbers/${countryCode}/MachineToMachine.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["areaCode"] !== undefined) data["AreaCode"] = params["areaCode"]; if (params["contains"] !== undefined) data["Contains"] = params["contains"]; if (params["smsEnabled"] !== undefined) data["SmsEnabled"] = serialize.bool(params["smsEnabled"]); if (params["mmsEnabled"] !== undefined) data["MmsEnabled"] = serialize.bool(params["mmsEnabled"]); if (params["voiceEnabled"] !== undefined) data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]); if (params["excludeAllAddressRequired"] !== undefined) data["ExcludeAllAddressRequired"] = serialize.bool(params["excludeAllAddressRequired"]); if (params["excludeLocalAddressRequired"] !== undefined) data["ExcludeLocalAddressRequired"] = serialize.bool(params["excludeLocalAddressRequired"]); if (params["excludeForeignAddressRequired"] !== undefined) data["ExcludeForeignAddressRequired"] = serialize.bool(params["excludeForeignAddressRequired"]); if (params["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["nearNumber"] !== undefined) data["NearNumber"] = params["nearNumber"]; if (params["nearLatLong"] !== undefined) data["NearLatLong"] = params["nearLatLong"]; if (params["distance"] !== undefined) data["Distance"] = params["distance"]; if (params["inPostalCode"] !== undefined) data["InPostalCode"] = params["inPostalCode"]; if (params["inRegion"] !== undefined) data["InRegion"] = params["inRegion"]; if (params["inRateCenter"] !== undefined) data["InRateCenter"] = params["inRateCenter"]; if (params["inLata"] !== undefined) data["InLata"] = params["inLata"]; if (params["inLocality"] !== undefined) data["InLocality"] = params["inLocality"]; if (params["faxEnabled"] !== undefined) data["FaxEnabled"] = serialize.bool(params["faxEnabled"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MachineToMachinePage(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 MachineToMachinePage(instance._version, payload, 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; } exports.MachineToMachineListInstance = MachineToMachineListInstance; class MachineToMachineInstance { constructor(_version, payload, accountSid, countryCode) { this._version = _version; this.friendlyName = payload.friendly_name; this.phoneNumber = payload.phone_number; this.lata = payload.lata; this.locality = payload.locality; this.rateCenter = payload.rate_center; this.latitude = payload.latitude; this.longitude = payload.longitude; this.region = payload.region; this.postalCode = payload.postal_code; this.isoCountry = payload.iso_country; this.addressRequirements = payload.address_requirements; this.beta = payload.beta; this.capabilities = payload.capabilities; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { friendlyName: this.friendlyName, phoneNumber: this.phoneNumber, lata: this.lata, locality: this.locality, rateCenter: this.rateCenter, latitude: this.latitude, longitude: this.longitude, region: this.region, postalCode: this.postalCode, isoCountry: this.isoCountry, addressRequirements: this.addressRequirements, beta: this.beta, capabilities: this.capabilities, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MachineToMachineInstance = MachineToMachineInstance; class MachineToMachinePage extends Page_1.default { /** * Initialize the MachineToMachinePage * * @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 MachineToMachineInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MachineToMachineInstance(this._version, payload, this._solution.accountSid, this._solution.countryCode); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MachineToMachinePage = MachineToMachinePage; rest/api/v2010/account/availablePhoneNumberCountry/mobile.js000064400000017232151677225100017765 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.MobilePage = exports.MobileInstance = exports.MobileListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function MobileListInstance(version, accountSid, countryCode) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(countryCode)) { throw new Error("Parameter 'countryCode' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, countryCode }; instance._uri = `/Accounts/${accountSid}/AvailablePhoneNumbers/${countryCode}/Mobile.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["areaCode"] !== undefined) data["AreaCode"] = params["areaCode"]; if (params["contains"] !== undefined) data["Contains"] = params["contains"]; if (params["smsEnabled"] !== undefined) data["SmsEnabled"] = serialize.bool(params["smsEnabled"]); if (params["mmsEnabled"] !== undefined) data["MmsEnabled"] = serialize.bool(params["mmsEnabled"]); if (params["voiceEnabled"] !== undefined) data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]); if (params["excludeAllAddressRequired"] !== undefined) data["ExcludeAllAddressRequired"] = serialize.bool(params["excludeAllAddressRequired"]); if (params["excludeLocalAddressRequired"] !== undefined) data["ExcludeLocalAddressRequired"] = serialize.bool(params["excludeLocalAddressRequired"]); if (params["excludeForeignAddressRequired"] !== undefined) data["ExcludeForeignAddressRequired"] = serialize.bool(params["excludeForeignAddressRequired"]); if (params["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["nearNumber"] !== undefined) data["NearNumber"] = params["nearNumber"]; if (params["nearLatLong"] !== undefined) data["NearLatLong"] = params["nearLatLong"]; if (params["distance"] !== undefined) data["Distance"] = params["distance"]; if (params["inPostalCode"] !== undefined) data["InPostalCode"] = params["inPostalCode"]; if (params["inRegion"] !== undefined) data["InRegion"] = params["inRegion"]; if (params["inRateCenter"] !== undefined) data["InRateCenter"] = params["inRateCenter"]; if (params["inLata"] !== undefined) data["InLata"] = params["inLata"]; if (params["inLocality"] !== undefined) data["InLocality"] = params["inLocality"]; if (params["faxEnabled"] !== undefined) data["FaxEnabled"] = serialize.bool(params["faxEnabled"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MobilePage(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 MobilePage(instance._version, payload, 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; } exports.MobileListInstance = MobileListInstance; class MobileInstance { constructor(_version, payload, accountSid, countryCode) { this._version = _version; this.friendlyName = payload.friendly_name; this.phoneNumber = payload.phone_number; this.lata = payload.lata; this.locality = payload.locality; this.rateCenter = payload.rate_center; this.latitude = payload.latitude; this.longitude = payload.longitude; this.region = payload.region; this.postalCode = payload.postal_code; this.isoCountry = payload.iso_country; this.addressRequirements = payload.address_requirements; this.beta = payload.beta; this.capabilities = payload.capabilities; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { friendlyName: this.friendlyName, phoneNumber: this.phoneNumber, lata: this.lata, locality: this.locality, rateCenter: this.rateCenter, latitude: this.latitude, longitude: this.longitude, region: this.region, postalCode: this.postalCode, isoCountry: this.isoCountry, addressRequirements: this.addressRequirements, beta: this.beta, capabilities: this.capabilities, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MobileInstance = MobileInstance; class MobilePage extends Page_1.default { /** * Initialize the MobilePage * * @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 MobileInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MobileInstance(this._version, payload, this._solution.accountSid, this._solution.countryCode); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MobilePage = MobilePage; rest/api/v2010/account/availablePhoneNumberCountry/tollFree.d.ts000064400000046061151677225100020530 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; /** * Options to pass to each */ export interface TollFreeListInstanceEachOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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: TollFreeInstance, 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 TollFreeListInstanceOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 TollFreeListInstancePageOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 TollFreeSolution { accountSid: string; countryCode: string; } export interface TollFreeListInstance { _version: V2010; _solution: TollFreeSolution; _uri: string; /** * Streams TollFreeInstance 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 { TollFreeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TollFreeInstance, done: (err?: Error) => void) => void): void; each(params: TollFreeListInstanceEachOptions, callback?: (item: TollFreeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TollFreeInstance 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: TollFreePage) => any): Promise<TollFreePage>; /** * Lists TollFreeInstance 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 { TollFreeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TollFreeInstance[]) => any): Promise<TollFreeInstance[]>; list(params: TollFreeListInstanceOptions, callback?: (error: Error | null, items: TollFreeInstance[]) => any): Promise<TollFreeInstance[]>; /** * Retrieve a single page of TollFreeInstance 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 { TollFreeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TollFreePage) => any): Promise<TollFreePage>; page(params: TollFreeListInstancePageOptions, callback?: (error: Error | null, items: TollFreePage) => any): Promise<TollFreePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TollFreeListInstance(version: V2010, accountSid: string, countryCode: string): TollFreeListInstance; interface TollFreePayload extends TwilioResponsePayload { available_phone_numbers: TollFreeResource[]; } interface TollFreeResource { friendly_name: string; phone_number: string; lata: string; locality: string; rate_center: string; latitude: number; longitude: number; region: string; postal_code: string; iso_country: string; address_requirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; } export declare class TollFreeInstance { protected _version: V2010; constructor(_version: V2010, payload: TollFreeResource, accountSid: string, countryCode: string); /** * A formatted version of the phone number. */ friendlyName: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. */ lata: string; /** * The locality or city of this phone number\'s location. */ locality: string; /** * The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. */ rateCenter: string; /** * The latitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ latitude: number; /** * The longitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ longitude: number; /** * The two-letter state or province abbreviation of this phone number\'s location. Available for only phone numbers from the US and Canada. */ region: string; /** * The postal or ZIP code of this phone number\'s location. Available for only phone numbers from the US and Canada. */ postalCode: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. */ isoCountry: string; /** * The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number\'s country is required. `foreign` means an address outside of the phone number\'s country is required. */ addressRequirements: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { friendlyName: string; phoneNumber: string; lata: string; locality: string; rateCenter: string; latitude: number; longitude: number; region: string; postalCode: string; isoCountry: string; addressRequirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class TollFreePage extends Page<V2010, TollFreePayload, TollFreeResource, TollFreeInstance> { /** * Initialize the TollFreePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: TollFreeSolution); /** * Build an instance of TollFreeInstance * * @param payload - Payload response from the API */ getInstance(payload: TollFreeResource): TollFreeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/availablePhoneNumberCountry/voip.d.ts000064400000045575151677225100017742 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; /** * Options to pass to each */ export interface VoipListInstanceEachOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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: VoipInstance, 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 VoipListInstanceOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 VoipListInstancePageOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 VoipSolution { accountSid: string; countryCode: string; } export interface VoipListInstance { _version: V2010; _solution: VoipSolution; _uri: string; /** * Streams VoipInstance 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 { VoipListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: VoipInstance, done: (err?: Error) => void) => void): void; each(params: VoipListInstanceEachOptions, callback?: (item: VoipInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of VoipInstance 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: VoipPage) => any): Promise<VoipPage>; /** * Lists VoipInstance 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 { VoipListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: VoipInstance[]) => any): Promise<VoipInstance[]>; list(params: VoipListInstanceOptions, callback?: (error: Error | null, items: VoipInstance[]) => any): Promise<VoipInstance[]>; /** * Retrieve a single page of VoipInstance 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 { VoipListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: VoipPage) => any): Promise<VoipPage>; page(params: VoipListInstancePageOptions, callback?: (error: Error | null, items: VoipPage) => any): Promise<VoipPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function VoipListInstance(version: V2010, accountSid: string, countryCode: string): VoipListInstance; interface VoipPayload extends TwilioResponsePayload { available_phone_numbers: VoipResource[]; } interface VoipResource { friendly_name: string; phone_number: string; lata: string; locality: string; rate_center: string; latitude: number; longitude: number; region: string; postal_code: string; iso_country: string; address_requirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; } export declare class VoipInstance { protected _version: V2010; constructor(_version: V2010, payload: VoipResource, accountSid: string, countryCode: string); /** * A formatted version of the phone number. */ friendlyName: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. */ lata: string; /** * The locality or city of this phone number\'s location. */ locality: string; /** * The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. */ rateCenter: string; /** * The latitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ latitude: number; /** * The longitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ longitude: number; /** * The two-letter state or province abbreviation of this phone number\'s location. Available for only phone numbers from the US and Canada. */ region: string; /** * The postal or ZIP code of this phone number\'s location. Available for only phone numbers from the US and Canada. */ postalCode: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. */ isoCountry: string; /** * The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number\'s country is required. `foreign` means an address outside of the phone number\'s country is required. */ addressRequirements: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { friendlyName: string; phoneNumber: string; lata: string; locality: string; rateCenter: string; latitude: number; longitude: number; region: string; postalCode: string; isoCountry: string; addressRequirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class VoipPage extends Page<V2010, VoipPayload, VoipResource, VoipInstance> { /** * Initialize the VoipPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: VoipSolution); /** * Build an instance of VoipInstance * * @param payload - Payload response from the API */ getInstance(payload: VoipResource): VoipInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/availablePhoneNumberCountry/sharedCost.d.ts000064400000046213151677225100021052 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; /** * Options to pass to each */ export interface SharedCostListInstanceEachOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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: SharedCostInstance, 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 SharedCostListInstanceOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 SharedCostListInstancePageOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 SharedCostSolution { accountSid: string; countryCode: string; } export interface SharedCostListInstance { _version: V2010; _solution: SharedCostSolution; _uri: string; /** * Streams SharedCostInstance 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 { SharedCostListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SharedCostInstance, done: (err?: Error) => void) => void): void; each(params: SharedCostListInstanceEachOptions, callback?: (item: SharedCostInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SharedCostInstance 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: SharedCostPage) => any): Promise<SharedCostPage>; /** * Lists SharedCostInstance 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 { SharedCostListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SharedCostInstance[]) => any): Promise<SharedCostInstance[]>; list(params: SharedCostListInstanceOptions, callback?: (error: Error | null, items: SharedCostInstance[]) => any): Promise<SharedCostInstance[]>; /** * Retrieve a single page of SharedCostInstance 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 { SharedCostListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SharedCostPage) => any): Promise<SharedCostPage>; page(params: SharedCostListInstancePageOptions, callback?: (error: Error | null, items: SharedCostPage) => any): Promise<SharedCostPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SharedCostListInstance(version: V2010, accountSid: string, countryCode: string): SharedCostListInstance; interface SharedCostPayload extends TwilioResponsePayload { available_phone_numbers: SharedCostResource[]; } interface SharedCostResource { friendly_name: string; phone_number: string; lata: string; locality: string; rate_center: string; latitude: number; longitude: number; region: string; postal_code: string; iso_country: string; address_requirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; } export declare class SharedCostInstance { protected _version: V2010; constructor(_version: V2010, payload: SharedCostResource, accountSid: string, countryCode: string); /** * A formatted version of the phone number. */ friendlyName: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. */ lata: string; /** * The locality or city of this phone number\'s location. */ locality: string; /** * The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. */ rateCenter: string; /** * The latitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ latitude: number; /** * The longitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ longitude: number; /** * The two-letter state or province abbreviation of this phone number\'s location. Available for only phone numbers from the US and Canada. */ region: string; /** * The postal or ZIP code of this phone number\'s location. Available for only phone numbers from the US and Canada. */ postalCode: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. */ isoCountry: string; /** * The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number\'s country is required. `foreign` means an address outside of the phone number\'s country is required. */ addressRequirements: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { friendlyName: string; phoneNumber: string; lata: string; locality: string; rateCenter: string; latitude: number; longitude: number; region: string; postalCode: string; isoCountry: string; addressRequirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class SharedCostPage extends Page<V2010, SharedCostPayload, SharedCostResource, SharedCostInstance> { /** * Initialize the SharedCostPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: SharedCostSolution); /** * Build an instance of SharedCostInstance * * @param payload - Payload response from the API */ getInstance(payload: SharedCostResource): SharedCostInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/availablePhoneNumberCountry/tollFree.js000064400000017276151677225100020302 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.TollFreePage = exports.TollFreeInstance = exports.TollFreeListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function TollFreeListInstance(version, accountSid, countryCode) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(countryCode)) { throw new Error("Parameter 'countryCode' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, countryCode }; instance._uri = `/Accounts/${accountSid}/AvailablePhoneNumbers/${countryCode}/TollFree.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["areaCode"] !== undefined) data["AreaCode"] = params["areaCode"]; if (params["contains"] !== undefined) data["Contains"] = params["contains"]; if (params["smsEnabled"] !== undefined) data["SmsEnabled"] = serialize.bool(params["smsEnabled"]); if (params["mmsEnabled"] !== undefined) data["MmsEnabled"] = serialize.bool(params["mmsEnabled"]); if (params["voiceEnabled"] !== undefined) data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]); if (params["excludeAllAddressRequired"] !== undefined) data["ExcludeAllAddressRequired"] = serialize.bool(params["excludeAllAddressRequired"]); if (params["excludeLocalAddressRequired"] !== undefined) data["ExcludeLocalAddressRequired"] = serialize.bool(params["excludeLocalAddressRequired"]); if (params["excludeForeignAddressRequired"] !== undefined) data["ExcludeForeignAddressRequired"] = serialize.bool(params["excludeForeignAddressRequired"]); if (params["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["nearNumber"] !== undefined) data["NearNumber"] = params["nearNumber"]; if (params["nearLatLong"] !== undefined) data["NearLatLong"] = params["nearLatLong"]; if (params["distance"] !== undefined) data["Distance"] = params["distance"]; if (params["inPostalCode"] !== undefined) data["InPostalCode"] = params["inPostalCode"]; if (params["inRegion"] !== undefined) data["InRegion"] = params["inRegion"]; if (params["inRateCenter"] !== undefined) data["InRateCenter"] = params["inRateCenter"]; if (params["inLata"] !== undefined) data["InLata"] = params["inLata"]; if (params["inLocality"] !== undefined) data["InLocality"] = params["inLocality"]; if (params["faxEnabled"] !== undefined) data["FaxEnabled"] = serialize.bool(params["faxEnabled"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TollFreePage(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 TollFreePage(instance._version, payload, 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; } exports.TollFreeListInstance = TollFreeListInstance; class TollFreeInstance { constructor(_version, payload, accountSid, countryCode) { this._version = _version; this.friendlyName = payload.friendly_name; this.phoneNumber = payload.phone_number; this.lata = payload.lata; this.locality = payload.locality; this.rateCenter = payload.rate_center; this.latitude = payload.latitude; this.longitude = payload.longitude; this.region = payload.region; this.postalCode = payload.postal_code; this.isoCountry = payload.iso_country; this.addressRequirements = payload.address_requirements; this.beta = payload.beta; this.capabilities = payload.capabilities; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { friendlyName: this.friendlyName, phoneNumber: this.phoneNumber, lata: this.lata, locality: this.locality, rateCenter: this.rateCenter, latitude: this.latitude, longitude: this.longitude, region: this.region, postalCode: this.postalCode, isoCountry: this.isoCountry, addressRequirements: this.addressRequirements, beta: this.beta, capabilities: this.capabilities, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TollFreeInstance = TollFreeInstance; class TollFreePage extends Page_1.default { /** * Initialize the TollFreePage * * @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 TollFreeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TollFreeInstance(this._version, payload, this._solution.accountSid, this._solution.countryCode); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TollFreePage = TollFreePage; rest/api/v2010/account/availablePhoneNumberCountry/national.d.ts000064400000046061151677225100020561 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; /** * Options to pass to each */ export interface NationalListInstanceEachOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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: NationalInstance, 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 NationalListInstanceOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 NationalListInstancePageOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 NationalSolution { accountSid: string; countryCode: string; } export interface NationalListInstance { _version: V2010; _solution: NationalSolution; _uri: string; /** * Streams NationalInstance 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 { NationalListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: NationalInstance, done: (err?: Error) => void) => void): void; each(params: NationalListInstanceEachOptions, callback?: (item: NationalInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of NationalInstance 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: NationalPage) => any): Promise<NationalPage>; /** * Lists NationalInstance 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 { NationalListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: NationalInstance[]) => any): Promise<NationalInstance[]>; list(params: NationalListInstanceOptions, callback?: (error: Error | null, items: NationalInstance[]) => any): Promise<NationalInstance[]>; /** * Retrieve a single page of NationalInstance 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 { NationalListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: NationalPage) => any): Promise<NationalPage>; page(params: NationalListInstancePageOptions, callback?: (error: Error | null, items: NationalPage) => any): Promise<NationalPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NationalListInstance(version: V2010, accountSid: string, countryCode: string): NationalListInstance; interface NationalPayload extends TwilioResponsePayload { available_phone_numbers: NationalResource[]; } interface NationalResource { friendly_name: string; phone_number: string; lata: string; locality: string; rate_center: string; latitude: number; longitude: number; region: string; postal_code: string; iso_country: string; address_requirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; } export declare class NationalInstance { protected _version: V2010; constructor(_version: V2010, payload: NationalResource, accountSid: string, countryCode: string); /** * A formatted version of the phone number. */ friendlyName: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. */ lata: string; /** * The locality or city of this phone number\'s location. */ locality: string; /** * The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. */ rateCenter: string; /** * The latitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ latitude: number; /** * The longitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ longitude: number; /** * The two-letter state or province abbreviation of this phone number\'s location. Available for only phone numbers from the US and Canada. */ region: string; /** * The postal or ZIP code of this phone number\'s location. Available for only phone numbers from the US and Canada. */ postalCode: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. */ isoCountry: string; /** * The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number\'s country is required. `foreign` means an address outside of the phone number\'s country is required. */ addressRequirements: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { friendlyName: string; phoneNumber: string; lata: string; locality: string; rateCenter: string; latitude: number; longitude: number; region: string; postalCode: string; isoCountry: string; addressRequirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class NationalPage extends Page<V2010, NationalPayload, NationalResource, NationalInstance> { /** * Initialize the NationalPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: NationalSolution); /** * Build an instance of NationalInstance * * @param payload - Payload response from the API */ getInstance(payload: NationalResource): NationalInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/availablePhoneNumberCountry/national.js000064400000017276151677225100020333 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.NationalPage = exports.NationalInstance = exports.NationalListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function NationalListInstance(version, accountSid, countryCode) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(countryCode)) { throw new Error("Parameter 'countryCode' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, countryCode }; instance._uri = `/Accounts/${accountSid}/AvailablePhoneNumbers/${countryCode}/National.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["areaCode"] !== undefined) data["AreaCode"] = params["areaCode"]; if (params["contains"] !== undefined) data["Contains"] = params["contains"]; if (params["smsEnabled"] !== undefined) data["SmsEnabled"] = serialize.bool(params["smsEnabled"]); if (params["mmsEnabled"] !== undefined) data["MmsEnabled"] = serialize.bool(params["mmsEnabled"]); if (params["voiceEnabled"] !== undefined) data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]); if (params["excludeAllAddressRequired"] !== undefined) data["ExcludeAllAddressRequired"] = serialize.bool(params["excludeAllAddressRequired"]); if (params["excludeLocalAddressRequired"] !== undefined) data["ExcludeLocalAddressRequired"] = serialize.bool(params["excludeLocalAddressRequired"]); if (params["excludeForeignAddressRequired"] !== undefined) data["ExcludeForeignAddressRequired"] = serialize.bool(params["excludeForeignAddressRequired"]); if (params["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["nearNumber"] !== undefined) data["NearNumber"] = params["nearNumber"]; if (params["nearLatLong"] !== undefined) data["NearLatLong"] = params["nearLatLong"]; if (params["distance"] !== undefined) data["Distance"] = params["distance"]; if (params["inPostalCode"] !== undefined) data["InPostalCode"] = params["inPostalCode"]; if (params["inRegion"] !== undefined) data["InRegion"] = params["inRegion"]; if (params["inRateCenter"] !== undefined) data["InRateCenter"] = params["inRateCenter"]; if (params["inLata"] !== undefined) data["InLata"] = params["inLata"]; if (params["inLocality"] !== undefined) data["InLocality"] = params["inLocality"]; if (params["faxEnabled"] !== undefined) data["FaxEnabled"] = serialize.bool(params["faxEnabled"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new NationalPage(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 NationalPage(instance._version, payload, 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; } exports.NationalListInstance = NationalListInstance; class NationalInstance { constructor(_version, payload, accountSid, countryCode) { this._version = _version; this.friendlyName = payload.friendly_name; this.phoneNumber = payload.phone_number; this.lata = payload.lata; this.locality = payload.locality; this.rateCenter = payload.rate_center; this.latitude = payload.latitude; this.longitude = payload.longitude; this.region = payload.region; this.postalCode = payload.postal_code; this.isoCountry = payload.iso_country; this.addressRequirements = payload.address_requirements; this.beta = payload.beta; this.capabilities = payload.capabilities; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { friendlyName: this.friendlyName, phoneNumber: this.phoneNumber, lata: this.lata, locality: this.locality, rateCenter: this.rateCenter, latitude: this.latitude, longitude: this.longitude, region: this.region, postalCode: this.postalCode, isoCountry: this.isoCountry, addressRequirements: this.addressRequirements, beta: this.beta, capabilities: this.capabilities, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NationalInstance = NationalInstance; class NationalPage extends Page_1.default { /** * Initialize the NationalPage * * @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 NationalInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new NationalInstance(this._version, payload, this._solution.accountSid, this._solution.countryCode); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NationalPage = NationalPage; rest/api/v2010/account/availablePhoneNumberCountry/sharedCost.js000064400000017342151677225100020617 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.SharedCostPage = exports.SharedCostInstance = exports.SharedCostListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function SharedCostListInstance(version, accountSid, countryCode) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(countryCode)) { throw new Error("Parameter 'countryCode' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, countryCode }; instance._uri = `/Accounts/${accountSid}/AvailablePhoneNumbers/${countryCode}/SharedCost.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["areaCode"] !== undefined) data["AreaCode"] = params["areaCode"]; if (params["contains"] !== undefined) data["Contains"] = params["contains"]; if (params["smsEnabled"] !== undefined) data["SmsEnabled"] = serialize.bool(params["smsEnabled"]); if (params["mmsEnabled"] !== undefined) data["MmsEnabled"] = serialize.bool(params["mmsEnabled"]); if (params["voiceEnabled"] !== undefined) data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]); if (params["excludeAllAddressRequired"] !== undefined) data["ExcludeAllAddressRequired"] = serialize.bool(params["excludeAllAddressRequired"]); if (params["excludeLocalAddressRequired"] !== undefined) data["ExcludeLocalAddressRequired"] = serialize.bool(params["excludeLocalAddressRequired"]); if (params["excludeForeignAddressRequired"] !== undefined) data["ExcludeForeignAddressRequired"] = serialize.bool(params["excludeForeignAddressRequired"]); if (params["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["nearNumber"] !== undefined) data["NearNumber"] = params["nearNumber"]; if (params["nearLatLong"] !== undefined) data["NearLatLong"] = params["nearLatLong"]; if (params["distance"] !== undefined) data["Distance"] = params["distance"]; if (params["inPostalCode"] !== undefined) data["InPostalCode"] = params["inPostalCode"]; if (params["inRegion"] !== undefined) data["InRegion"] = params["inRegion"]; if (params["inRateCenter"] !== undefined) data["InRateCenter"] = params["inRateCenter"]; if (params["inLata"] !== undefined) data["InLata"] = params["inLata"]; if (params["inLocality"] !== undefined) data["InLocality"] = params["inLocality"]; if (params["faxEnabled"] !== undefined) data["FaxEnabled"] = serialize.bool(params["faxEnabled"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SharedCostPage(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 SharedCostPage(instance._version, payload, 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; } exports.SharedCostListInstance = SharedCostListInstance; class SharedCostInstance { constructor(_version, payload, accountSid, countryCode) { this._version = _version; this.friendlyName = payload.friendly_name; this.phoneNumber = payload.phone_number; this.lata = payload.lata; this.locality = payload.locality; this.rateCenter = payload.rate_center; this.latitude = payload.latitude; this.longitude = payload.longitude; this.region = payload.region; this.postalCode = payload.postal_code; this.isoCountry = payload.iso_country; this.addressRequirements = payload.address_requirements; this.beta = payload.beta; this.capabilities = payload.capabilities; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { friendlyName: this.friendlyName, phoneNumber: this.phoneNumber, lata: this.lata, locality: this.locality, rateCenter: this.rateCenter, latitude: this.latitude, longitude: this.longitude, region: this.region, postalCode: this.postalCode, isoCountry: this.isoCountry, addressRequirements: this.addressRequirements, beta: this.beta, capabilities: this.capabilities, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SharedCostInstance = SharedCostInstance; class SharedCostPage extends Page_1.default { /** * Initialize the SharedCostPage * * @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 SharedCostInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SharedCostInstance(this._version, payload, this._solution.accountSid, this._solution.countryCode); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SharedCostPage = SharedCostPage; rest/api/v2010/account/availablePhoneNumberCountry/local.js000064400000017210151677225100017604 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.LocalPage = exports.LocalInstance = exports.LocalListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function LocalListInstance(version, accountSid, countryCode) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(countryCode)) { throw new Error("Parameter 'countryCode' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, countryCode }; instance._uri = `/Accounts/${accountSid}/AvailablePhoneNumbers/${countryCode}/Local.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["areaCode"] !== undefined) data["AreaCode"] = params["areaCode"]; if (params["contains"] !== undefined) data["Contains"] = params["contains"]; if (params["smsEnabled"] !== undefined) data["SmsEnabled"] = serialize.bool(params["smsEnabled"]); if (params["mmsEnabled"] !== undefined) data["MmsEnabled"] = serialize.bool(params["mmsEnabled"]); if (params["voiceEnabled"] !== undefined) data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]); if (params["excludeAllAddressRequired"] !== undefined) data["ExcludeAllAddressRequired"] = serialize.bool(params["excludeAllAddressRequired"]); if (params["excludeLocalAddressRequired"] !== undefined) data["ExcludeLocalAddressRequired"] = serialize.bool(params["excludeLocalAddressRequired"]); if (params["excludeForeignAddressRequired"] !== undefined) data["ExcludeForeignAddressRequired"] = serialize.bool(params["excludeForeignAddressRequired"]); if (params["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["nearNumber"] !== undefined) data["NearNumber"] = params["nearNumber"]; if (params["nearLatLong"] !== undefined) data["NearLatLong"] = params["nearLatLong"]; if (params["distance"] !== undefined) data["Distance"] = params["distance"]; if (params["inPostalCode"] !== undefined) data["InPostalCode"] = params["inPostalCode"]; if (params["inRegion"] !== undefined) data["InRegion"] = params["inRegion"]; if (params["inRateCenter"] !== undefined) data["InRateCenter"] = params["inRateCenter"]; if (params["inLata"] !== undefined) data["InLata"] = params["inLata"]; if (params["inLocality"] !== undefined) data["InLocality"] = params["inLocality"]; if (params["faxEnabled"] !== undefined) data["FaxEnabled"] = serialize.bool(params["faxEnabled"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new LocalPage(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 LocalPage(instance._version, payload, 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; } exports.LocalListInstance = LocalListInstance; class LocalInstance { constructor(_version, payload, accountSid, countryCode) { this._version = _version; this.friendlyName = payload.friendly_name; this.phoneNumber = payload.phone_number; this.lata = payload.lata; this.locality = payload.locality; this.rateCenter = payload.rate_center; this.latitude = payload.latitude; this.longitude = payload.longitude; this.region = payload.region; this.postalCode = payload.postal_code; this.isoCountry = payload.iso_country; this.addressRequirements = payload.address_requirements; this.beta = payload.beta; this.capabilities = payload.capabilities; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { friendlyName: this.friendlyName, phoneNumber: this.phoneNumber, lata: this.lata, locality: this.locality, rateCenter: this.rateCenter, latitude: this.latitude, longitude: this.longitude, region: this.region, postalCode: this.postalCode, isoCountry: this.isoCountry, addressRequirements: this.addressRequirements, beta: this.beta, capabilities: this.capabilities, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LocalInstance = LocalInstance; class LocalPage extends Page_1.default { /** * Initialize the LocalPage * * @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 LocalInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new LocalInstance(this._version, payload, this._solution.accountSid, this._solution.countryCode); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LocalPage = LocalPage; rest/api/v2010/account/availablePhoneNumberCountry/voip.js000064400000017166151677225100017501 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.VoipPage = exports.VoipInstance = exports.VoipListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function VoipListInstance(version, accountSid, countryCode) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(countryCode)) { throw new Error("Parameter 'countryCode' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, countryCode }; instance._uri = `/Accounts/${accountSid}/AvailablePhoneNumbers/${countryCode}/Voip.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["areaCode"] !== undefined) data["AreaCode"] = params["areaCode"]; if (params["contains"] !== undefined) data["Contains"] = params["contains"]; if (params["smsEnabled"] !== undefined) data["SmsEnabled"] = serialize.bool(params["smsEnabled"]); if (params["mmsEnabled"] !== undefined) data["MmsEnabled"] = serialize.bool(params["mmsEnabled"]); if (params["voiceEnabled"] !== undefined) data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]); if (params["excludeAllAddressRequired"] !== undefined) data["ExcludeAllAddressRequired"] = serialize.bool(params["excludeAllAddressRequired"]); if (params["excludeLocalAddressRequired"] !== undefined) data["ExcludeLocalAddressRequired"] = serialize.bool(params["excludeLocalAddressRequired"]); if (params["excludeForeignAddressRequired"] !== undefined) data["ExcludeForeignAddressRequired"] = serialize.bool(params["excludeForeignAddressRequired"]); if (params["beta"] !== undefined) data["Beta"] = serialize.bool(params["beta"]); if (params["nearNumber"] !== undefined) data["NearNumber"] = params["nearNumber"]; if (params["nearLatLong"] !== undefined) data["NearLatLong"] = params["nearLatLong"]; if (params["distance"] !== undefined) data["Distance"] = params["distance"]; if (params["inPostalCode"] !== undefined) data["InPostalCode"] = params["inPostalCode"]; if (params["inRegion"] !== undefined) data["InRegion"] = params["inRegion"]; if (params["inRateCenter"] !== undefined) data["InRateCenter"] = params["inRateCenter"]; if (params["inLata"] !== undefined) data["InLata"] = params["inLata"]; if (params["inLocality"] !== undefined) data["InLocality"] = params["inLocality"]; if (params["faxEnabled"] !== undefined) data["FaxEnabled"] = serialize.bool(params["faxEnabled"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new VoipPage(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 VoipPage(instance._version, payload, 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; } exports.VoipListInstance = VoipListInstance; class VoipInstance { constructor(_version, payload, accountSid, countryCode) { this._version = _version; this.friendlyName = payload.friendly_name; this.phoneNumber = payload.phone_number; this.lata = payload.lata; this.locality = payload.locality; this.rateCenter = payload.rate_center; this.latitude = payload.latitude; this.longitude = payload.longitude; this.region = payload.region; this.postalCode = payload.postal_code; this.isoCountry = payload.iso_country; this.addressRequirements = payload.address_requirements; this.beta = payload.beta; this.capabilities = payload.capabilities; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { friendlyName: this.friendlyName, phoneNumber: this.phoneNumber, lata: this.lata, locality: this.locality, rateCenter: this.rateCenter, latitude: this.latitude, longitude: this.longitude, region: this.region, postalCode: this.postalCode, isoCountry: this.isoCountry, addressRequirements: this.addressRequirements, beta: this.beta, capabilities: this.capabilities, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.VoipInstance = VoipInstance; class VoipPage extends Page_1.default { /** * Initialize the VoipPage * * @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 VoipInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new VoipInstance(this._version, payload, this._solution.accountSid, this._solution.countryCode); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.VoipPage = VoipPage; rest/api/v2010/account/availablePhoneNumberCountry/local.d.ts000064400000046171151677225100020050 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; /** * Options to pass to each */ export interface LocalListInstanceEachOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-number-pattern) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-character-pattern). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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: LocalInstance, 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 LocalListInstanceOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-number-pattern) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-character-pattern). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 LocalListInstancePageOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-number-pattern) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-character-pattern). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 LocalSolution { accountSid: string; countryCode: string; } export interface LocalListInstance { _version: V2010; _solution: LocalSolution; _uri: string; /** * Streams LocalInstance 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 { LocalListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: LocalInstance, done: (err?: Error) => void) => void): void; each(params: LocalListInstanceEachOptions, callback?: (item: LocalInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of LocalInstance 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: LocalPage) => any): Promise<LocalPage>; /** * Lists LocalInstance 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 { LocalListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: LocalInstance[]) => any): Promise<LocalInstance[]>; list(params: LocalListInstanceOptions, callback?: (error: Error | null, items: LocalInstance[]) => any): Promise<LocalInstance[]>; /** * Retrieve a single page of LocalInstance 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 { LocalListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: LocalPage) => any): Promise<LocalPage>; page(params: LocalListInstancePageOptions, callback?: (error: Error | null, items: LocalPage) => any): Promise<LocalPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function LocalListInstance(version: V2010, accountSid: string, countryCode: string): LocalListInstance; interface LocalPayload extends TwilioResponsePayload { available_phone_numbers: LocalResource[]; } interface LocalResource { friendly_name: string; phone_number: string; lata: string; locality: string; rate_center: string; latitude: number; longitude: number; region: string; postal_code: string; iso_country: string; address_requirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; } export declare class LocalInstance { protected _version: V2010; constructor(_version: V2010, payload: LocalResource, accountSid: string, countryCode: string); /** * A formatted version of the phone number. */ friendlyName: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. */ lata: string; /** * The locality or city of this phone number\'s location. */ locality: string; /** * The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. */ rateCenter: string; /** * The latitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ latitude: number; /** * The longitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ longitude: number; /** * The two-letter state or province abbreviation of this phone number\'s location. Available for only phone numbers from the US and Canada. */ region: string; /** * The postal or ZIP code of this phone number\'s location. Available for only phone numbers from the US and Canada. */ postalCode: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. */ isoCountry: string; /** * The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number\'s country is required. `foreign` means an address outside of the phone number\'s country is required. */ addressRequirements: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { friendlyName: string; phoneNumber: string; lata: string; locality: string; rateCenter: string; latitude: number; longitude: number; region: string; postalCode: string; isoCountry: string; addressRequirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class LocalPage extends Page<V2010, LocalPayload, LocalResource, LocalInstance> { /** * Initialize the LocalPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: LocalSolution); /** * Build an instance of LocalInstance * * @param payload - Payload response from the API */ getInstance(payload: LocalResource): LocalInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/availablePhoneNumberCountry/machineToMachine.d.ts000064400000046631151677225100022153 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; /** * Options to pass to each */ export interface MachineToMachineListInstanceEachOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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: MachineToMachineInstance, 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 MachineToMachineListInstanceOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 MachineToMachineListInstancePageOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 MachineToMachineSolution { accountSid: string; countryCode: string; } export interface MachineToMachineListInstance { _version: V2010; _solution: MachineToMachineSolution; _uri: string; /** * Streams MachineToMachineInstance 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 { MachineToMachineListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MachineToMachineInstance, done: (err?: Error) => void) => void): void; each(params: MachineToMachineListInstanceEachOptions, callback?: (item: MachineToMachineInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MachineToMachineInstance 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: MachineToMachinePage) => any): Promise<MachineToMachinePage>; /** * Lists MachineToMachineInstance 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 { MachineToMachineListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MachineToMachineInstance[]) => any): Promise<MachineToMachineInstance[]>; list(params: MachineToMachineListInstanceOptions, callback?: (error: Error | null, items: MachineToMachineInstance[]) => any): Promise<MachineToMachineInstance[]>; /** * Retrieve a single page of MachineToMachineInstance 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 { MachineToMachineListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MachineToMachinePage) => any): Promise<MachineToMachinePage>; page(params: MachineToMachineListInstancePageOptions, callback?: (error: Error | null, items: MachineToMachinePage) => any): Promise<MachineToMachinePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MachineToMachineListInstance(version: V2010, accountSid: string, countryCode: string): MachineToMachineListInstance; interface MachineToMachinePayload extends TwilioResponsePayload { available_phone_numbers: MachineToMachineResource[]; } interface MachineToMachineResource { friendly_name: string; phone_number: string; lata: string; locality: string; rate_center: string; latitude: number; longitude: number; region: string; postal_code: string; iso_country: string; address_requirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; } export declare class MachineToMachineInstance { protected _version: V2010; constructor(_version: V2010, payload: MachineToMachineResource, accountSid: string, countryCode: string); /** * A formatted version of the phone number. */ friendlyName: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. */ lata: string; /** * The locality or city of this phone number\'s location. */ locality: string; /** * The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. */ rateCenter: string; /** * The latitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ latitude: number; /** * The longitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ longitude: number; /** * The two-letter state or province abbreviation of this phone number\'s location. Available for only phone numbers from the US and Canada. */ region: string; /** * The postal or ZIP code of this phone number\'s location. Available for only phone numbers from the US and Canada. */ postalCode: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. */ isoCountry: string; /** * The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number\'s country is required. `foreign` means an address outside of the phone number\'s country is required. */ addressRequirements: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { friendlyName: string; phoneNumber: string; lata: string; locality: string; rateCenter: string; latitude: number; longitude: number; region: string; postalCode: string; isoCountry: string; addressRequirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class MachineToMachinePage extends Page<V2010, MachineToMachinePayload, MachineToMachineResource, MachineToMachineInstance> { /** * Initialize the MachineToMachinePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: MachineToMachineSolution); /** * Build an instance of MachineToMachineInstance * * @param payload - Payload response from the API */ getInstance(payload: MachineToMachineResource): MachineToMachineInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/availablePhoneNumberCountry/mobile.d.ts000064400000045727151677225100020233 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; import { PhoneNumberCapabilities } from "../../../../../interfaces"; /** * Options to pass to each */ export interface MobileListInstanceEachOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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: MobileInstance, 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 MobileListInstanceOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 MobileListInstancePageOptions { /** The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. */ areaCode?: number; /** The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. */ contains?: string; /** Whether the phone numbers can receive text messages. Can be: `true` or `false`. */ smsEnabled?: boolean; /** Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. */ mmsEnabled?: boolean; /** Whether the phone numbers can receive calls. Can be: `true` or `false`. */ voiceEnabled?: boolean; /** Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeAllAddressRequired?: boolean; /** Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeLocalAddressRequired?: boolean; /** Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. */ excludeForeignAddressRequired?: boolean; /** Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. */ nearNumber?: string; /** Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. */ nearLatLong?: string; /** The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. */ distance?: number; /** Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. */ inPostalCode?: string; /** Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. */ inRegion?: string; /** Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. */ inRateCenter?: string; /** Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. */ inLata?: string; /** Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. */ inLocality?: string; /** Whether the phone numbers can receive faxes. Can be: `true` or `false`. */ faxEnabled?: boolean; /** 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 MobileSolution { accountSid: string; countryCode: string; } export interface MobileListInstance { _version: V2010; _solution: MobileSolution; _uri: string; /** * Streams MobileInstance 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 { MobileListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MobileInstance, done: (err?: Error) => void) => void): void; each(params: MobileListInstanceEachOptions, callback?: (item: MobileInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MobileInstance 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: MobilePage) => any): Promise<MobilePage>; /** * Lists MobileInstance 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 { MobileListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MobileInstance[]) => any): Promise<MobileInstance[]>; list(params: MobileListInstanceOptions, callback?: (error: Error | null, items: MobileInstance[]) => any): Promise<MobileInstance[]>; /** * Retrieve a single page of MobileInstance 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 { MobileListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MobilePage) => any): Promise<MobilePage>; page(params: MobileListInstancePageOptions, callback?: (error: Error | null, items: MobilePage) => any): Promise<MobilePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MobileListInstance(version: V2010, accountSid: string, countryCode: string): MobileListInstance; interface MobilePayload extends TwilioResponsePayload { available_phone_numbers: MobileResource[]; } interface MobileResource { friendly_name: string; phone_number: string; lata: string; locality: string; rate_center: string; latitude: number; longitude: number; region: string; postal_code: string; iso_country: string; address_requirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; } export declare class MobileInstance { protected _version: V2010; constructor(_version: V2010, payload: MobileResource, accountSid: string, countryCode: string); /** * A formatted version of the phone number. */ friendlyName: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. */ lata: string; /** * The locality or city of this phone number\'s location. */ locality: string; /** * The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. */ rateCenter: string; /** * The latitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ latitude: number; /** * The longitude of this phone number\'s location. Available for only phone numbers from the US and Canada. */ longitude: number; /** * The two-letter state or province abbreviation of this phone number\'s location. Available for only phone numbers from the US and Canada. */ region: string; /** * The postal or ZIP code of this phone number\'s location. Available for only phone numbers from the US and Canada. */ postalCode: string; /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. */ isoCountry: string; /** * The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number\'s country is required. `foreign` means an address outside of the phone number\'s country is required. */ addressRequirements: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { friendlyName: string; phoneNumber: string; lata: string; locality: string; rateCenter: string; latitude: number; longitude: number; region: string; postalCode: string; isoCountry: string; addressRequirements: string; beta: boolean; capabilities: PhoneNumberCapabilities; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class MobilePage extends Page<V2010, MobilePayload, MobileResource, MobileInstance> { /** * Initialize the MobilePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: MobileSolution); /** * Build an instance of MobileInstance * * @param payload - Payload response from the API */ getInstance(payload: MobileResource): MobileInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/incomingPhoneNumber.d.ts000064400000072021151677225100015246 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; import { AssignedAddOnListInstance } from "./incomingPhoneNumber/assignedAddOn"; import { LocalListInstance } from "./incomingPhoneNumber/local"; import { MobileListInstance } from "./incomingPhoneNumber/mobile"; import { TollFreeListInstance } from "./incomingPhoneNumber/tollFree"; import { PhoneNumberCapabilities } from "../../../../interfaces"; export type IncomingPhoneNumberAddressRequirement = "none" | "any" | "local" | "foreign"; export type IncomingPhoneNumberEmergencyAddressStatus = "registered" | "unregistered" | "pending-registration" | "registration-failure" | "pending-unregistration" | "unregistration-failure"; export type IncomingPhoneNumberEmergencyStatus = "Active" | "Inactive"; export type IncomingPhoneNumberVoiceReceiveMode = "voice" | "fax"; /** * Options to pass to update a IncomingPhoneNumberInstance */ export interface IncomingPhoneNumberContextUpdateOptions { /** The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resource to update. For more information, see [Exchanging Numbers Between Subaccounts](https://www.twilio.com/docs/iam/api/subaccounts#exchanging-numbers). */ accountSid?: string; /** The API version to use for incoming calls made to the phone number. The default is `2010-04-01`. */ apiVersion?: string; /** A descriptive string that you created to describe this phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. */ friendlyName?: string; /** The SID of the application that should handle SMS messages sent to the number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. */ smsApplicationSid?: string; /** The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsFallbackMethod?: string; /** The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. */ smsFallbackUrl?: string; /** The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsMethod?: string; /** The URL we should call when the phone number receives an incoming SMS message. */ smsUrl?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ statusCallbackMethod?: string; /** The SID of the application we should use to handle phone calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid?: string; /** Whether to lookup the caller\\\'s name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. */ voiceCallerIdLookup?: boolean; /** The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceFallbackMethod?: string; /** The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl?: string; /** The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceMethod?: string; /** The URL that we should call to answer a call to the phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl?: string; /** */ emergencyStatus?: IncomingPhoneNumberEmergencyStatus; /** The SID of the emergency address configuration to use for emergency calling from this phone number. */ emergencyAddressSid?: string; /** The SID of the Trunk we should use to handle phone calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid?: string; /** */ voiceReceiveMode?: IncomingPhoneNumberVoiceReceiveMode; /** The SID of the Identity resource that we should associate with the phone number. Some regions require an identity to meet local regulations. */ identitySid?: string; /** The SID of the Address resource we should associate with the phone number. Some regions require addresses to meet local regulations. */ addressSid?: string; /** The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. */ bundleSid?: string; } /** * Options to pass to create a IncomingPhoneNumberInstance */ export interface IncomingPhoneNumberListInstanceCreateOptions { /** The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. */ apiVersion?: string; /** A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the new phone number. */ friendlyName?: string; /** The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. */ smsApplicationSid?: string; /** The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsFallbackMethod?: string; /** The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. */ smsFallbackUrl?: string; /** The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. */ smsMethod?: string; /** The URL we should call when the new phone number receives an incoming SMS message. */ smsUrl?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ statusCallbackMethod?: string; /** The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid?: string; /** Whether to lookup the caller\\\'s name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. */ voiceCallerIdLookup?: boolean; /** The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceFallbackMethod?: string; /** The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl?: string; /** The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. */ voiceMethod?: string; /** The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl?: string; /** */ emergencyStatus?: IncomingPhoneNumberEmergencyStatus; /** The SID of the emergency address configuration to use for emergency calling from the new phone number. */ emergencyAddressSid?: string; /** The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid?: string; /** The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. */ identitySid?: string; /** The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. */ addressSid?: string; /** */ voiceReceiveMode?: IncomingPhoneNumberVoiceReceiveMode; /** The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. */ bundleSid?: string; /** The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. */ phoneNumber?: string; /** The desired area code for your new incoming phone number. Can be any three-digit, US or Canada area code. We will provision an available phone number within this area code for you. **You must provide an `area_code` or a `phone_number`.** (US and Canada only). */ areaCode?: string; } /** * Options to pass to each */ export interface IncomingPhoneNumberListInstanceEachOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the IncomingPhoneNumber resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: IncomingPhoneNumberInstance, 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 IncomingPhoneNumberListInstanceOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the IncomingPhoneNumber resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface IncomingPhoneNumberListInstancePageOptions { /** Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. */ beta?: boolean; /** A string that identifies the IncomingPhoneNumber resources to read. */ friendlyName?: string; /** The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use \'*\' as a wildcard for any digit. */ phoneNumber?: string; /** Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. */ origin?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface IncomingPhoneNumberContext { assignedAddOns: AssignedAddOnListInstance; /** * Remove a IncomingPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IncomingPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IncomingPhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; /** * Update a IncomingPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IncomingPhoneNumberInstance */ update(callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; /** * Update a IncomingPhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IncomingPhoneNumberInstance */ update(params: IncomingPhoneNumberContextUpdateOptions, callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface IncomingPhoneNumberContextSolution { accountSid: string; sid: string; } export declare class IncomingPhoneNumberContextImpl implements IncomingPhoneNumberContext { protected _version: V2010; protected _solution: IncomingPhoneNumberContextSolution; protected _uri: string; protected _assignedAddOns?: AssignedAddOnListInstance; constructor(_version: V2010, accountSid: string, sid: string); get assignedAddOns(): AssignedAddOnListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; update(params?: IncomingPhoneNumberContextUpdateOptions | ((error: Error | null, item?: IncomingPhoneNumberInstance) => any), callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): IncomingPhoneNumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface IncomingPhoneNumberPayload extends TwilioResponsePayload { incoming_phone_numbers: IncomingPhoneNumberResource[]; } interface IncomingPhoneNumberResource { account_sid: string; address_sid: string; address_requirements: IncomingPhoneNumberAddressRequirement; api_version: string; beta: boolean; capabilities: PhoneNumberCapabilities; date_created: Date; date_updated: Date; friendly_name: string; identity_sid: string; phone_number: string; origin: string; sid: string; sms_application_sid: string; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_url: string; status_callback: string; status_callback_method: string; trunk_sid: string; uri: string; voice_receive_mode: IncomingPhoneNumberVoiceReceiveMode; voice_application_sid: string; voice_caller_id_lookup: boolean; voice_fallback_method: string; voice_fallback_url: string; voice_method: string; voice_url: string; emergency_status: IncomingPhoneNumberEmergencyStatus; emergency_address_sid: string; emergency_address_status: IncomingPhoneNumberEmergencyAddressStatus; bundle_sid: string; status: string; } export declare class IncomingPhoneNumberInstance { protected _version: V2010; protected _solution: IncomingPhoneNumberContextSolution; protected _context?: IncomingPhoneNumberContext; constructor(_version: V2010, payload: IncomingPhoneNumberResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this IncomingPhoneNumber resource. */ accountSid: string; /** * The SID of the Address resource associated with the phone number. */ addressSid: string; addressRequirements: IncomingPhoneNumberAddressRequirement; /** * The API version used to start a new TwiML session. */ apiVersion: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; capabilities: PhoneNumberCapabilities; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. */ identitySid: string; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The phone number\'s origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. */ origin: string; /** * The unique string that that we created to identify this IncomingPhoneNumber resource. */ sid: string; /** * The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. */ smsApplicationSid: string; /** * The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod: string; /** * The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl: string; /** * The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. */ smsMethod: string; /** * The URL we call when the phone number receives an incoming SMS message. */ smsUrl: string; /** * The URL we call using the `status_callback_method` to send status information to your application. */ statusCallback: string; /** * The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. */ statusCallbackMethod: string; /** * The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; voiceReceiveMode: IncomingPhoneNumberVoiceReceiveMode; /** * The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid: string; /** * Whether we look up the caller\'s caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. */ voiceCallerIdLookup: boolean; /** * The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod: string; /** * The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl: string; /** * The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod: string; /** * The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl: string; emergencyStatus: IncomingPhoneNumberEmergencyStatus; /** * The SID of the emergency address configuration that we use for emergency calling from this phone number. */ emergencyAddressSid: string; emergencyAddressStatus: IncomingPhoneNumberEmergencyAddressStatus; /** * The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. */ bundleSid: string; status: string; private get _proxy(); /** * Remove a IncomingPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IncomingPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IncomingPhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; /** * Update a IncomingPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IncomingPhoneNumberInstance */ update(callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; /** * Update a IncomingPhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IncomingPhoneNumberInstance */ update(params: IncomingPhoneNumberContextUpdateOptions, callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; /** * Access the assignedAddOns. */ assignedAddOns(): AssignedAddOnListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; addressSid: string; addressRequirements: IncomingPhoneNumberAddressRequirement; apiVersion: string; beta: boolean; capabilities: PhoneNumberCapabilities; dateCreated: Date; dateUpdated: Date; friendlyName: string; identitySid: string; phoneNumber: string; origin: string; sid: string; smsApplicationSid: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; statusCallback: string; statusCallbackMethod: string; trunkSid: string; uri: string; voiceReceiveMode: IncomingPhoneNumberVoiceReceiveMode; voiceApplicationSid: string; voiceCallerIdLookup: boolean; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceUrl: string; emergencyStatus: IncomingPhoneNumberEmergencyStatus; emergencyAddressSid: string; emergencyAddressStatus: IncomingPhoneNumberEmergencyAddressStatus; bundleSid: string; status: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface IncomingPhoneNumberSolution { accountSid: string; } export interface IncomingPhoneNumberListInstance { _version: V2010; _solution: IncomingPhoneNumberSolution; _uri: string; (sid: string): IncomingPhoneNumberContext; get(sid: string): IncomingPhoneNumberContext; _local?: LocalListInstance; local: LocalListInstance; _mobile?: MobileListInstance; mobile: MobileListInstance; _tollFree?: TollFreeListInstance; tollFree: TollFreeListInstance; /** * Create a IncomingPhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IncomingPhoneNumberInstance */ create(callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; /** * Create a IncomingPhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IncomingPhoneNumberInstance */ create(params: IncomingPhoneNumberListInstanceCreateOptions, callback?: (error: Error | null, item?: IncomingPhoneNumberInstance) => any): Promise<IncomingPhoneNumberInstance>; /** * Streams IncomingPhoneNumberInstance 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 { IncomingPhoneNumberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: IncomingPhoneNumberInstance, done: (err?: Error) => void) => void): void; each(params: IncomingPhoneNumberListInstanceEachOptions, callback?: (item: IncomingPhoneNumberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of IncomingPhoneNumberInstance 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: IncomingPhoneNumberPage) => any): Promise<IncomingPhoneNumberPage>; /** * Lists IncomingPhoneNumberInstance 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 { IncomingPhoneNumberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: IncomingPhoneNumberInstance[]) => any): Promise<IncomingPhoneNumberInstance[]>; list(params: IncomingPhoneNumberListInstanceOptions, callback?: (error: Error | null, items: IncomingPhoneNumberInstance[]) => any): Promise<IncomingPhoneNumberInstance[]>; /** * Retrieve a single page of IncomingPhoneNumberInstance 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 { IncomingPhoneNumberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: IncomingPhoneNumberPage) => any): Promise<IncomingPhoneNumberPage>; page(params: IncomingPhoneNumberListInstancePageOptions, callback?: (error: Error | null, items: IncomingPhoneNumberPage) => any): Promise<IncomingPhoneNumberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function IncomingPhoneNumberListInstance(version: V2010, accountSid: string): IncomingPhoneNumberListInstance; export declare class IncomingPhoneNumberPage extends Page<V2010, IncomingPhoneNumberPayload, IncomingPhoneNumberResource, IncomingPhoneNumberInstance> { /** * Initialize the IncomingPhoneNumberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: IncomingPhoneNumberSolution); /** * Build an instance of IncomingPhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload: IncomingPhoneNumberResource): IncomingPhoneNumberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/validationRequest.d.ts000064400000007033151677225100015004 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../V2010"; /** * Options to pass to create a ValidationRequestInstance */ export interface ValidationRequestListInstanceCreateOptions { /** The phone number to verify in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** A descriptive string that you create to describe the new caller ID resource. It can be up to 64 characters long. The default value is a formatted version of the phone number. */ friendlyName?: string; /** The number of seconds to delay before initiating the verification call. Can be an integer between `0` and `60`, inclusive. The default is `0`. */ callDelay?: number; /** The digits to dial after connecting the verification call. */ extension?: string; /** The URL we should call using the `status_callback_method` to send status information about the verification process to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`, and the default is `POST`. */ statusCallbackMethod?: string; } export interface ValidationRequestSolution { accountSid: string; } export interface ValidationRequestListInstance { _version: V2010; _solution: ValidationRequestSolution; _uri: string; /** * Create a ValidationRequestInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ValidationRequestInstance */ create(params: ValidationRequestListInstanceCreateOptions, callback?: (error: Error | null, item?: ValidationRequestInstance) => any): Promise<ValidationRequestInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ValidationRequestListInstance(version: V2010, accountSid: string): ValidationRequestListInstance; interface ValidationRequestResource { account_sid: string; call_sid: string; friendly_name: string; phone_number: string; validation_code: string; } export declare class ValidationRequestInstance { protected _version: V2010; constructor(_version: V2010, payload: ValidationRequestResource, accountSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for the Caller ID. */ accountSid: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Caller ID is associated with. */ callSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The phone number to verify in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The 6 digit validation code that someone must enter to validate the Caller ID when `phone_number` is called. */ validationCode: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; callSid: string; friendlyName: string; phoneNumber: string; validationCode: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/message/feedback.d.ts000064400000005631151677225100014453 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../../V2010"; export type FeedbackOutcome = "confirmed" | "unconfirmed"; /** * Options to pass to create a FeedbackInstance */ export interface FeedbackListInstanceCreateOptions { /** */ outcome?: FeedbackOutcome; } export interface FeedbackSolution { accountSid: string; messageSid: string; } export interface FeedbackListInstance { _version: V2010; _solution: FeedbackSolution; _uri: string; /** * Create a FeedbackInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FeedbackInstance */ create(callback?: (error: Error | null, item?: FeedbackInstance) => any): Promise<FeedbackInstance>; /** * Create a FeedbackInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FeedbackInstance */ create(params: FeedbackListInstanceCreateOptions, callback?: (error: Error | null, item?: FeedbackInstance) => any): Promise<FeedbackInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FeedbackListInstance(version: V2010, accountSid: string, messageSid: string): FeedbackListInstance; interface FeedbackResource { account_sid: string; message_sid: string; outcome: FeedbackOutcome; date_created: Date; date_updated: Date; uri: string; } export declare class FeedbackInstance { protected _version: V2010; constructor(_version: V2010, payload: FeedbackResource, accountSid: string, messageSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with this MessageFeedback resource. */ accountSid: string; /** * The SID of the Message resource associated with this MessageFeedback resource. */ messageSid: string; outcome: FeedbackOutcome; /** * The date and time in GMT when this MessageFeedback resource was created, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT when this MessageFeedback resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; messageSid: string; outcome: FeedbackOutcome; dateCreated: Date; dateUpdated: Date; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/message/media.d.ts000064400000031421151677225100014002 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; /** * Options to pass to each */ export interface MediaListInstanceEachOptions { /** Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. */ dateCreated?: Date; /** Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. */ dateCreatedBefore?: Date; /** Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. */ dateCreatedAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: MediaInstance, 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 MediaListInstanceOptions { /** Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. */ dateCreated?: Date; /** Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. */ dateCreatedBefore?: Date; /** Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. */ dateCreatedAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface MediaListInstancePageOptions { /** Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. */ dateCreated?: Date; /** Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. */ dateCreatedBefore?: Date; /** Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. */ dateCreatedAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface MediaContext { /** * Remove a MediaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MediaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MediaInstance */ fetch(callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MediaContextSolution { accountSid: string; messageSid: string; sid: string; } export declare class MediaContextImpl implements MediaContext { protected _version: V2010; protected _solution: MediaContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, messageSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MediaContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MediaPayload extends TwilioResponsePayload { media_list: MediaResource[]; } interface MediaResource { account_sid: string; content_type: string; date_created: Date; date_updated: Date; parent_sid: string; sid: string; uri: string; } export declare class MediaInstance { protected _version: V2010; protected _solution: MediaContextSolution; protected _context?: MediaContext; constructor(_version: V2010, payload: MediaResource, accountSid: string, messageSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with this Media resource. */ accountSid: string; /** * The default [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) of the media, for example `image/jpeg`, `image/png`, or `image/gif`. */ contentType: string; /** * The date and time in GMT when this Media resource was created, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT when this Media resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The SID of the Message resource that is associated with this Media resource. */ parentSid: string; /** * The unique string that identifies this Media resource. */ sid: string; /** * The URI of this Media resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Remove a MediaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MediaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MediaInstance */ fetch(callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; contentType: string; dateCreated: Date; dateUpdated: Date; parentSid: string; sid: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MediaSolution { accountSid: string; messageSid: string; } export interface MediaListInstance { _version: V2010; _solution: MediaSolution; _uri: string; (sid: string): MediaContext; get(sid: string): MediaContext; /** * Streams MediaInstance 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 { MediaListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MediaInstance, done: (err?: Error) => void) => void): void; each(params: MediaListInstanceEachOptions, callback?: (item: MediaInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MediaInstance 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: MediaPage) => any): Promise<MediaPage>; /** * Lists MediaInstance 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 { MediaListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MediaInstance[]) => any): Promise<MediaInstance[]>; list(params: MediaListInstanceOptions, callback?: (error: Error | null, items: MediaInstance[]) => any): Promise<MediaInstance[]>; /** * Retrieve a single page of MediaInstance 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 { MediaListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MediaPage) => any): Promise<MediaPage>; page(params: MediaListInstancePageOptions, callback?: (error: Error | null, items: MediaPage) => any): Promise<MediaPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MediaListInstance(version: V2010, accountSid: string, messageSid: string): MediaListInstance; export declare class MediaPage extends Page<V2010, MediaPayload, MediaResource, MediaInstance> { /** * Initialize the MediaPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: MediaSolution); /** * Build an instance of MediaInstance * * @param payload - Payload response from the API */ getInstance(payload: MediaResource): MediaInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/message/media.js000064400000020441151677225100013546 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.MediaPage = exports.MediaListInstance = exports.MediaInstance = exports.MediaContextImpl = void 0; 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 MediaContextImpl { constructor(_version, accountSid, messageSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(messageSid)) { throw new Error("Parameter 'messageSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, messageSid, sid }; this._uri = `/Accounts/${accountSid}/Messages/${messageSid}/Media/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MediaInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.messageSid, 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.MediaContextImpl = MediaContextImpl; class MediaInstance { constructor(_version, payload, accountSid, messageSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.contentType = payload.content_type; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.parentSid = payload.parent_sid; this.sid = payload.sid; this.uri = payload.uri; this._solution = { accountSid, messageSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MediaContextImpl(this._version, this._solution.accountSid, this._solution.messageSid, this._solution.sid); return this._context; } /** * Remove a MediaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a MediaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MediaInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, contentType: this.contentType, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, parentSid: this.parentSid, sid: this.sid, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MediaInstance = MediaInstance; function MediaListInstance(version, accountSid, messageSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(messageSid)) { throw new Error("Parameter 'messageSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MediaContextImpl(version, accountSid, messageSid, sid); }; instance._version = version; instance._solution = { accountSid, messageSid }; instance._uri = `/Accounts/${accountSid}/Messages/${messageSid}/Media.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreated<"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); if (params["dateCreatedAfter"] !== undefined) data["DateCreated>"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MediaPage(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 MediaPage(instance._version, payload, 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; } exports.MediaListInstance = MediaListInstance; class MediaPage extends Page_1.default { /** * Initialize the MediaPage * * @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 MediaInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MediaInstance(this._version, payload, this._solution.accountSid, this._solution.messageSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MediaPage = MediaPage; rest/api/v2010/account/message/feedback.js000064400000007012151677225100014212 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.FeedbackInstance = exports.FeedbackListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function FeedbackListInstance(version, accountSid, messageSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(messageSid)) { throw new Error("Parameter 'messageSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, messageSid }; instance._uri = `/Accounts/${accountSid}/Messages/${messageSid}/Feedback.json`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["outcome"] !== undefined) data["Outcome"] = params["outcome"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FeedbackInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.messageSid)); 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; } exports.FeedbackListInstance = FeedbackListInstance; class FeedbackInstance { constructor(_version, payload, accountSid, messageSid) { this._version = _version; this.accountSid = payload.account_sid; this.messageSid = payload.message_sid; this.outcome = payload.outcome; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.uri = payload.uri; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, messageSid: this.messageSid, outcome: this.outcome, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FeedbackInstance = FeedbackInstance; rest/api/v2010/account/balance.d.ts000064400000003300151677225100012657 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../V2010"; export interface BalanceSolution { accountSid: string; } export interface BalanceListInstance { _version: V2010; _solution: BalanceSolution; _uri: string; /** * Fetch a BalanceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BalanceInstance */ fetch(callback?: (error: Error | null, item?: BalanceInstance) => any): Promise<BalanceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BalanceListInstance(version: V2010, accountSid: string): BalanceListInstance; interface BalanceResource { account_sid: string; balance: string; currency: string; } export declare class BalanceInstance { protected _version: V2010; constructor(_version: V2010, payload: BalanceResource, accountSid: string); /** * The unique SID identifier of the Account. */ accountSid: string; /** * The balance of the Account, in units specified by the unit parameter. Balance changes may not be reflected immediately. Child accounts do not contain balance information */ balance: string; /** * The units of currency for the account balance */ currency: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; balance: string; currency: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/signingKey.d.ts000064400000023265151677225100013415 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; /** * Options to pass to update a SigningKeyInstance */ export interface SigningKeyContextUpdateOptions { /** */ friendlyName?: string; } /** * Options to pass to each */ export interface SigningKeyListInstanceEachOptions { /** 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: SigningKeyInstance, 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 SigningKeyListInstanceOptions { /** 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 SigningKeyListInstancePageOptions { /** 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 SigningKeyContext { /** * Remove a SigningKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SigningKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningKeyInstance */ fetch(callback?: (error: Error | null, item?: SigningKeyInstance) => any): Promise<SigningKeyInstance>; /** * Update a SigningKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningKeyInstance */ update(callback?: (error: Error | null, item?: SigningKeyInstance) => any): Promise<SigningKeyInstance>; /** * Update a SigningKeyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningKeyInstance */ update(params: SigningKeyContextUpdateOptions, callback?: (error: Error | null, item?: SigningKeyInstance) => any): Promise<SigningKeyInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SigningKeyContextSolution { accountSid: string; sid: string; } export declare class SigningKeyContextImpl implements SigningKeyContext { protected _version: V2010; protected _solution: SigningKeyContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SigningKeyInstance) => any): Promise<SigningKeyInstance>; update(params?: SigningKeyContextUpdateOptions | ((error: Error | null, item?: SigningKeyInstance) => any), callback?: (error: Error | null, item?: SigningKeyInstance) => any): Promise<SigningKeyInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SigningKeyContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SigningKeyPayload extends TwilioResponsePayload { signing_keys: SigningKeyResource[]; } interface SigningKeyResource { sid: string; friendly_name: string; date_created: Date; date_updated: Date; } export declare class SigningKeyInstance { protected _version: V2010; protected _solution: SigningKeyContextSolution; protected _context?: SigningKeyContext; constructor(_version: V2010, payload: SigningKeyResource, accountSid: string, sid?: string); sid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; private get _proxy(); /** * Remove a SigningKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SigningKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningKeyInstance */ fetch(callback?: (error: Error | null, item?: SigningKeyInstance) => any): Promise<SigningKeyInstance>; /** * Update a SigningKeyInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningKeyInstance */ update(callback?: (error: Error | null, item?: SigningKeyInstance) => any): Promise<SigningKeyInstance>; /** * Update a SigningKeyInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SigningKeyInstance */ update(params: SigningKeyContextUpdateOptions, callback?: (error: Error | null, item?: SigningKeyInstance) => any): Promise<SigningKeyInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SigningKeySolution { accountSid: string; } export interface SigningKeyListInstance { _version: V2010; _solution: SigningKeySolution; _uri: string; (sid: string): SigningKeyContext; get(sid: string): SigningKeyContext; /** * Streams SigningKeyInstance 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 { SigningKeyListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SigningKeyInstance, done: (err?: Error) => void) => void): void; each(params: SigningKeyListInstanceEachOptions, callback?: (item: SigningKeyInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SigningKeyInstance 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: SigningKeyPage) => any): Promise<SigningKeyPage>; /** * Lists SigningKeyInstance 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 { SigningKeyListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SigningKeyInstance[]) => any): Promise<SigningKeyInstance[]>; list(params: SigningKeyListInstanceOptions, callback?: (error: Error | null, items: SigningKeyInstance[]) => any): Promise<SigningKeyInstance[]>; /** * Retrieve a single page of SigningKeyInstance 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 { SigningKeyListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SigningKeyPage) => any): Promise<SigningKeyPage>; page(params: SigningKeyListInstancePageOptions, callback?: (error: Error | null, items: SigningKeyPage) => any): Promise<SigningKeyPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SigningKeyListInstance(version: V2010, accountSid: string): SigningKeyListInstance; export declare class SigningKeyPage extends Page<V2010, SigningKeyPayload, SigningKeyResource, SigningKeyInstance> { /** * Initialize the SigningKeyPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: SigningKeySolution); /** * Build an instance of SigningKeyInstance * * @param payload - Payload response from the API */ getInstance(payload: SigningKeyResource): SigningKeyInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/shortCode.js000064400000022220151677225100012772 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.ShortCodePage = exports.ShortCodeListInstance = exports.ShortCodeInstance = exports.ShortCodeContextImpl = void 0; 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 ShortCodeContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/SMS/ShortCodes/${sid}.json`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ShortCodeInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["apiVersion"] !== undefined) data["ApiVersion"] = params["apiVersion"]; if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ShortCodeInstance(operationVersion, payload, instance._solution.accountSid, 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.ShortCodeContextImpl = ShortCodeContextImpl; class ShortCodeInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.shortCode = payload.short_code; this.sid = payload.sid; this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsUrl = payload.sms_url; this.uri = payload.uri; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ShortCodeContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Fetch a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, shortCode: this.shortCode, sid: this.sid, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsUrl: this.smsUrl, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ShortCodeInstance = ShortCodeInstance; function ShortCodeListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ShortCodeContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/SMS/ShortCodes.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["shortCode"] !== undefined) data["ShortCode"] = params["shortCode"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ShortCodePage(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 ShortCodePage(instance._version, payload, 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; } exports.ShortCodeListInstance = ShortCodeListInstance; class ShortCodePage extends Page_1.default { /** * Initialize the ShortCodePage * * @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 ShortCodeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ShortCodeInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ShortCodePage = ShortCodePage; rest/api/v2010/account/newSigningKey.js000064400000006423151677225100013630 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.NewSigningKeyInstance = exports.NewSigningKeyListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function NewSigningKeyListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/SigningKeys.json`; instance.create = function create(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"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new NewSigningKeyInstance(operationVersion, payload, instance._solution.accountSid)); 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; } exports.NewSigningKeyListInstance = NewSigningKeyListInstance; class NewSigningKeyInstance { constructor(_version, payload, accountSid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.secret = payload.secret; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, secret: this.secret, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NewSigningKeyInstance = NewSigningKeyInstance; rest/api/v2010/account/recording.js000064400000024646151677225100013032 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.RecordingPage = exports.RecordingListInstance = exports.RecordingInstance = exports.RecordingContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const addOnResult_1 = require("./recording/addOnResult"); const transcription_1 = require("./recording/transcription"); class RecordingContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Recordings/${sid}.json`; } get addOnResults() { this._addOnResults = this._addOnResults || (0, addOnResult_1.AddOnResultListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._addOnResults; } get transcriptions() { this._transcriptions = this._transcriptions || (0, transcription_1.TranscriptionListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._transcriptions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["includeSoftDeleted"] !== undefined) data["IncludeSoftDeleted"] = serialize.bool(params["includeSoftDeleted"]); const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.accountSid, 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.RecordingContextImpl = RecordingContextImpl; class RecordingInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.callSid = payload.call_sid; this.conferenceSid = payload.conference_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.startTime = deserialize.rfc2822DateTime(payload.start_time); this.duration = payload.duration; this.sid = payload.sid; this.price = payload.price; this.priceUnit = payload.price_unit; this.status = payload.status; this.channels = deserialize.integer(payload.channels); this.source = payload.source; this.errorCode = deserialize.integer(payload.error_code); this.uri = payload.uri; this.encryptionDetails = payload.encryption_details; this.subresourceUris = payload.subresource_uris; this.mediaUrl = payload.media_url; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RecordingContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Access the addOnResults. */ addOnResults() { return this._proxy.addOnResults; } /** * Access the transcriptions. */ transcriptions() { return this._proxy.transcriptions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, callSid: this.callSid, conferenceSid: this.conferenceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, startTime: this.startTime, duration: this.duration, sid: this.sid, price: this.price, priceUnit: this.priceUnit, status: this.status, channels: this.channels, source: this.source, errorCode: this.errorCode, uri: this.uri, encryptionDetails: this.encryptionDetails, subresourceUris: this.subresourceUris, mediaUrl: this.mediaUrl, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingInstance = RecordingInstance; function RecordingListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RecordingContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Recordings.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreated<"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); if (params["dateCreatedAfter"] !== undefined) data["DateCreated>"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["callSid"] !== undefined) data["CallSid"] = params["callSid"]; if (params["conferenceSid"] !== undefined) data["ConferenceSid"] = params["conferenceSid"]; if (params["includeSoftDeleted"] !== undefined) data["IncludeSoftDeleted"] = serialize.bool(params["includeSoftDeleted"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingPage(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 RecordingPage(instance._version, payload, 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; } exports.RecordingListInstance = RecordingListInstance; class RecordingPage extends Page_1.default { /** * Initialize the RecordingPage * * @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 RecordingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RecordingInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingPage = RecordingPage; rest/api/v2010/account/queue.d.ts000064400000027415151677225100012433 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; import { MemberListInstance } from "./queue/member"; /** * Options to pass to update a QueueInstance */ export interface QueueContextUpdateOptions { /** A descriptive string that you created to describe this resource. It can be up to 64 characters long. */ friendlyName?: string; /** The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000. */ maxSize?: number; } /** * Options to pass to create a QueueInstance */ export interface QueueListInstanceCreateOptions { /** A descriptive string that you created to describe this resource. It can be up to 64 characters long. */ friendlyName: string; /** The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000. */ maxSize?: number; } /** * Options to pass to each */ export interface QueueListInstanceEachOptions { /** 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: QueueInstance, 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 QueueListInstanceOptions { /** 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 QueueListInstancePageOptions { /** 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 QueueContext { members: MemberListInstance; /** * Remove a QueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a QueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed QueueInstance */ fetch(callback?: (error: Error | null, item?: QueueInstance) => any): Promise<QueueInstance>; /** * Update a QueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed QueueInstance */ update(callback?: (error: Error | null, item?: QueueInstance) => any): Promise<QueueInstance>; /** * Update a QueueInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed QueueInstance */ update(params: QueueContextUpdateOptions, callback?: (error: Error | null, item?: QueueInstance) => any): Promise<QueueInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface QueueContextSolution { accountSid: string; sid: string; } export declare class QueueContextImpl implements QueueContext { protected _version: V2010; protected _solution: QueueContextSolution; protected _uri: string; protected _members?: MemberListInstance; constructor(_version: V2010, accountSid: string, sid: string); get members(): MemberListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: QueueInstance) => any): Promise<QueueInstance>; update(params?: QueueContextUpdateOptions | ((error: Error | null, item?: QueueInstance) => any), callback?: (error: Error | null, item?: QueueInstance) => any): Promise<QueueInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): QueueContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface QueuePayload extends TwilioResponsePayload { queues: QueueResource[]; } interface QueueResource { date_updated: Date; current_size: number; friendly_name: string; uri: string; account_sid: string; average_wait_time: number; sid: string; date_created: Date; max_size: number; } export declare class QueueInstance { protected _version: V2010; protected _solution: QueueContextSolution; protected _context?: QueueContext; constructor(_version: V2010, payload: QueueResource, accountSid: string, sid?: string); /** * The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The number of calls currently in the queue. */ currentSize: number; /** * A string that you assigned to describe this resource. */ friendlyName: string; /** * The URI of this resource, relative to `https://api.twilio.com`. */ uri: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Queue resource. */ accountSid: string; /** * The average wait time in seconds of the members in this queue. This is calculated at the time of the request. */ averageWaitTime: number; /** * The unique string that that we created to identify this Queue resource. */ sid: string; /** * The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000. */ maxSize: number; private get _proxy(); /** * Remove a QueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a QueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed QueueInstance */ fetch(callback?: (error: Error | null, item?: QueueInstance) => any): Promise<QueueInstance>; /** * Update a QueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed QueueInstance */ update(callback?: (error: Error | null, item?: QueueInstance) => any): Promise<QueueInstance>; /** * Update a QueueInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed QueueInstance */ update(params: QueueContextUpdateOptions, callback?: (error: Error | null, item?: QueueInstance) => any): Promise<QueueInstance>; /** * Access the members. */ members(): MemberListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { dateUpdated: Date; currentSize: number; friendlyName: string; uri: string; accountSid: string; averageWaitTime: number; sid: string; dateCreated: Date; maxSize: number; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface QueueSolution { accountSid: string; } export interface QueueListInstance { _version: V2010; _solution: QueueSolution; _uri: string; (sid: string): QueueContext; get(sid: string): QueueContext; /** * Create a QueueInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed QueueInstance */ create(params: QueueListInstanceCreateOptions, callback?: (error: Error | null, item?: QueueInstance) => any): Promise<QueueInstance>; /** * Streams QueueInstance 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 { QueueListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: QueueInstance, done: (err?: Error) => void) => void): void; each(params: QueueListInstanceEachOptions, callback?: (item: QueueInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of QueueInstance 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: QueuePage) => any): Promise<QueuePage>; /** * Lists QueueInstance 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 { QueueListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: QueueInstance[]) => any): Promise<QueueInstance[]>; list(params: QueueListInstanceOptions, callback?: (error: Error | null, items: QueueInstance[]) => any): Promise<QueueInstance[]>; /** * Retrieve a single page of QueueInstance 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 { QueueListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: QueuePage) => any): Promise<QueuePage>; page(params: QueueListInstancePageOptions, callback?: (error: Error | null, items: QueuePage) => any): Promise<QueuePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function QueueListInstance(version: V2010, accountSid: string): QueueListInstance; export declare class QueuePage extends Page<V2010, QueuePayload, QueueResource, QueueInstance> { /** * Initialize the QueuePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: QueueSolution); /** * Build an instance of QueueInstance * * @param payload - Payload response from the API */ getInstance(payload: QueueResource): QueueInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/availablePhoneNumberCountry.d.ts000064400000026333151677225100016754 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; import { LocalListInstance } from "./availablePhoneNumberCountry/local"; import { MachineToMachineListInstance } from "./availablePhoneNumberCountry/machineToMachine"; import { MobileListInstance } from "./availablePhoneNumberCountry/mobile"; import { NationalListInstance } from "./availablePhoneNumberCountry/national"; import { SharedCostListInstance } from "./availablePhoneNumberCountry/sharedCost"; import { TollFreeListInstance } from "./availablePhoneNumberCountry/tollFree"; import { VoipListInstance } from "./availablePhoneNumberCountry/voip"; /** * Options to pass to each */ export interface AvailablePhoneNumberCountryListInstanceEachOptions { /** 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: AvailablePhoneNumberCountryInstance, 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 AvailablePhoneNumberCountryListInstanceOptions { /** 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 AvailablePhoneNumberCountryListInstancePageOptions { /** 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 AvailablePhoneNumberCountryContext { local: LocalListInstance; machineToMachine: MachineToMachineListInstance; mobile: MobileListInstance; national: NationalListInstance; sharedCost: SharedCostListInstance; tollFree: TollFreeListInstance; voip: VoipListInstance; /** * Fetch a AvailablePhoneNumberCountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailablePhoneNumberCountryInstance */ fetch(callback?: (error: Error | null, item?: AvailablePhoneNumberCountryInstance) => any): Promise<AvailablePhoneNumberCountryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AvailablePhoneNumberCountryContextSolution { accountSid: string; countryCode: string; } export declare class AvailablePhoneNumberCountryContextImpl implements AvailablePhoneNumberCountryContext { protected _version: V2010; protected _solution: AvailablePhoneNumberCountryContextSolution; protected _uri: string; protected _local?: LocalListInstance; protected _machineToMachine?: MachineToMachineListInstance; protected _mobile?: MobileListInstance; protected _national?: NationalListInstance; protected _sharedCost?: SharedCostListInstance; protected _tollFree?: TollFreeListInstance; protected _voip?: VoipListInstance; constructor(_version: V2010, accountSid: string, countryCode: string); get local(): LocalListInstance; get machineToMachine(): MachineToMachineListInstance; get mobile(): MobileListInstance; get national(): NationalListInstance; get sharedCost(): SharedCostListInstance; get tollFree(): TollFreeListInstance; get voip(): VoipListInstance; fetch(callback?: (error: Error | null, item?: AvailablePhoneNumberCountryInstance) => any): Promise<AvailablePhoneNumberCountryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AvailablePhoneNumberCountryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AvailablePhoneNumberCountryPayload extends TwilioResponsePayload { countries: AvailablePhoneNumberCountryResource[]; } interface AvailablePhoneNumberCountryResource { country_code: string; country: string; uri: string; beta: boolean; subresource_uris: Record<string, string>; } export declare class AvailablePhoneNumberCountryInstance { protected _version: V2010; protected _solution: AvailablePhoneNumberCountryContextSolution; protected _context?: AvailablePhoneNumberCountryContext; constructor(_version: V2010, payload: AvailablePhoneNumberCountryResource, accountSid: string, countryCode?: string); /** * The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country. */ countryCode: string; /** * The name of the country. */ country: string; /** * The URI of the Country resource, relative to `https://api.twilio.com`. */ uri: string; /** * Whether all phone numbers available in the country are new to the Twilio platform. `true` if they are and `false` if all numbers are not in the Twilio Phone Number Beta program. */ beta: boolean; /** * A list of related AvailablePhoneNumber resources identified by their URIs relative to `https://api.twilio.com`. */ subresourceUris: Record<string, string>; private get _proxy(); /** * Fetch a AvailablePhoneNumberCountryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AvailablePhoneNumberCountryInstance */ fetch(callback?: (error: Error | null, item?: AvailablePhoneNumberCountryInstance) => any): Promise<AvailablePhoneNumberCountryInstance>; /** * Access the local. */ local(): LocalListInstance; /** * Access the machineToMachine. */ machineToMachine(): MachineToMachineListInstance; /** * Access the mobile. */ mobile(): MobileListInstance; /** * Access the national. */ national(): NationalListInstance; /** * Access the sharedCost. */ sharedCost(): SharedCostListInstance; /** * Access the tollFree. */ tollFree(): TollFreeListInstance; /** * Access the voip. */ voip(): VoipListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { countryCode: string; country: string; uri: string; beta: boolean; subresourceUris: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AvailablePhoneNumberCountrySolution { accountSid: string; } export interface AvailablePhoneNumberCountryListInstance { _version: V2010; _solution: AvailablePhoneNumberCountrySolution; _uri: string; (countryCode: string): AvailablePhoneNumberCountryContext; get(countryCode: string): AvailablePhoneNumberCountryContext; /** * Streams AvailablePhoneNumberCountryInstance 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 { AvailablePhoneNumberCountryListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AvailablePhoneNumberCountryInstance, done: (err?: Error) => void) => void): void; each(params: AvailablePhoneNumberCountryListInstanceEachOptions, callback?: (item: AvailablePhoneNumberCountryInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AvailablePhoneNumberCountryInstance 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: AvailablePhoneNumberCountryPage) => any): Promise<AvailablePhoneNumberCountryPage>; /** * Lists AvailablePhoneNumberCountryInstance 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 { AvailablePhoneNumberCountryListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AvailablePhoneNumberCountryInstance[]) => any): Promise<AvailablePhoneNumberCountryInstance[]>; list(params: AvailablePhoneNumberCountryListInstanceOptions, callback?: (error: Error | null, items: AvailablePhoneNumberCountryInstance[]) => any): Promise<AvailablePhoneNumberCountryInstance[]>; /** * Retrieve a single page of AvailablePhoneNumberCountryInstance 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 { AvailablePhoneNumberCountryListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AvailablePhoneNumberCountryPage) => any): Promise<AvailablePhoneNumberCountryPage>; page(params: AvailablePhoneNumberCountryListInstancePageOptions, callback?: (error: Error | null, items: AvailablePhoneNumberCountryPage) => any): Promise<AvailablePhoneNumberCountryPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AvailablePhoneNumberCountryListInstance(version: V2010, accountSid: string): AvailablePhoneNumberCountryListInstance; export declare class AvailablePhoneNumberCountryPage extends Page<V2010, AvailablePhoneNumberCountryPayload, AvailablePhoneNumberCountryResource, AvailablePhoneNumberCountryInstance> { /** * Initialize the AvailablePhoneNumberCountryPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AvailablePhoneNumberCountrySolution); /** * Build an instance of AvailablePhoneNumberCountryInstance * * @param payload - Payload response from the API */ getInstance(payload: AvailablePhoneNumberCountryResource): AvailablePhoneNumberCountryInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/conference.js000064400000025005151677225100013153 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.ConferencePage = exports.ConferenceListInstance = exports.ConferenceInstance = exports.ConferenceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const participant_1 = require("./conference/participant"); const recording_1 = require("./conference/recording"); class ConferenceContextImpl { constructor(_version, accountSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, sid }; this._uri = `/Accounts/${accountSid}/Conferences/${sid}.json`; } get participants() { this._participants = this._participants || (0, participant_1.ParticipantListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._participants; } get recordings() { this._recordings = this._recordings || (0, recording_1.RecordingListInstance)(this._version, this._solution.accountSid, this._solution.sid); return this._recordings; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ConferenceInstance(operationVersion, payload, instance._solution.accountSid, 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["status"] !== undefined) data["Status"] = params["status"]; if (params["announceUrl"] !== undefined) data["AnnounceUrl"] = params["announceUrl"]; if (params["announceMethod"] !== undefined) data["AnnounceMethod"] = params["announceMethod"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConferenceInstance(operationVersion, payload, instance._solution.accountSid, 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.ConferenceContextImpl = ConferenceContextImpl; class ConferenceInstance { constructor(_version, payload, accountSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.apiVersion = payload.api_version; this.friendlyName = payload.friendly_name; this.region = payload.region; this.sid = payload.sid; this.status = payload.status; this.uri = payload.uri; this.subresourceUris = payload.subresource_uris; this.reasonConferenceEnded = payload.reason_conference_ended; this.callSidEndingConference = payload.call_sid_ending_conference; this._solution = { accountSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ConferenceContextImpl(this._version, this._solution.accountSid, this._solution.sid); return this._context; } /** * Fetch a ConferenceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConferenceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the participants. */ participants() { return this._proxy.participants; } /** * Access the recordings. */ recordings() { return this._proxy.recordings; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, apiVersion: this.apiVersion, friendlyName: this.friendlyName, region: this.region, sid: this.sid, status: this.status, uri: this.uri, subresourceUris: this.subresourceUris, reasonConferenceEnded: this.reasonConferenceEnded, callSidEndingConference: this.callSidEndingConference, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConferenceInstance = ConferenceInstance; function ConferenceListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ConferenceContextImpl(version, accountSid, sid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Conferences.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601Date(params["dateCreated"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreated<"] = serialize.iso8601Date(params["dateCreatedBefore"]); if (params["dateCreatedAfter"] !== undefined) data["DateCreated>"] = serialize.iso8601Date(params["dateCreatedAfter"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601Date(params["dateUpdated"]); if (params["dateUpdatedBefore"] !== undefined) data["DateUpdated<"] = serialize.iso8601Date(params["dateUpdatedBefore"]); if (params["dateUpdatedAfter"] !== undefined) data["DateUpdated>"] = serialize.iso8601Date(params["dateUpdatedAfter"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConferencePage(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 ConferencePage(instance._version, payload, 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; } exports.ConferenceListInstance = ConferenceListInstance; class ConferencePage extends Page_1.default { /** * Initialize the ConferencePage * * @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 ConferenceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ConferenceInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConferencePage = ConferencePage; rest/api/v2010/account/recording.d.ts000064400000045615151677225100013265 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2010 from "../../V2010"; import { AddOnResultListInstance } from "./recording/addOnResult"; import { TranscriptionListInstance } from "./recording/transcription"; export type RecordingSource = "DialVerb" | "Conference" | "OutboundAPI" | "Trunking" | "RecordVerb" | "StartCallRecordingAPI" | "StartConferenceRecordingAPI"; export type RecordingStatus = "in-progress" | "paused" | "stopped" | "processing" | "completed" | "absent" | "deleted"; /** * Options to pass to fetch a RecordingInstance */ export interface RecordingContextFetchOptions { /** A boolean parameter indicating whether to retrieve soft deleted recordings or not. Recordings metadata are kept after deletion for a retention period of 40 days. */ includeSoftDeleted?: boolean; } /** * Options to pass to each */ export interface RecordingListInstanceEachOptions { /** Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. */ dateCreated?: Date; /** Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. */ dateCreatedBefore?: Date; /** Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. */ dateCreatedAfter?: Date; /** The [Call](https://www.twilio.com/docs/voice/api/call-resource) SID of the resources to read. */ callSid?: string; /** The Conference SID that identifies the conference associated with the recording to read. */ conferenceSid?: string; /** A boolean parameter indicating whether to retrieve soft deleted recordings or not. Recordings metadata are kept after deletion for a retention period of 40 days. */ includeSoftDeleted?: boolean; /** 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: RecordingInstance, 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 RecordingListInstanceOptions { /** Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. */ dateCreated?: Date; /** Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. */ dateCreatedBefore?: Date; /** Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. */ dateCreatedAfter?: Date; /** The [Call](https://www.twilio.com/docs/voice/api/call-resource) SID of the resources to read. */ callSid?: string; /** The Conference SID that identifies the conference associated with the recording to read. */ conferenceSid?: string; /** A boolean parameter indicating whether to retrieve soft deleted recordings or not. Recordings metadata are kept after deletion for a retention period of 40 days. */ includeSoftDeleted?: boolean; /** 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 RecordingListInstancePageOptions { /** Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. */ dateCreated?: Date; /** Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. */ dateCreatedBefore?: Date; /** Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. */ dateCreatedAfter?: Date; /** The [Call](https://www.twilio.com/docs/voice/api/call-resource) SID of the resources to read. */ callSid?: string; /** The Conference SID that identifies the conference associated with the recording to read. */ conferenceSid?: string; /** A boolean parameter indicating whether to retrieve soft deleted recordings or not. Recordings metadata are kept after deletion for a retention period of 40 days. */ includeSoftDeleted?: boolean; /** 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 RecordingContext { addOnResults: AddOnResultListInstance; transcriptions: TranscriptionListInstance; /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Fetch a RecordingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(params: RecordingContextFetchOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RecordingContextSolution { accountSid: string; sid: string; } export declare class RecordingContextImpl implements RecordingContext { protected _version: V2010; protected _solution: RecordingContextSolution; protected _uri: string; protected _addOnResults?: AddOnResultListInstance; protected _transcriptions?: TranscriptionListInstance; constructor(_version: V2010, accountSid: string, sid: string); get addOnResults(): AddOnResultListInstance; get transcriptions(): TranscriptionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(params?: RecordingContextFetchOptions | ((error: Error | null, item?: RecordingInstance) => any), callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RecordingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RecordingPayload extends TwilioResponsePayload { recordings: RecordingResource[]; } interface RecordingResource { account_sid: string; api_version: string; call_sid: string; conference_sid: string; date_created: Date; date_updated: Date; start_time: Date; duration: string; sid: string; price: string; price_unit: string; status: RecordingStatus; channels: number; source: RecordingSource; error_code: number; uri: string; encryption_details: any; subresource_uris: Record<string, string>; media_url: string; } export declare class RecordingInstance { protected _version: V2010; protected _solution: RecordingContextSolution; protected _context?: RecordingContext; constructor(_version: V2010, payload: RecordingResource, accountSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. */ accountSid: string; /** * The API version used during the recording. */ apiVersion: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. This will always refer to the parent leg of a two-leg call. */ callSid: string; /** * The Conference SID that identifies the conference associated with the recording, if a conference recording. */ conferenceSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ startTime: Date; /** * The length of the recording in seconds. */ duration: string; /** * The unique string that that we created to identify the Recording resource. */ sid: string; /** * The one-time cost of creating the recording in the `price_unit` currency. */ price: string; /** * The currency used in the `price` property. Example: `USD`. */ priceUnit: string; status: RecordingStatus; /** * The number of channels in the final recording file. Can be: `1` or `2`. You can split a call with two legs into two separate recording channels if you record using [TwiML Dial](https://www.twilio.com/docs/voice/twiml/dial#record) or the [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls#manage-your-outbound-call). */ channels: number; source: RecordingSource; /** * The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. */ errorCode: number; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. */ encryptionDetails: any; /** * A list of related resources identified by their relative URIs. */ subresourceUris: Record<string, string>; /** * The URL of the media file associated with this recording resource. When stored externally, this is the full URL location of the media file. */ mediaUrl: string; private get _proxy(); /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Fetch a RecordingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(params: RecordingContextFetchOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Access the addOnResults. */ addOnResults(): AddOnResultListInstance; /** * Access the transcriptions. */ transcriptions(): TranscriptionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; callSid: string; conferenceSid: string; dateCreated: Date; dateUpdated: Date; startTime: Date; duration: string; sid: string; price: string; priceUnit: string; status: RecordingStatus; channels: number; source: RecordingSource; errorCode: number; uri: string; encryptionDetails: any; subresourceUris: Record<string, string>; mediaUrl: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RecordingSolution { accountSid: string; } export interface RecordingListInstance { _version: V2010; _solution: RecordingSolution; _uri: string; (sid: string): RecordingContext; get(sid: string): RecordingContext; /** * Streams RecordingInstance 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 { RecordingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RecordingInstance, done: (err?: Error) => void) => void): void; each(params: RecordingListInstanceEachOptions, callback?: (item: RecordingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RecordingInstance 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: RecordingPage) => any): Promise<RecordingPage>; /** * Lists RecordingInstance 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 { RecordingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RecordingInstance[]) => any): Promise<RecordingInstance[]>; list(params: RecordingListInstanceOptions, callback?: (error: Error | null, items: RecordingInstance[]) => any): Promise<RecordingInstance[]>; /** * Retrieve a single page of RecordingInstance 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 { RecordingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RecordingPage) => any): Promise<RecordingPage>; page(params: RecordingListInstancePageOptions, callback?: (error: Error | null, items: RecordingPage) => any): Promise<RecordingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RecordingListInstance(version: V2010, accountSid: string): RecordingListInstance; export declare class RecordingPage extends Page<V2010, RecordingPayload, RecordingResource, RecordingInstance> { /** * Initialize the RecordingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: RecordingSolution); /** * Build an instance of RecordingInstance * * @param payload - Payload response from the API */ getInstance(payload: RecordingResource): RecordingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/authorizedConnectApp.js000064400000017224151677225100015201 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.AuthorizedConnectAppPage = exports.AuthorizedConnectAppListInstance = exports.AuthorizedConnectAppInstance = exports.AuthorizedConnectAppContextImpl = void 0; 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 AuthorizedConnectAppContextImpl { constructor(_version, accountSid, connectAppSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(connectAppSid)) { throw new Error("Parameter 'connectAppSid' is not valid."); } this._solution = { accountSid, connectAppSid }; this._uri = `/Accounts/${accountSid}/AuthorizedConnectApps/${connectAppSid}.json`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AuthorizedConnectAppInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.connectAppSid)); 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.AuthorizedConnectAppContextImpl = AuthorizedConnectAppContextImpl; class AuthorizedConnectAppInstance { constructor(_version, payload, accountSid, connectAppSid) { this._version = _version; this.accountSid = payload.account_sid; this.connectAppCompanyName = payload.connect_app_company_name; this.connectAppDescription = payload.connect_app_description; this.connectAppFriendlyName = payload.connect_app_friendly_name; this.connectAppHomepageUrl = payload.connect_app_homepage_url; this.connectAppSid = payload.connect_app_sid; this.permissions = payload.permissions; this.uri = payload.uri; this._solution = { accountSid, connectAppSid: connectAppSid || this.connectAppSid, }; } get _proxy() { this._context = this._context || new AuthorizedConnectAppContextImpl(this._version, this._solution.accountSid, this._solution.connectAppSid); return this._context; } /** * Fetch a AuthorizedConnectAppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizedConnectAppInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, connectAppCompanyName: this.connectAppCompanyName, connectAppDescription: this.connectAppDescription, connectAppFriendlyName: this.connectAppFriendlyName, connectAppHomepageUrl: this.connectAppHomepageUrl, connectAppSid: this.connectAppSid, permissions: this.permissions, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthorizedConnectAppInstance = AuthorizedConnectAppInstance; function AuthorizedConnectAppListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = ((connectAppSid) => instance.get(connectAppSid)); instance.get = function get(connectAppSid) { return new AuthorizedConnectAppContextImpl(version, accountSid, connectAppSid); }; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/AuthorizedConnectApps.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AuthorizedConnectAppPage(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 AuthorizedConnectAppPage(instance._version, payload, 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; } exports.AuthorizedConnectAppListInstance = AuthorizedConnectAppListInstance; class AuthorizedConnectAppPage extends Page_1.default { /** * Initialize the AuthorizedConnectAppPage * * @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 AuthorizedConnectAppInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AuthorizedConnectAppInstance(this._version, payload, this._solution.accountSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthorizedConnectAppPage = AuthorizedConnectAppPage; rest/api/v2010/account/call/userDefinedMessageSubscription.js000064400000014035151677225100020127 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.UserDefinedMessageSubscriptionListInstance = exports.UserDefinedMessageSubscriptionInstance = exports.UserDefinedMessageSubscriptionContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class UserDefinedMessageSubscriptionContextImpl { constructor(_version, accountSid, callSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, callSid, sid }; this._uri = `/Accounts/${accountSid}/Calls/${callSid}/UserDefinedMessageSubscriptions/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); 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.UserDefinedMessageSubscriptionContextImpl = UserDefinedMessageSubscriptionContextImpl; class UserDefinedMessageSubscriptionInstance { constructor(_version, payload, accountSid, callSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.callSid = payload.call_sid; this.sid = payload.sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.uri = payload.uri; this._solution = { accountSid, callSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserDefinedMessageSubscriptionContextImpl(this._version, this._solution.accountSid, this._solution.callSid, this._solution.sid); return this._context; } /** * Remove a UserDefinedMessageSubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, callSid: this.callSid, sid: this.sid, dateCreated: this.dateCreated, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserDefinedMessageSubscriptionInstance = UserDefinedMessageSubscriptionInstance; function UserDefinedMessageSubscriptionListInstance(version, accountSid, callSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserDefinedMessageSubscriptionContextImpl(version, accountSid, callSid, sid); }; instance._version = version; instance._solution = { accountSid, callSid }; instance._uri = `/Accounts/${accountSid}/Calls/${callSid}/UserDefinedMessageSubscriptions.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["callback"] === null || params["callback"] === undefined) { throw new Error("Required parameter \"params['callback']\" missing."); } let data = {}; data["Callback"] = params["callback"]; if (params["idempotencyKey"] !== undefined) data["IdempotencyKey"] = params["idempotencyKey"]; if (params["method"] !== undefined) data["Method"] = params["method"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserDefinedMessageSubscriptionInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid)); 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; } exports.UserDefinedMessageSubscriptionListInstance = UserDefinedMessageSubscriptionListInstance; rest/api/v2010/account/call/userDefinedMessage.js000064400000007120151677225100015517 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.UserDefinedMessageInstance = exports.UserDefinedMessageListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function UserDefinedMessageListInstance(version, accountSid, callSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, callSid }; instance._uri = `/Accounts/${accountSid}/Calls/${callSid}/UserDefinedMessages.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["content"] === null || params["content"] === undefined) { throw new Error("Required parameter \"params['content']\" missing."); } let data = {}; data["Content"] = params["content"]; if (params["idempotencyKey"] !== undefined) data["IdempotencyKey"] = params["idempotencyKey"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserDefinedMessageInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid)); 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; } exports.UserDefinedMessageListInstance = UserDefinedMessageListInstance; class UserDefinedMessageInstance { constructor(_version, payload, accountSid, callSid) { this._version = _version; this.accountSid = payload.account_sid; this.callSid = payload.call_sid; this.sid = payload.sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, callSid: this.callSid, sid: this.sid, dateCreated: this.dateCreated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserDefinedMessageInstance = UserDefinedMessageInstance; rest/api/v2010/account/call/siprec.d.ts000064400000041675151677225100013513 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../../V2010"; export type SiprecStatus = "in-progress" | "stopped"; export type SiprecTrack = "inbound_track" | "outbound_track" | "both_tracks"; export type SiprecUpdateStatus = "stopped"; /** * Options to pass to update a SiprecInstance */ export interface SiprecContextUpdateOptions { /** */ status: SiprecUpdateStatus; } /** * Options to pass to create a SiprecInstance */ export interface SiprecListInstanceCreateOptions { /** The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. */ name?: string; /** Unique name used when configuring the connector via Marketplace Add-on. */ connectorName?: string; /** */ track?: SiprecTrack; /** Absolute URL of the status callback. */ statusCallback?: string; /** The http method for the status_callback (one of GET, POST). */ statusCallbackMethod?: string; /** Parameter name */ "parameter1.name"?: string; /** Parameter value */ "parameter1.value"?: string; /** Parameter name */ "parameter2.name"?: string; /** Parameter value */ "parameter2.value"?: string; /** Parameter name */ "parameter3.name"?: string; /** Parameter value */ "parameter3.value"?: string; /** Parameter name */ "parameter4.name"?: string; /** Parameter value */ "parameter4.value"?: string; /** Parameter name */ "parameter5.name"?: string; /** Parameter value */ "parameter5.value"?: string; /** Parameter name */ "parameter6.name"?: string; /** Parameter value */ "parameter6.value"?: string; /** Parameter name */ "parameter7.name"?: string; /** Parameter value */ "parameter7.value"?: string; /** Parameter name */ "parameter8.name"?: string; /** Parameter value */ "parameter8.value"?: string; /** Parameter name */ "parameter9.name"?: string; /** Parameter value */ "parameter9.value"?: string; /** Parameter name */ "parameter10.name"?: string; /** Parameter value */ "parameter10.value"?: string; /** Parameter name */ "parameter11.name"?: string; /** Parameter value */ "parameter11.value"?: string; /** Parameter name */ "parameter12.name"?: string; /** Parameter value */ "parameter12.value"?: string; /** Parameter name */ "parameter13.name"?: string; /** Parameter value */ "parameter13.value"?: string; /** Parameter name */ "parameter14.name"?: string; /** Parameter value */ "parameter14.value"?: string; /** Parameter name */ "parameter15.name"?: string; /** Parameter value */ "parameter15.value"?: string; /** Parameter name */ "parameter16.name"?: string; /** Parameter value */ "parameter16.value"?: string; /** Parameter name */ "parameter17.name"?: string; /** Parameter value */ "parameter17.value"?: string; /** Parameter name */ "parameter18.name"?: string; /** Parameter value */ "parameter18.value"?: string; /** Parameter name */ "parameter19.name"?: string; /** Parameter value */ "parameter19.value"?: string; /** Parameter name */ "parameter20.name"?: string; /** Parameter value */ "parameter20.value"?: string; /** Parameter name */ "parameter21.name"?: string; /** Parameter value */ "parameter21.value"?: string; /** Parameter name */ "parameter22.name"?: string; /** Parameter value */ "parameter22.value"?: string; /** Parameter name */ "parameter23.name"?: string; /** Parameter value */ "parameter23.value"?: string; /** Parameter name */ "parameter24.name"?: string; /** Parameter value */ "parameter24.value"?: string; /** Parameter name */ "parameter25.name"?: string; /** Parameter value */ "parameter25.value"?: string; /** Parameter name */ "parameter26.name"?: string; /** Parameter value */ "parameter26.value"?: string; /** Parameter name */ "parameter27.name"?: string; /** Parameter value */ "parameter27.value"?: string; /** Parameter name */ "parameter28.name"?: string; /** Parameter value */ "parameter28.value"?: string; /** Parameter name */ "parameter29.name"?: string; /** Parameter value */ "parameter29.value"?: string; /** Parameter name */ "parameter30.name"?: string; /** Parameter value */ "parameter30.value"?: string; /** Parameter name */ "parameter31.name"?: string; /** Parameter value */ "parameter31.value"?: string; /** Parameter name */ "parameter32.name"?: string; /** Parameter value */ "parameter32.value"?: string; /** Parameter name */ "parameter33.name"?: string; /** Parameter value */ "parameter33.value"?: string; /** Parameter name */ "parameter34.name"?: string; /** Parameter value */ "parameter34.value"?: string; /** Parameter name */ "parameter35.name"?: string; /** Parameter value */ "parameter35.value"?: string; /** Parameter name */ "parameter36.name"?: string; /** Parameter value */ "parameter36.value"?: string; /** Parameter name */ "parameter37.name"?: string; /** Parameter value */ "parameter37.value"?: string; /** Parameter name */ "parameter38.name"?: string; /** Parameter value */ "parameter38.value"?: string; /** Parameter name */ "parameter39.name"?: string; /** Parameter value */ "parameter39.value"?: string; /** Parameter name */ "parameter40.name"?: string; /** Parameter value */ "parameter40.value"?: string; /** Parameter name */ "parameter41.name"?: string; /** Parameter value */ "parameter41.value"?: string; /** Parameter name */ "parameter42.name"?: string; /** Parameter value */ "parameter42.value"?: string; /** Parameter name */ "parameter43.name"?: string; /** Parameter value */ "parameter43.value"?: string; /** Parameter name */ "parameter44.name"?: string; /** Parameter value */ "parameter44.value"?: string; /** Parameter name */ "parameter45.name"?: string; /** Parameter value */ "parameter45.value"?: string; /** Parameter name */ "parameter46.name"?: string; /** Parameter value */ "parameter46.value"?: string; /** Parameter name */ "parameter47.name"?: string; /** Parameter value */ "parameter47.value"?: string; /** Parameter name */ "parameter48.name"?: string; /** Parameter value */ "parameter48.value"?: string; /** Parameter name */ "parameter49.name"?: string; /** Parameter value */ "parameter49.value"?: string; /** Parameter name */ "parameter50.name"?: string; /** Parameter value */ "parameter50.value"?: string; /** Parameter name */ "parameter51.name"?: string; /** Parameter value */ "parameter51.value"?: string; /** Parameter name */ "parameter52.name"?: string; /** Parameter value */ "parameter52.value"?: string; /** Parameter name */ "parameter53.name"?: string; /** Parameter value */ "parameter53.value"?: string; /** Parameter name */ "parameter54.name"?: string; /** Parameter value */ "parameter54.value"?: string; /** Parameter name */ "parameter55.name"?: string; /** Parameter value */ "parameter55.value"?: string; /** Parameter name */ "parameter56.name"?: string; /** Parameter value */ "parameter56.value"?: string; /** Parameter name */ "parameter57.name"?: string; /** Parameter value */ "parameter57.value"?: string; /** Parameter name */ "parameter58.name"?: string; /** Parameter value */ "parameter58.value"?: string; /** Parameter name */ "parameter59.name"?: string; /** Parameter value */ "parameter59.value"?: string; /** Parameter name */ "parameter60.name"?: string; /** Parameter value */ "parameter60.value"?: string; /** Parameter name */ "parameter61.name"?: string; /** Parameter value */ "parameter61.value"?: string; /** Parameter name */ "parameter62.name"?: string; /** Parameter value */ "parameter62.value"?: string; /** Parameter name */ "parameter63.name"?: string; /** Parameter value */ "parameter63.value"?: string; /** Parameter name */ "parameter64.name"?: string; /** Parameter value */ "parameter64.value"?: string; /** Parameter name */ "parameter65.name"?: string; /** Parameter value */ "parameter65.value"?: string; /** Parameter name */ "parameter66.name"?: string; /** Parameter value */ "parameter66.value"?: string; /** Parameter name */ "parameter67.name"?: string; /** Parameter value */ "parameter67.value"?: string; /** Parameter name */ "parameter68.name"?: string; /** Parameter value */ "parameter68.value"?: string; /** Parameter name */ "parameter69.name"?: string; /** Parameter value */ "parameter69.value"?: string; /** Parameter name */ "parameter70.name"?: string; /** Parameter value */ "parameter70.value"?: string; /** Parameter name */ "parameter71.name"?: string; /** Parameter value */ "parameter71.value"?: string; /** Parameter name */ "parameter72.name"?: string; /** Parameter value */ "parameter72.value"?: string; /** Parameter name */ "parameter73.name"?: string; /** Parameter value */ "parameter73.value"?: string; /** Parameter name */ "parameter74.name"?: string; /** Parameter value */ "parameter74.value"?: string; /** Parameter name */ "parameter75.name"?: string; /** Parameter value */ "parameter75.value"?: string; /** Parameter name */ "parameter76.name"?: string; /** Parameter value */ "parameter76.value"?: string; /** Parameter name */ "parameter77.name"?: string; /** Parameter value */ "parameter77.value"?: string; /** Parameter name */ "parameter78.name"?: string; /** Parameter value */ "parameter78.value"?: string; /** Parameter name */ "parameter79.name"?: string; /** Parameter value */ "parameter79.value"?: string; /** Parameter name */ "parameter80.name"?: string; /** Parameter value */ "parameter80.value"?: string; /** Parameter name */ "parameter81.name"?: string; /** Parameter value */ "parameter81.value"?: string; /** Parameter name */ "parameter82.name"?: string; /** Parameter value */ "parameter82.value"?: string; /** Parameter name */ "parameter83.name"?: string; /** Parameter value */ "parameter83.value"?: string; /** Parameter name */ "parameter84.name"?: string; /** Parameter value */ "parameter84.value"?: string; /** Parameter name */ "parameter85.name"?: string; /** Parameter value */ "parameter85.value"?: string; /** Parameter name */ "parameter86.name"?: string; /** Parameter value */ "parameter86.value"?: string; /** Parameter name */ "parameter87.name"?: string; /** Parameter value */ "parameter87.value"?: string; /** Parameter name */ "parameter88.name"?: string; /** Parameter value */ "parameter88.value"?: string; /** Parameter name */ "parameter89.name"?: string; /** Parameter value */ "parameter89.value"?: string; /** Parameter name */ "parameter90.name"?: string; /** Parameter value */ "parameter90.value"?: string; /** Parameter name */ "parameter91.name"?: string; /** Parameter value */ "parameter91.value"?: string; /** Parameter name */ "parameter92.name"?: string; /** Parameter value */ "parameter92.value"?: string; /** Parameter name */ "parameter93.name"?: string; /** Parameter value */ "parameter93.value"?: string; /** Parameter name */ "parameter94.name"?: string; /** Parameter value */ "parameter94.value"?: string; /** Parameter name */ "parameter95.name"?: string; /** Parameter value */ "parameter95.value"?: string; /** Parameter name */ "parameter96.name"?: string; /** Parameter value */ "parameter96.value"?: string; /** Parameter name */ "parameter97.name"?: string; /** Parameter value */ "parameter97.value"?: string; /** Parameter name */ "parameter98.name"?: string; /** Parameter value */ "parameter98.value"?: string; /** Parameter name */ "parameter99.name"?: string; /** Parameter value */ "parameter99.value"?: string; } export interface SiprecContext { /** * Update a SiprecInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SiprecInstance */ update(params: SiprecContextUpdateOptions, callback?: (error: Error | null, item?: SiprecInstance) => any): Promise<SiprecInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SiprecContextSolution { accountSid: string; callSid: string; sid: string; } export declare class SiprecContextImpl implements SiprecContext { protected _version: V2010; protected _solution: SiprecContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, callSid: string, sid: string); update(params: SiprecContextUpdateOptions, callback?: (error: Error | null, item?: SiprecInstance) => any): Promise<SiprecInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SiprecContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SiprecResource { sid: string; account_sid: string; call_sid: string; name: string; status: SiprecStatus; date_updated: Date; uri: string; } export declare class SiprecInstance { protected _version: V2010; protected _solution: SiprecContextSolution; protected _context?: SiprecContext; constructor(_version: V2010, payload: SiprecResource, accountSid: string, callSid: string, sid?: string); /** * The SID of the Siprec resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Siprec resource. */ accountSid: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Siprec resource is associated with. */ callSid: string; /** * The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. */ name: string; status: SiprecStatus; /** * The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Update a SiprecInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SiprecInstance */ update(params: SiprecContextUpdateOptions, callback?: (error: Error | null, item?: SiprecInstance) => any): Promise<SiprecInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; callSid: string; name: string; status: SiprecStatus; dateUpdated: Date; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SiprecSolution { accountSid: string; callSid: string; } export interface SiprecListInstance { _version: V2010; _solution: SiprecSolution; _uri: string; (sid: string): SiprecContext; get(sid: string): SiprecContext; /** * Create a SiprecInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SiprecInstance */ create(callback?: (error: Error | null, item?: SiprecInstance) => any): Promise<SiprecInstance>; /** * Create a SiprecInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SiprecInstance */ create(params: SiprecListInstanceCreateOptions, callback?: (error: Error | null, item?: SiprecInstance) => any): Promise<SiprecInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SiprecListInstance(version: V2010, accountSid: string, callSid: string): SiprecListInstance; export {}; rest/api/v2010/account/call/siprec.js000064400000074057151677225100013257 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.SiprecListInstance = exports.SiprecInstance = exports.SiprecContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class SiprecContextImpl { constructor(_version, accountSid, callSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, callSid, sid }; this._uri = `/Accounts/${accountSid}/Calls/${callSid}/Siprec/${sid}.json`; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SiprecInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid, 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.SiprecContextImpl = SiprecContextImpl; class SiprecInstance { constructor(_version, payload, accountSid, callSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.callSid = payload.call_sid; this.name = payload.name; this.status = payload.status; this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.uri = payload.uri; this._solution = { accountSid, callSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SiprecContextImpl(this._version, this._solution.accountSid, this._solution.callSid, this._solution.sid); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, callSid: this.callSid, name: this.name, status: this.status, dateUpdated: this.dateUpdated, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SiprecInstance = SiprecInstance; function SiprecListInstance(version, accountSid, callSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SiprecContextImpl(version, accountSid, callSid, sid); }; instance._version = version; instance._solution = { accountSid, callSid }; instance._uri = `/Accounts/${accountSid}/Calls/${callSid}/Siprec.json`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["name"] !== undefined) data["Name"] = params["name"]; if (params["connectorName"] !== undefined) data["ConnectorName"] = params["connectorName"]; if (params["track"] !== undefined) data["Track"] = params["track"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["parameter1.name"] !== undefined) data["Parameter1.Name"] = params["parameter1.name"]; if (params["parameter1.value"] !== undefined) data["Parameter1.Value"] = params["parameter1.value"]; if (params["parameter2.name"] !== undefined) data["Parameter2.Name"] = params["parameter2.name"]; if (params["parameter2.value"] !== undefined) data["Parameter2.Value"] = params["parameter2.value"]; if (params["parameter3.name"] !== undefined) data["Parameter3.Name"] = params["parameter3.name"]; if (params["parameter3.value"] !== undefined) data["Parameter3.Value"] = params["parameter3.value"]; if (params["parameter4.name"] !== undefined) data["Parameter4.Name"] = params["parameter4.name"]; if (params["parameter4.value"] !== undefined) data["Parameter4.Value"] = params["parameter4.value"]; if (params["parameter5.name"] !== undefined) data["Parameter5.Name"] = params["parameter5.name"]; if (params["parameter5.value"] !== undefined) data["Parameter5.Value"] = params["parameter5.value"]; if (params["parameter6.name"] !== undefined) data["Parameter6.Name"] = params["parameter6.name"]; if (params["parameter6.value"] !== undefined) data["Parameter6.Value"] = params["parameter6.value"]; if (params["parameter7.name"] !== undefined) data["Parameter7.Name"] = params["parameter7.name"]; if (params["parameter7.value"] !== undefined) data["Parameter7.Value"] = params["parameter7.value"]; if (params["parameter8.name"] !== undefined) data["Parameter8.Name"] = params["parameter8.name"]; if (params["parameter8.value"] !== undefined) data["Parameter8.Value"] = params["parameter8.value"]; if (params["parameter9.name"] !== undefined) data["Parameter9.Name"] = params["parameter9.name"]; if (params["parameter9.value"] !== undefined) data["Parameter9.Value"] = params["parameter9.value"]; if (params["parameter10.name"] !== undefined) data["Parameter10.Name"] = params["parameter10.name"]; if (params["parameter10.value"] !== undefined) data["Parameter10.Value"] = params["parameter10.value"]; if (params["parameter11.name"] !== undefined) data["Parameter11.Name"] = params["parameter11.name"]; if (params["parameter11.value"] !== undefined) data["Parameter11.Value"] = params["parameter11.value"]; if (params["parameter12.name"] !== undefined) data["Parameter12.Name"] = params["parameter12.name"]; if (params["parameter12.value"] !== undefined) data["Parameter12.Value"] = params["parameter12.value"]; if (params["parameter13.name"] !== undefined) data["Parameter13.Name"] = params["parameter13.name"]; if (params["parameter13.value"] !== undefined) data["Parameter13.Value"] = params["parameter13.value"]; if (params["parameter14.name"] !== undefined) data["Parameter14.Name"] = params["parameter14.name"]; if (params["parameter14.value"] !== undefined) data["Parameter14.Value"] = params["parameter14.value"]; if (params["parameter15.name"] !== undefined) data["Parameter15.Name"] = params["parameter15.name"]; if (params["parameter15.value"] !== undefined) data["Parameter15.Value"] = params["parameter15.value"]; if (params["parameter16.name"] !== undefined) data["Parameter16.Name"] = params["parameter16.name"]; if (params["parameter16.value"] !== undefined) data["Parameter16.Value"] = params["parameter16.value"]; if (params["parameter17.name"] !== undefined) data["Parameter17.Name"] = params["parameter17.name"]; if (params["parameter17.value"] !== undefined) data["Parameter17.Value"] = params["parameter17.value"]; if (params["parameter18.name"] !== undefined) data["Parameter18.Name"] = params["parameter18.name"]; if (params["parameter18.value"] !== undefined) data["Parameter18.Value"] = params["parameter18.value"]; if (params["parameter19.name"] !== undefined) data["Parameter19.Name"] = params["parameter19.name"]; if (params["parameter19.value"] !== undefined) data["Parameter19.Value"] = params["parameter19.value"]; if (params["parameter20.name"] !== undefined) data["Parameter20.Name"] = params["parameter20.name"]; if (params["parameter20.value"] !== undefined) data["Parameter20.Value"] = params["parameter20.value"]; if (params["parameter21.name"] !== undefined) data["Parameter21.Name"] = params["parameter21.name"]; if (params["parameter21.value"] !== undefined) data["Parameter21.Value"] = params["parameter21.value"]; if (params["parameter22.name"] !== undefined) data["Parameter22.Name"] = params["parameter22.name"]; if (params["parameter22.value"] !== undefined) data["Parameter22.Value"] = params["parameter22.value"]; if (params["parameter23.name"] !== undefined) data["Parameter23.Name"] = params["parameter23.name"]; if (params["parameter23.value"] !== undefined) data["Parameter23.Value"] = params["parameter23.value"]; if (params["parameter24.name"] !== undefined) data["Parameter24.Name"] = params["parameter24.name"]; if (params["parameter24.value"] !== undefined) data["Parameter24.Value"] = params["parameter24.value"]; if (params["parameter25.name"] !== undefined) data["Parameter25.Name"] = params["parameter25.name"]; if (params["parameter25.value"] !== undefined) data["Parameter25.Value"] = params["parameter25.value"]; if (params["parameter26.name"] !== undefined) data["Parameter26.Name"] = params["parameter26.name"]; if (params["parameter26.value"] !== undefined) data["Parameter26.Value"] = params["parameter26.value"]; if (params["parameter27.name"] !== undefined) data["Parameter27.Name"] = params["parameter27.name"]; if (params["parameter27.value"] !== undefined) data["Parameter27.Value"] = params["parameter27.value"]; if (params["parameter28.name"] !== undefined) data["Parameter28.Name"] = params["parameter28.name"]; if (params["parameter28.value"] !== undefined) data["Parameter28.Value"] = params["parameter28.value"]; if (params["parameter29.name"] !== undefined) data["Parameter29.Name"] = params["parameter29.name"]; if (params["parameter29.value"] !== undefined) data["Parameter29.Value"] = params["parameter29.value"]; if (params["parameter30.name"] !== undefined) data["Parameter30.Name"] = params["parameter30.name"]; if (params["parameter30.value"] !== undefined) data["Parameter30.Value"] = params["parameter30.value"]; if (params["parameter31.name"] !== undefined) data["Parameter31.Name"] = params["parameter31.name"]; if (params["parameter31.value"] !== undefined) data["Parameter31.Value"] = params["parameter31.value"]; if (params["parameter32.name"] !== undefined) data["Parameter32.Name"] = params["parameter32.name"]; if (params["parameter32.value"] !== undefined) data["Parameter32.Value"] = params["parameter32.value"]; if (params["parameter33.name"] !== undefined) data["Parameter33.Name"] = params["parameter33.name"]; if (params["parameter33.value"] !== undefined) data["Parameter33.Value"] = params["parameter33.value"]; if (params["parameter34.name"] !== undefined) data["Parameter34.Name"] = params["parameter34.name"]; if (params["parameter34.value"] !== undefined) data["Parameter34.Value"] = params["parameter34.value"]; if (params["parameter35.name"] !== undefined) data["Parameter35.Name"] = params["parameter35.name"]; if (params["parameter35.value"] !== undefined) data["Parameter35.Value"] = params["parameter35.value"]; if (params["parameter36.name"] !== undefined) data["Parameter36.Name"] = params["parameter36.name"]; if (params["parameter36.value"] !== undefined) data["Parameter36.Value"] = params["parameter36.value"]; if (params["parameter37.name"] !== undefined) data["Parameter37.Name"] = params["parameter37.name"]; if (params["parameter37.value"] !== undefined) data["Parameter37.Value"] = params["parameter37.value"]; if (params["parameter38.name"] !== undefined) data["Parameter38.Name"] = params["parameter38.name"]; if (params["parameter38.value"] !== undefined) data["Parameter38.Value"] = params["parameter38.value"]; if (params["parameter39.name"] !== undefined) data["Parameter39.Name"] = params["parameter39.name"]; if (params["parameter39.value"] !== undefined) data["Parameter39.Value"] = params["parameter39.value"]; if (params["parameter40.name"] !== undefined) data["Parameter40.Name"] = params["parameter40.name"]; if (params["parameter40.value"] !== undefined) data["Parameter40.Value"] = params["parameter40.value"]; if (params["parameter41.name"] !== undefined) data["Parameter41.Name"] = params["parameter41.name"]; if (params["parameter41.value"] !== undefined) data["Parameter41.Value"] = params["parameter41.value"]; if (params["parameter42.name"] !== undefined) data["Parameter42.Name"] = params["parameter42.name"]; if (params["parameter42.value"] !== undefined) data["Parameter42.Value"] = params["parameter42.value"]; if (params["parameter43.name"] !== undefined) data["Parameter43.Name"] = params["parameter43.name"]; if (params["parameter43.value"] !== undefined) data["Parameter43.Value"] = params["parameter43.value"]; if (params["parameter44.name"] !== undefined) data["Parameter44.Name"] = params["parameter44.name"]; if (params["parameter44.value"] !== undefined) data["Parameter44.Value"] = params["parameter44.value"]; if (params["parameter45.name"] !== undefined) data["Parameter45.Name"] = params["parameter45.name"]; if (params["parameter45.value"] !== undefined) data["Parameter45.Value"] = params["parameter45.value"]; if (params["parameter46.name"] !== undefined) data["Parameter46.Name"] = params["parameter46.name"]; if (params["parameter46.value"] !== undefined) data["Parameter46.Value"] = params["parameter46.value"]; if (params["parameter47.name"] !== undefined) data["Parameter47.Name"] = params["parameter47.name"]; if (params["parameter47.value"] !== undefined) data["Parameter47.Value"] = params["parameter47.value"]; if (params["parameter48.name"] !== undefined) data["Parameter48.Name"] = params["parameter48.name"]; if (params["parameter48.value"] !== undefined) data["Parameter48.Value"] = params["parameter48.value"]; if (params["parameter49.name"] !== undefined) data["Parameter49.Name"] = params["parameter49.name"]; if (params["parameter49.value"] !== undefined) data["Parameter49.Value"] = params["parameter49.value"]; if (params["parameter50.name"] !== undefined) data["Parameter50.Name"] = params["parameter50.name"]; if (params["parameter50.value"] !== undefined) data["Parameter50.Value"] = params["parameter50.value"]; if (params["parameter51.name"] !== undefined) data["Parameter51.Name"] = params["parameter51.name"]; if (params["parameter51.value"] !== undefined) data["Parameter51.Value"] = params["parameter51.value"]; if (params["parameter52.name"] !== undefined) data["Parameter52.Name"] = params["parameter52.name"]; if (params["parameter52.value"] !== undefined) data["Parameter52.Value"] = params["parameter52.value"]; if (params["parameter53.name"] !== undefined) data["Parameter53.Name"] = params["parameter53.name"]; if (params["parameter53.value"] !== undefined) data["Parameter53.Value"] = params["parameter53.value"]; if (params["parameter54.name"] !== undefined) data["Parameter54.Name"] = params["parameter54.name"]; if (params["parameter54.value"] !== undefined) data["Parameter54.Value"] = params["parameter54.value"]; if (params["parameter55.name"] !== undefined) data["Parameter55.Name"] = params["parameter55.name"]; if (params["parameter55.value"] !== undefined) data["Parameter55.Value"] = params["parameter55.value"]; if (params["parameter56.name"] !== undefined) data["Parameter56.Name"] = params["parameter56.name"]; if (params["parameter56.value"] !== undefined) data["Parameter56.Value"] = params["parameter56.value"]; if (params["parameter57.name"] !== undefined) data["Parameter57.Name"] = params["parameter57.name"]; if (params["parameter57.value"] !== undefined) data["Parameter57.Value"] = params["parameter57.value"]; if (params["parameter58.name"] !== undefined) data["Parameter58.Name"] = params["parameter58.name"]; if (params["parameter58.value"] !== undefined) data["Parameter58.Value"] = params["parameter58.value"]; if (params["parameter59.name"] !== undefined) data["Parameter59.Name"] = params["parameter59.name"]; if (params["parameter59.value"] !== undefined) data["Parameter59.Value"] = params["parameter59.value"]; if (params["parameter60.name"] !== undefined) data["Parameter60.Name"] = params["parameter60.name"]; if (params["parameter60.value"] !== undefined) data["Parameter60.Value"] = params["parameter60.value"]; if (params["parameter61.name"] !== undefined) data["Parameter61.Name"] = params["parameter61.name"]; if (params["parameter61.value"] !== undefined) data["Parameter61.Value"] = params["parameter61.value"]; if (params["parameter62.name"] !== undefined) data["Parameter62.Name"] = params["parameter62.name"]; if (params["parameter62.value"] !== undefined) data["Parameter62.Value"] = params["parameter62.value"]; if (params["parameter63.name"] !== undefined) data["Parameter63.Name"] = params["parameter63.name"]; if (params["parameter63.value"] !== undefined) data["Parameter63.Value"] = params["parameter63.value"]; if (params["parameter64.name"] !== undefined) data["Parameter64.Name"] = params["parameter64.name"]; if (params["parameter64.value"] !== undefined) data["Parameter64.Value"] = params["parameter64.value"]; if (params["parameter65.name"] !== undefined) data["Parameter65.Name"] = params["parameter65.name"]; if (params["parameter65.value"] !== undefined) data["Parameter65.Value"] = params["parameter65.value"]; if (params["parameter66.name"] !== undefined) data["Parameter66.Name"] = params["parameter66.name"]; if (params["parameter66.value"] !== undefined) data["Parameter66.Value"] = params["parameter66.value"]; if (params["parameter67.name"] !== undefined) data["Parameter67.Name"] = params["parameter67.name"]; if (params["parameter67.value"] !== undefined) data["Parameter67.Value"] = params["parameter67.value"]; if (params["parameter68.name"] !== undefined) data["Parameter68.Name"] = params["parameter68.name"]; if (params["parameter68.value"] !== undefined) data["Parameter68.Value"] = params["parameter68.value"]; if (params["parameter69.name"] !== undefined) data["Parameter69.Name"] = params["parameter69.name"]; if (params["parameter69.value"] !== undefined) data["Parameter69.Value"] = params["parameter69.value"]; if (params["parameter70.name"] !== undefined) data["Parameter70.Name"] = params["parameter70.name"]; if (params["parameter70.value"] !== undefined) data["Parameter70.Value"] = params["parameter70.value"]; if (params["parameter71.name"] !== undefined) data["Parameter71.Name"] = params["parameter71.name"]; if (params["parameter71.value"] !== undefined) data["Parameter71.Value"] = params["parameter71.value"]; if (params["parameter72.name"] !== undefined) data["Parameter72.Name"] = params["parameter72.name"]; if (params["parameter72.value"] !== undefined) data["Parameter72.Value"] = params["parameter72.value"]; if (params["parameter73.name"] !== undefined) data["Parameter73.Name"] = params["parameter73.name"]; if (params["parameter73.value"] !== undefined) data["Parameter73.Value"] = params["parameter73.value"]; if (params["parameter74.name"] !== undefined) data["Parameter74.Name"] = params["parameter74.name"]; if (params["parameter74.value"] !== undefined) data["Parameter74.Value"] = params["parameter74.value"]; if (params["parameter75.name"] !== undefined) data["Parameter75.Name"] = params["parameter75.name"]; if (params["parameter75.value"] !== undefined) data["Parameter75.Value"] = params["parameter75.value"]; if (params["parameter76.name"] !== undefined) data["Parameter76.Name"] = params["parameter76.name"]; if (params["parameter76.value"] !== undefined) data["Parameter76.Value"] = params["parameter76.value"]; if (params["parameter77.name"] !== undefined) data["Parameter77.Name"] = params["parameter77.name"]; if (params["parameter77.value"] !== undefined) data["Parameter77.Value"] = params["parameter77.value"]; if (params["parameter78.name"] !== undefined) data["Parameter78.Name"] = params["parameter78.name"]; if (params["parameter78.value"] !== undefined) data["Parameter78.Value"] = params["parameter78.value"]; if (params["parameter79.name"] !== undefined) data["Parameter79.Name"] = params["parameter79.name"]; if (params["parameter79.value"] !== undefined) data["Parameter79.Value"] = params["parameter79.value"]; if (params["parameter80.name"] !== undefined) data["Parameter80.Name"] = params["parameter80.name"]; if (params["parameter80.value"] !== undefined) data["Parameter80.Value"] = params["parameter80.value"]; if (params["parameter81.name"] !== undefined) data["Parameter81.Name"] = params["parameter81.name"]; if (params["parameter81.value"] !== undefined) data["Parameter81.Value"] = params["parameter81.value"]; if (params["parameter82.name"] !== undefined) data["Parameter82.Name"] = params["parameter82.name"]; if (params["parameter82.value"] !== undefined) data["Parameter82.Value"] = params["parameter82.value"]; if (params["parameter83.name"] !== undefined) data["Parameter83.Name"] = params["parameter83.name"]; if (params["parameter83.value"] !== undefined) data["Parameter83.Value"] = params["parameter83.value"]; if (params["parameter84.name"] !== undefined) data["Parameter84.Name"] = params["parameter84.name"]; if (params["parameter84.value"] !== undefined) data["Parameter84.Value"] = params["parameter84.value"]; if (params["parameter85.name"] !== undefined) data["Parameter85.Name"] = params["parameter85.name"]; if (params["parameter85.value"] !== undefined) data["Parameter85.Value"] = params["parameter85.value"]; if (params["parameter86.name"] !== undefined) data["Parameter86.Name"] = params["parameter86.name"]; if (params["parameter86.value"] !== undefined) data["Parameter86.Value"] = params["parameter86.value"]; if (params["parameter87.name"] !== undefined) data["Parameter87.Name"] = params["parameter87.name"]; if (params["parameter87.value"] !== undefined) data["Parameter87.Value"] = params["parameter87.value"]; if (params["parameter88.name"] !== undefined) data["Parameter88.Name"] = params["parameter88.name"]; if (params["parameter88.value"] !== undefined) data["Parameter88.Value"] = params["parameter88.value"]; if (params["parameter89.name"] !== undefined) data["Parameter89.Name"] = params["parameter89.name"]; if (params["parameter89.value"] !== undefined) data["Parameter89.Value"] = params["parameter89.value"]; if (params["parameter90.name"] !== undefined) data["Parameter90.Name"] = params["parameter90.name"]; if (params["parameter90.value"] !== undefined) data["Parameter90.Value"] = params["parameter90.value"]; if (params["parameter91.name"] !== undefined) data["Parameter91.Name"] = params["parameter91.name"]; if (params["parameter91.value"] !== undefined) data["Parameter91.Value"] = params["parameter91.value"]; if (params["parameter92.name"] !== undefined) data["Parameter92.Name"] = params["parameter92.name"]; if (params["parameter92.value"] !== undefined) data["Parameter92.Value"] = params["parameter92.value"]; if (params["parameter93.name"] !== undefined) data["Parameter93.Name"] = params["parameter93.name"]; if (params["parameter93.value"] !== undefined) data["Parameter93.Value"] = params["parameter93.value"]; if (params["parameter94.name"] !== undefined) data["Parameter94.Name"] = params["parameter94.name"]; if (params["parameter94.value"] !== undefined) data["Parameter94.Value"] = params["parameter94.value"]; if (params["parameter95.name"] !== undefined) data["Parameter95.Name"] = params["parameter95.name"]; if (params["parameter95.value"] !== undefined) data["Parameter95.Value"] = params["parameter95.value"]; if (params["parameter96.name"] !== undefined) data["Parameter96.Name"] = params["parameter96.name"]; if (params["parameter96.value"] !== undefined) data["Parameter96.Value"] = params["parameter96.value"]; if (params["parameter97.name"] !== undefined) data["Parameter97.Name"] = params["parameter97.name"]; if (params["parameter97.value"] !== undefined) data["Parameter97.Value"] = params["parameter97.value"]; if (params["parameter98.name"] !== undefined) data["Parameter98.Name"] = params["parameter98.name"]; if (params["parameter98.value"] !== undefined) data["Parameter98.Value"] = params["parameter98.value"]; if (params["parameter99.name"] !== undefined) data["Parameter99.Name"] = params["parameter99.name"]; if (params["parameter99.value"] !== undefined) data["Parameter99.Value"] = params["parameter99.value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SiprecInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid)); 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; } exports.SiprecListInstance = SiprecListInstance; rest/api/v2010/account/call/notification.js000064400000021503151677225100014444 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.NotificationPage = exports.NotificationListInstance = exports.NotificationInstance = exports.NotificationContextImpl = void 0; 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 NotificationContextImpl { constructor(_version, accountSid, callSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, callSid, sid }; this._uri = `/Accounts/${accountSid}/Calls/${callSid}/Notifications/${sid}.json`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new NotificationInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid, 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.NotificationContextImpl = NotificationContextImpl; class NotificationInstance { constructor(_version, payload, accountSid, callSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.callSid = payload.call_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.errorCode = payload.error_code; this.log = payload.log; this.messageDate = deserialize.rfc2822DateTime(payload.message_date); this.messageText = payload.message_text; this.moreInfo = payload.more_info; this.requestMethod = payload.request_method; this.requestUrl = payload.request_url; this.requestVariables = payload.request_variables; this.responseBody = payload.response_body; this.responseHeaders = payload.response_headers; this.sid = payload.sid; this.uri = payload.uri; this._solution = { accountSid, callSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new NotificationContextImpl(this._version, this._solution.accountSid, this._solution.callSid, this._solution.sid); return this._context; } /** * Fetch a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, callSid: this.callSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, errorCode: this.errorCode, log: this.log, messageDate: this.messageDate, messageText: this.messageText, moreInfo: this.moreInfo, requestMethod: this.requestMethod, requestUrl: this.requestUrl, requestVariables: this.requestVariables, responseBody: this.responseBody, responseHeaders: this.responseHeaders, sid: this.sid, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NotificationInstance = NotificationInstance; function NotificationListInstance(version, accountSid, callSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new NotificationContextImpl(version, accountSid, callSid, sid); }; instance._version = version; instance._solution = { accountSid, callSid }; instance._uri = `/Accounts/${accountSid}/Calls/${callSid}/Notifications.json`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["log"] !== undefined) data["Log"] = params["log"]; if (params["messageDate"] !== undefined) data["MessageDate"] = serialize.iso8601Date(params["messageDate"]); if (params["messageDateBefore"] !== undefined) data["MessageDate<"] = serialize.iso8601Date(params["messageDateBefore"]); if (params["messageDateAfter"] !== undefined) data["MessageDate>"] = serialize.iso8601Date(params["messageDateAfter"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new NotificationPage(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 NotificationPage(instance._version, payload, 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; } exports.NotificationListInstance = NotificationListInstance; class NotificationPage extends Page_1.default { /** * Initialize the NotificationPage * * @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 NotificationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new NotificationInstance(this._version, payload, this._solution.accountSid, this._solution.callSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NotificationPage = NotificationPage; rest/api/v2010/account/call/userDefinedMessageSubscription.d.ts000064400000012025151677225100020360 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../../V2010"; /** * Options to pass to create a UserDefinedMessageSubscriptionInstance */ export interface UserDefinedMessageSubscriptionListInstanceCreateOptions { /** The URL we should call using the `method` to send user defined events to your application. URLs must contain a valid hostname (underscores are not permitted). */ callback: string; /** A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated. */ idempotencyKey?: string; /** The HTTP method Twilio will use when requesting the above `Url`. Either `GET` or `POST`. Default is `POST`. */ method?: string; } export interface UserDefinedMessageSubscriptionContext { /** * Remove a UserDefinedMessageSubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserDefinedMessageSubscriptionContextSolution { accountSid: string; callSid: string; sid: string; } export declare class UserDefinedMessageSubscriptionContextImpl implements UserDefinedMessageSubscriptionContext { protected _version: V2010; protected _solution: UserDefinedMessageSubscriptionContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, callSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserDefinedMessageSubscriptionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserDefinedMessageSubscriptionResource { account_sid: string; call_sid: string; sid: string; date_created: Date; uri: string; } export declare class UserDefinedMessageSubscriptionInstance { protected _version: V2010; protected _solution: UserDefinedMessageSubscriptionContextSolution; protected _context?: UserDefinedMessageSubscriptionContext; constructor(_version: V2010, payload: UserDefinedMessageSubscriptionResource, accountSid: string, callSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. */ accountSid: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message Subscription is associated with. This refers to the Call SID that is producing the User Defined Messages. */ callSid: string; /** * The SID that uniquely identifies this User Defined Message Subscription. */ sid: string; /** * The date that this User Defined Message Subscription was created, given in RFC 2822 format. */ dateCreated: Date; /** * The URI of the User Defined Message Subscription Resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Remove a UserDefinedMessageSubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; callSid: string; sid: string; dateCreated: Date; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserDefinedMessageSubscriptionSolution { accountSid: string; callSid: string; } export interface UserDefinedMessageSubscriptionListInstance { _version: V2010; _solution: UserDefinedMessageSubscriptionSolution; _uri: string; (sid: string): UserDefinedMessageSubscriptionContext; get(sid: string): UserDefinedMessageSubscriptionContext; /** * Create a UserDefinedMessageSubscriptionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserDefinedMessageSubscriptionInstance */ create(params: UserDefinedMessageSubscriptionListInstanceCreateOptions, callback?: (error: Error | null, item?: UserDefinedMessageSubscriptionInstance) => any): Promise<UserDefinedMessageSubscriptionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserDefinedMessageSubscriptionListInstance(version: V2010, accountSid: string, callSid: string): UserDefinedMessageSubscriptionListInstance; export {}; rest/api/v2010/account/call/payment.js000064400000020602151677225100013432 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.PaymentListInstance = exports.PaymentInstance = exports.PaymentContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class PaymentContextImpl { constructor(_version, accountSid, callSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, callSid, sid }; this._uri = `/Accounts/${accountSid}/Calls/${callSid}/Payments/${sid}.json`; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["idempotencyKey"] === null || params["idempotencyKey"] === undefined) { throw new Error("Required parameter \"params['idempotencyKey']\" missing."); } if (params["statusCallback"] === null || params["statusCallback"] === undefined) { throw new Error("Required parameter \"params['statusCallback']\" missing."); } let data = {}; data["IdempotencyKey"] = params["idempotencyKey"]; data["StatusCallback"] = params["statusCallback"]; if (params["capture"] !== undefined) data["Capture"] = params["capture"]; if (params["status"] !== undefined) data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PaymentInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid, 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.PaymentContextImpl = PaymentContextImpl; class PaymentInstance { constructor(_version, payload, accountSid, callSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.callSid = payload.call_sid; this.sid = payload.sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.uri = payload.uri; this._solution = { accountSid, callSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PaymentContextImpl(this._version, this._solution.accountSid, this._solution.callSid, this._solution.sid); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, callSid: this.callSid, sid: this.sid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PaymentInstance = PaymentInstance; function PaymentListInstance(version, accountSid, callSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PaymentContextImpl(version, accountSid, callSid, sid); }; instance._version = version; instance._solution = { accountSid, callSid }; instance._uri = `/Accounts/${accountSid}/Calls/${callSid}/Payments.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["idempotencyKey"] === null || params["idempotencyKey"] === undefined) { throw new Error("Required parameter \"params['idempotencyKey']\" missing."); } if (params["statusCallback"] === null || params["statusCallback"] === undefined) { throw new Error("Required parameter \"params['statusCallback']\" missing."); } let data = {}; data["IdempotencyKey"] = params["idempotencyKey"]; data["StatusCallback"] = params["statusCallback"]; if (params["bankAccountType"] !== undefined) data["BankAccountType"] = params["bankAccountType"]; if (params["chargeAmount"] !== undefined) data["ChargeAmount"] = params["chargeAmount"]; if (params["currency"] !== undefined) data["Currency"] = params["currency"]; if (params["description"] !== undefined) data["Description"] = params["description"]; if (params["input"] !== undefined) data["Input"] = params["input"]; if (params["minPostalCodeLength"] !== undefined) data["MinPostalCodeLength"] = params["minPostalCodeLength"]; if (params["parameter"] !== undefined) data["Parameter"] = serialize.object(params["parameter"]); if (params["paymentConnector"] !== undefined) data["PaymentConnector"] = params["paymentConnector"]; if (params["paymentMethod"] !== undefined) data["PaymentMethod"] = params["paymentMethod"]; if (params["postalCode"] !== undefined) data["PostalCode"] = serialize.bool(params["postalCode"]); if (params["securityCode"] !== undefined) data["SecurityCode"] = serialize.bool(params["securityCode"]); if (params["timeout"] !== undefined) data["Timeout"] = params["timeout"]; if (params["tokenType"] !== undefined) data["TokenType"] = params["tokenType"]; if (params["validCardTypes"] !== undefined) data["ValidCardTypes"] = params["validCardTypes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PaymentInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid)); 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; } exports.PaymentListInstance = PaymentListInstance; rest/api/v2010/account/call/event.js000064400000011154151677225100013100 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.EventPage = exports.EventInstance = exports.EventListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function EventListInstance(version, accountSid, callSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid, callSid }; instance._uri = `/Accounts/${accountSid}/Calls/${callSid}/Events.json`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EventPage(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 EventPage(instance._version, payload, 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; } exports.EventListInstance = EventListInstance; class EventInstance { constructor(_version, payload, accountSid, callSid) { this._version = _version; this.request = payload.request; this.response = payload.response; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { request: this.request, response: this.response, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventInstance = EventInstance; class EventPage extends Page_1.default { /** * Initialize the EventPage * * @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 EventInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EventInstance(this._version, payload, this._solution.accountSid, this._solution.callSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventPage = EventPage; rest/api/v2010/account/call/notification.d.ts000064400000034471151677225100014710 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; /** * Options to pass to each */ export interface NotificationListInstanceEachOptions { /** Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. */ log?: number; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDate?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateBefore?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: NotificationInstance, 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 NotificationListInstanceOptions { /** Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. */ log?: number; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDate?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateBefore?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface NotificationListInstancePageOptions { /** Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. */ log?: number; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDate?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateBefore?: Date; /** Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. */ messageDateAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface NotificationContext { /** * Fetch a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ fetch(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface NotificationContextSolution { accountSid: string; callSid: string; sid: string; } export declare class NotificationContextImpl implements NotificationContext { protected _version: V2010; protected _solution: NotificationContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, callSid: string, sid: string); fetch(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): NotificationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface NotificationPayload extends TwilioResponsePayload { notifications: NotificationResource[]; } interface NotificationResource { account_sid: string; api_version: string; call_sid: string; date_created: Date; date_updated: Date; error_code: string; log: string; message_date: Date; message_text: string; more_info: string; request_method: string; request_url: string; request_variables: string; response_body: string; response_headers: string; sid: string; uri: string; } export declare class NotificationInstance { protected _version: V2010; protected _solution: NotificationContextSolution; protected _context?: NotificationContext; constructor(_version: V2010, payload: NotificationResource, accountSid: string, callSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource. */ accountSid: string; /** * The API version used to create the Call Notification resource. */ apiVersion: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Call Notification resource is associated with. */ callSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). */ errorCode: string; /** * An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. */ log: string; /** * The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. */ messageDate: Date; /** * The text of the notification. */ messageText: string; /** * The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). */ moreInfo: string; /** * The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. */ requestMethod: string; /** * The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. */ requestUrl: string; /** * The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. */ requestVariables: string; /** * The HTTP body returned by your server. */ responseBody: string; /** * The HTTP headers returned by your server. */ responseHeaders: string; /** * The unique string that that we created to identify the Call Notification resource. */ sid: string; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Fetch a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ fetch(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; callSid: string; dateCreated: Date; dateUpdated: Date; errorCode: string; log: string; messageDate: Date; messageText: string; moreInfo: string; requestMethod: string; requestUrl: string; requestVariables: string; responseBody: string; responseHeaders: string; sid: string; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface NotificationSolution { accountSid: string; callSid: string; } export interface NotificationListInstance { _version: V2010; _solution: NotificationSolution; _uri: string; (sid: string): NotificationContext; get(sid: string): NotificationContext; /** * Streams NotificationInstance 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 { NotificationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: NotificationInstance, done: (err?: Error) => void) => void): void; each(params: NotificationListInstanceEachOptions, callback?: (item: NotificationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of NotificationInstance 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: NotificationPage) => any): Promise<NotificationPage>; /** * Lists NotificationInstance 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 { NotificationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: NotificationInstance[]) => any): Promise<NotificationInstance[]>; list(params: NotificationListInstanceOptions, callback?: (error: Error | null, items: NotificationInstance[]) => any): Promise<NotificationInstance[]>; /** * Retrieve a single page of NotificationInstance 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 { NotificationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: NotificationPage) => any): Promise<NotificationPage>; page(params: NotificationListInstancePageOptions, callback?: (error: Error | null, items: NotificationPage) => any): Promise<NotificationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NotificationListInstance(version: V2010, accountSid: string, callSid: string): NotificationListInstance; export declare class NotificationPage extends Page<V2010, NotificationPayload, NotificationResource, NotificationInstance> { /** * Initialize the NotificationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: NotificationSolution); /** * Build an instance of NotificationInstance * * @param payload - Payload response from the API */ getInstance(payload: NotificationResource): NotificationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/call/stream.js000064400000074141151677225100013257 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.StreamListInstance = exports.StreamInstance = exports.StreamContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class StreamContextImpl { constructor(_version, accountSid, callSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, callSid, sid }; this._uri = `/Accounts/${accountSid}/Calls/${callSid}/Streams/${sid}.json`; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new StreamInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid, 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.StreamContextImpl = StreamContextImpl; class StreamInstance { constructor(_version, payload, accountSid, callSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.callSid = payload.call_sid; this.name = payload.name; this.status = payload.status; this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.uri = payload.uri; this._solution = { accountSid, callSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new StreamContextImpl(this._version, this._solution.accountSid, this._solution.callSid, this._solution.sid); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, callSid: this.callSid, name: this.name, status: this.status, dateUpdated: this.dateUpdated, uri: this.uri, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.StreamInstance = StreamInstance; function StreamListInstance(version, accountSid, callSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new StreamContextImpl(version, accountSid, callSid, sid); }; instance._version = version; instance._solution = { accountSid, callSid }; instance._uri = `/Accounts/${accountSid}/Calls/${callSid}/Streams.json`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["url"] === null || params["url"] === undefined) { throw new Error("Required parameter \"params['url']\" missing."); } let data = {}; data["Url"] = params["url"]; if (params["name"] !== undefined) data["Name"] = params["name"]; if (params["track"] !== undefined) data["Track"] = params["track"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["parameter1.name"] !== undefined) data["Parameter1.Name"] = params["parameter1.name"]; if (params["parameter1.value"] !== undefined) data["Parameter1.Value"] = params["parameter1.value"]; if (params["parameter2.name"] !== undefined) data["Parameter2.Name"] = params["parameter2.name"]; if (params["parameter2.value"] !== undefined) data["Parameter2.Value"] = params["parameter2.value"]; if (params["parameter3.name"] !== undefined) data["Parameter3.Name"] = params["parameter3.name"]; if (params["parameter3.value"] !== undefined) data["Parameter3.Value"] = params["parameter3.value"]; if (params["parameter4.name"] !== undefined) data["Parameter4.Name"] = params["parameter4.name"]; if (params["parameter4.value"] !== undefined) data["Parameter4.Value"] = params["parameter4.value"]; if (params["parameter5.name"] !== undefined) data["Parameter5.Name"] = params["parameter5.name"]; if (params["parameter5.value"] !== undefined) data["Parameter5.Value"] = params["parameter5.value"]; if (params["parameter6.name"] !== undefined) data["Parameter6.Name"] = params["parameter6.name"]; if (params["parameter6.value"] !== undefined) data["Parameter6.Value"] = params["parameter6.value"]; if (params["parameter7.name"] !== undefined) data["Parameter7.Name"] = params["parameter7.name"]; if (params["parameter7.value"] !== undefined) data["Parameter7.Value"] = params["parameter7.value"]; if (params["parameter8.name"] !== undefined) data["Parameter8.Name"] = params["parameter8.name"]; if (params["parameter8.value"] !== undefined) data["Parameter8.Value"] = params["parameter8.value"]; if (params["parameter9.name"] !== undefined) data["Parameter9.Name"] = params["parameter9.name"]; if (params["parameter9.value"] !== undefined) data["Parameter9.Value"] = params["parameter9.value"]; if (params["parameter10.name"] !== undefined) data["Parameter10.Name"] = params["parameter10.name"]; if (params["parameter10.value"] !== undefined) data["Parameter10.Value"] = params["parameter10.value"]; if (params["parameter11.name"] !== undefined) data["Parameter11.Name"] = params["parameter11.name"]; if (params["parameter11.value"] !== undefined) data["Parameter11.Value"] = params["parameter11.value"]; if (params["parameter12.name"] !== undefined) data["Parameter12.Name"] = params["parameter12.name"]; if (params["parameter12.value"] !== undefined) data["Parameter12.Value"] = params["parameter12.value"]; if (params["parameter13.name"] !== undefined) data["Parameter13.Name"] = params["parameter13.name"]; if (params["parameter13.value"] !== undefined) data["Parameter13.Value"] = params["parameter13.value"]; if (params["parameter14.name"] !== undefined) data["Parameter14.Name"] = params["parameter14.name"]; if (params["parameter14.value"] !== undefined) data["Parameter14.Value"] = params["parameter14.value"]; if (params["parameter15.name"] !== undefined) data["Parameter15.Name"] = params["parameter15.name"]; if (params["parameter15.value"] !== undefined) data["Parameter15.Value"] = params["parameter15.value"]; if (params["parameter16.name"] !== undefined) data["Parameter16.Name"] = params["parameter16.name"]; if (params["parameter16.value"] !== undefined) data["Parameter16.Value"] = params["parameter16.value"]; if (params["parameter17.name"] !== undefined) data["Parameter17.Name"] = params["parameter17.name"]; if (params["parameter17.value"] !== undefined) data["Parameter17.Value"] = params["parameter17.value"]; if (params["parameter18.name"] !== undefined) data["Parameter18.Name"] = params["parameter18.name"]; if (params["parameter18.value"] !== undefined) data["Parameter18.Value"] = params["parameter18.value"]; if (params["parameter19.name"] !== undefined) data["Parameter19.Name"] = params["parameter19.name"]; if (params["parameter19.value"] !== undefined) data["Parameter19.Value"] = params["parameter19.value"]; if (params["parameter20.name"] !== undefined) data["Parameter20.Name"] = params["parameter20.name"]; if (params["parameter20.value"] !== undefined) data["Parameter20.Value"] = params["parameter20.value"]; if (params["parameter21.name"] !== undefined) data["Parameter21.Name"] = params["parameter21.name"]; if (params["parameter21.value"] !== undefined) data["Parameter21.Value"] = params["parameter21.value"]; if (params["parameter22.name"] !== undefined) data["Parameter22.Name"] = params["parameter22.name"]; if (params["parameter22.value"] !== undefined) data["Parameter22.Value"] = params["parameter22.value"]; if (params["parameter23.name"] !== undefined) data["Parameter23.Name"] = params["parameter23.name"]; if (params["parameter23.value"] !== undefined) data["Parameter23.Value"] = params["parameter23.value"]; if (params["parameter24.name"] !== undefined) data["Parameter24.Name"] = params["parameter24.name"]; if (params["parameter24.value"] !== undefined) data["Parameter24.Value"] = params["parameter24.value"]; if (params["parameter25.name"] !== undefined) data["Parameter25.Name"] = params["parameter25.name"]; if (params["parameter25.value"] !== undefined) data["Parameter25.Value"] = params["parameter25.value"]; if (params["parameter26.name"] !== undefined) data["Parameter26.Name"] = params["parameter26.name"]; if (params["parameter26.value"] !== undefined) data["Parameter26.Value"] = params["parameter26.value"]; if (params["parameter27.name"] !== undefined) data["Parameter27.Name"] = params["parameter27.name"]; if (params["parameter27.value"] !== undefined) data["Parameter27.Value"] = params["parameter27.value"]; if (params["parameter28.name"] !== undefined) data["Parameter28.Name"] = params["parameter28.name"]; if (params["parameter28.value"] !== undefined) data["Parameter28.Value"] = params["parameter28.value"]; if (params["parameter29.name"] !== undefined) data["Parameter29.Name"] = params["parameter29.name"]; if (params["parameter29.value"] !== undefined) data["Parameter29.Value"] = params["parameter29.value"]; if (params["parameter30.name"] !== undefined) data["Parameter30.Name"] = params["parameter30.name"]; if (params["parameter30.value"] !== undefined) data["Parameter30.Value"] = params["parameter30.value"]; if (params["parameter31.name"] !== undefined) data["Parameter31.Name"] = params["parameter31.name"]; if (params["parameter31.value"] !== undefined) data["Parameter31.Value"] = params["parameter31.value"]; if (params["parameter32.name"] !== undefined) data["Parameter32.Name"] = params["parameter32.name"]; if (params["parameter32.value"] !== undefined) data["Parameter32.Value"] = params["parameter32.value"]; if (params["parameter33.name"] !== undefined) data["Parameter33.Name"] = params["parameter33.name"]; if (params["parameter33.value"] !== undefined) data["Parameter33.Value"] = params["parameter33.value"]; if (params["parameter34.name"] !== undefined) data["Parameter34.Name"] = params["parameter34.name"]; if (params["parameter34.value"] !== undefined) data["Parameter34.Value"] = params["parameter34.value"]; if (params["parameter35.name"] !== undefined) data["Parameter35.Name"] = params["parameter35.name"]; if (params["parameter35.value"] !== undefined) data["Parameter35.Value"] = params["parameter35.value"]; if (params["parameter36.name"] !== undefined) data["Parameter36.Name"] = params["parameter36.name"]; if (params["parameter36.value"] !== undefined) data["Parameter36.Value"] = params["parameter36.value"]; if (params["parameter37.name"] !== undefined) data["Parameter37.Name"] = params["parameter37.name"]; if (params["parameter37.value"] !== undefined) data["Parameter37.Value"] = params["parameter37.value"]; if (params["parameter38.name"] !== undefined) data["Parameter38.Name"] = params["parameter38.name"]; if (params["parameter38.value"] !== undefined) data["Parameter38.Value"] = params["parameter38.value"]; if (params["parameter39.name"] !== undefined) data["Parameter39.Name"] = params["parameter39.name"]; if (params["parameter39.value"] !== undefined) data["Parameter39.Value"] = params["parameter39.value"]; if (params["parameter40.name"] !== undefined) data["Parameter40.Name"] = params["parameter40.name"]; if (params["parameter40.value"] !== undefined) data["Parameter40.Value"] = params["parameter40.value"]; if (params["parameter41.name"] !== undefined) data["Parameter41.Name"] = params["parameter41.name"]; if (params["parameter41.value"] !== undefined) data["Parameter41.Value"] = params["parameter41.value"]; if (params["parameter42.name"] !== undefined) data["Parameter42.Name"] = params["parameter42.name"]; if (params["parameter42.value"] !== undefined) data["Parameter42.Value"] = params["parameter42.value"]; if (params["parameter43.name"] !== undefined) data["Parameter43.Name"] = params["parameter43.name"]; if (params["parameter43.value"] !== undefined) data["Parameter43.Value"] = params["parameter43.value"]; if (params["parameter44.name"] !== undefined) data["Parameter44.Name"] = params["parameter44.name"]; if (params["parameter44.value"] !== undefined) data["Parameter44.Value"] = params["parameter44.value"]; if (params["parameter45.name"] !== undefined) data["Parameter45.Name"] = params["parameter45.name"]; if (params["parameter45.value"] !== undefined) data["Parameter45.Value"] = params["parameter45.value"]; if (params["parameter46.name"] !== undefined) data["Parameter46.Name"] = params["parameter46.name"]; if (params["parameter46.value"] !== undefined) data["Parameter46.Value"] = params["parameter46.value"]; if (params["parameter47.name"] !== undefined) data["Parameter47.Name"] = params["parameter47.name"]; if (params["parameter47.value"] !== undefined) data["Parameter47.Value"] = params["parameter47.value"]; if (params["parameter48.name"] !== undefined) data["Parameter48.Name"] = params["parameter48.name"]; if (params["parameter48.value"] !== undefined) data["Parameter48.Value"] = params["parameter48.value"]; if (params["parameter49.name"] !== undefined) data["Parameter49.Name"] = params["parameter49.name"]; if (params["parameter49.value"] !== undefined) data["Parameter49.Value"] = params["parameter49.value"]; if (params["parameter50.name"] !== undefined) data["Parameter50.Name"] = params["parameter50.name"]; if (params["parameter50.value"] !== undefined) data["Parameter50.Value"] = params["parameter50.value"]; if (params["parameter51.name"] !== undefined) data["Parameter51.Name"] = params["parameter51.name"]; if (params["parameter51.value"] !== undefined) data["Parameter51.Value"] = params["parameter51.value"]; if (params["parameter52.name"] !== undefined) data["Parameter52.Name"] = params["parameter52.name"]; if (params["parameter52.value"] !== undefined) data["Parameter52.Value"] = params["parameter52.value"]; if (params["parameter53.name"] !== undefined) data["Parameter53.Name"] = params["parameter53.name"]; if (params["parameter53.value"] !== undefined) data["Parameter53.Value"] = params["parameter53.value"]; if (params["parameter54.name"] !== undefined) data["Parameter54.Name"] = params["parameter54.name"]; if (params["parameter54.value"] !== undefined) data["Parameter54.Value"] = params["parameter54.value"]; if (params["parameter55.name"] !== undefined) data["Parameter55.Name"] = params["parameter55.name"]; if (params["parameter55.value"] !== undefined) data["Parameter55.Value"] = params["parameter55.value"]; if (params["parameter56.name"] !== undefined) data["Parameter56.Name"] = params["parameter56.name"]; if (params["parameter56.value"] !== undefined) data["Parameter56.Value"] = params["parameter56.value"]; if (params["parameter57.name"] !== undefined) data["Parameter57.Name"] = params["parameter57.name"]; if (params["parameter57.value"] !== undefined) data["Parameter57.Value"] = params["parameter57.value"]; if (params["parameter58.name"] !== undefined) data["Parameter58.Name"] = params["parameter58.name"]; if (params["parameter58.value"] !== undefined) data["Parameter58.Value"] = params["parameter58.value"]; if (params["parameter59.name"] !== undefined) data["Parameter59.Name"] = params["parameter59.name"]; if (params["parameter59.value"] !== undefined) data["Parameter59.Value"] = params["parameter59.value"]; if (params["parameter60.name"] !== undefined) data["Parameter60.Name"] = params["parameter60.name"]; if (params["parameter60.value"] !== undefined) data["Parameter60.Value"] = params["parameter60.value"]; if (params["parameter61.name"] !== undefined) data["Parameter61.Name"] = params["parameter61.name"]; if (params["parameter61.value"] !== undefined) data["Parameter61.Value"] = params["parameter61.value"]; if (params["parameter62.name"] !== undefined) data["Parameter62.Name"] = params["parameter62.name"]; if (params["parameter62.value"] !== undefined) data["Parameter62.Value"] = params["parameter62.value"]; if (params["parameter63.name"] !== undefined) data["Parameter63.Name"] = params["parameter63.name"]; if (params["parameter63.value"] !== undefined) data["Parameter63.Value"] = params["parameter63.value"]; if (params["parameter64.name"] !== undefined) data["Parameter64.Name"] = params["parameter64.name"]; if (params["parameter64.value"] !== undefined) data["Parameter64.Value"] = params["parameter64.value"]; if (params["parameter65.name"] !== undefined) data["Parameter65.Name"] = params["parameter65.name"]; if (params["parameter65.value"] !== undefined) data["Parameter65.Value"] = params["parameter65.value"]; if (params["parameter66.name"] !== undefined) data["Parameter66.Name"] = params["parameter66.name"]; if (params["parameter66.value"] !== undefined) data["Parameter66.Value"] = params["parameter66.value"]; if (params["parameter67.name"] !== undefined) data["Parameter67.Name"] = params["parameter67.name"]; if (params["parameter67.value"] !== undefined) data["Parameter67.Value"] = params["parameter67.value"]; if (params["parameter68.name"] !== undefined) data["Parameter68.Name"] = params["parameter68.name"]; if (params["parameter68.value"] !== undefined) data["Parameter68.Value"] = params["parameter68.value"]; if (params["parameter69.name"] !== undefined) data["Parameter69.Name"] = params["parameter69.name"]; if (params["parameter69.value"] !== undefined) data["Parameter69.Value"] = params["parameter69.value"]; if (params["parameter70.name"] !== undefined) data["Parameter70.Name"] = params["parameter70.name"]; if (params["parameter70.value"] !== undefined) data["Parameter70.Value"] = params["parameter70.value"]; if (params["parameter71.name"] !== undefined) data["Parameter71.Name"] = params["parameter71.name"]; if (params["parameter71.value"] !== undefined) data["Parameter71.Value"] = params["parameter71.value"]; if (params["parameter72.name"] !== undefined) data["Parameter72.Name"] = params["parameter72.name"]; if (params["parameter72.value"] !== undefined) data["Parameter72.Value"] = params["parameter72.value"]; if (params["parameter73.name"] !== undefined) data["Parameter73.Name"] = params["parameter73.name"]; if (params["parameter73.value"] !== undefined) data["Parameter73.Value"] = params["parameter73.value"]; if (params["parameter74.name"] !== undefined) data["Parameter74.Name"] = params["parameter74.name"]; if (params["parameter74.value"] !== undefined) data["Parameter74.Value"] = params["parameter74.value"]; if (params["parameter75.name"] !== undefined) data["Parameter75.Name"] = params["parameter75.name"]; if (params["parameter75.value"] !== undefined) data["Parameter75.Value"] = params["parameter75.value"]; if (params["parameter76.name"] !== undefined) data["Parameter76.Name"] = params["parameter76.name"]; if (params["parameter76.value"] !== undefined) data["Parameter76.Value"] = params["parameter76.value"]; if (params["parameter77.name"] !== undefined) data["Parameter77.Name"] = params["parameter77.name"]; if (params["parameter77.value"] !== undefined) data["Parameter77.Value"] = params["parameter77.value"]; if (params["parameter78.name"] !== undefined) data["Parameter78.Name"] = params["parameter78.name"]; if (params["parameter78.value"] !== undefined) data["Parameter78.Value"] = params["parameter78.value"]; if (params["parameter79.name"] !== undefined) data["Parameter79.Name"] = params["parameter79.name"]; if (params["parameter79.value"] !== undefined) data["Parameter79.Value"] = params["parameter79.value"]; if (params["parameter80.name"] !== undefined) data["Parameter80.Name"] = params["parameter80.name"]; if (params["parameter80.value"] !== undefined) data["Parameter80.Value"] = params["parameter80.value"]; if (params["parameter81.name"] !== undefined) data["Parameter81.Name"] = params["parameter81.name"]; if (params["parameter81.value"] !== undefined) data["Parameter81.Value"] = params["parameter81.value"]; if (params["parameter82.name"] !== undefined) data["Parameter82.Name"] = params["parameter82.name"]; if (params["parameter82.value"] !== undefined) data["Parameter82.Value"] = params["parameter82.value"]; if (params["parameter83.name"] !== undefined) data["Parameter83.Name"] = params["parameter83.name"]; if (params["parameter83.value"] !== undefined) data["Parameter83.Value"] = params["parameter83.value"]; if (params["parameter84.name"] !== undefined) data["Parameter84.Name"] = params["parameter84.name"]; if (params["parameter84.value"] !== undefined) data["Parameter84.Value"] = params["parameter84.value"]; if (params["parameter85.name"] !== undefined) data["Parameter85.Name"] = params["parameter85.name"]; if (params["parameter85.value"] !== undefined) data["Parameter85.Value"] = params["parameter85.value"]; if (params["parameter86.name"] !== undefined) data["Parameter86.Name"] = params["parameter86.name"]; if (params["parameter86.value"] !== undefined) data["Parameter86.Value"] = params["parameter86.value"]; if (params["parameter87.name"] !== undefined) data["Parameter87.Name"] = params["parameter87.name"]; if (params["parameter87.value"] !== undefined) data["Parameter87.Value"] = params["parameter87.value"]; if (params["parameter88.name"] !== undefined) data["Parameter88.Name"] = params["parameter88.name"]; if (params["parameter88.value"] !== undefined) data["Parameter88.Value"] = params["parameter88.value"]; if (params["parameter89.name"] !== undefined) data["Parameter89.Name"] = params["parameter89.name"]; if (params["parameter89.value"] !== undefined) data["Parameter89.Value"] = params["parameter89.value"]; if (params["parameter90.name"] !== undefined) data["Parameter90.Name"] = params["parameter90.name"]; if (params["parameter90.value"] !== undefined) data["Parameter90.Value"] = params["parameter90.value"]; if (params["parameter91.name"] !== undefined) data["Parameter91.Name"] = params["parameter91.name"]; if (params["parameter91.value"] !== undefined) data["Parameter91.Value"] = params["parameter91.value"]; if (params["parameter92.name"] !== undefined) data["Parameter92.Name"] = params["parameter92.name"]; if (params["parameter92.value"] !== undefined) data["Parameter92.Value"] = params["parameter92.value"]; if (params["parameter93.name"] !== undefined) data["Parameter93.Name"] = params["parameter93.name"]; if (params["parameter93.value"] !== undefined) data["Parameter93.Value"] = params["parameter93.value"]; if (params["parameter94.name"] !== undefined) data["Parameter94.Name"] = params["parameter94.name"]; if (params["parameter94.value"] !== undefined) data["Parameter94.Value"] = params["parameter94.value"]; if (params["parameter95.name"] !== undefined) data["Parameter95.Name"] = params["parameter95.name"]; if (params["parameter95.value"] !== undefined) data["Parameter95.Value"] = params["parameter95.value"]; if (params["parameter96.name"] !== undefined) data["Parameter96.Name"] = params["parameter96.name"]; if (params["parameter96.value"] !== undefined) data["Parameter96.Value"] = params["parameter96.value"]; if (params["parameter97.name"] !== undefined) data["Parameter97.Name"] = params["parameter97.name"]; if (params["parameter97.value"] !== undefined) data["Parameter97.Value"] = params["parameter97.value"]; if (params["parameter98.name"] !== undefined) data["Parameter98.Name"] = params["parameter98.name"]; if (params["parameter98.value"] !== undefined) data["Parameter98.Value"] = params["parameter98.value"]; if (params["parameter99.name"] !== undefined) data["Parameter99.Name"] = params["parameter99.name"]; if (params["parameter99.value"] !== undefined) data["Parameter99.Value"] = params["parameter99.value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new StreamInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid)); 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; } exports.StreamListInstance = StreamListInstance; rest/api/v2010/account/call/userDefinedMessage.d.ts000064400000005052151677225100015755 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../../V2010"; /** * Options to pass to create a UserDefinedMessageInstance */ export interface UserDefinedMessageListInstanceCreateOptions { /** The User Defined Message in the form of URL-encoded JSON string. */ content: string; /** A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated. */ idempotencyKey?: string; } export interface UserDefinedMessageSolution { accountSid: string; callSid: string; } export interface UserDefinedMessageListInstance { _version: V2010; _solution: UserDefinedMessageSolution; _uri: string; /** * Create a UserDefinedMessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserDefinedMessageInstance */ create(params: UserDefinedMessageListInstanceCreateOptions, callback?: (error: Error | null, item?: UserDefinedMessageInstance) => any): Promise<UserDefinedMessageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserDefinedMessageListInstance(version: V2010, accountSid: string, callSid: string): UserDefinedMessageListInstance; interface UserDefinedMessageResource { account_sid: string; call_sid: string; sid: string; date_created: Date; } export declare class UserDefinedMessageInstance { protected _version: V2010; constructor(_version: V2010, payload: UserDefinedMessageResource, accountSid: string, callSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created User Defined Message. */ accountSid: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message is associated with. */ callSid: string; /** * The SID that uniquely identifies this User Defined Message. */ sid: string; /** * The date that this User Defined Message was created, given in RFC 2822 format. */ dateCreated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; callSid: string; sid: string; dateCreated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/call/stream.d.ts000064400000041376151677225100013517 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../../V2010"; export type StreamStatus = "in-progress" | "stopped"; export type StreamTrack = "inbound_track" | "outbound_track" | "both_tracks"; export type StreamUpdateStatus = "stopped"; /** * Options to pass to update a StreamInstance */ export interface StreamContextUpdateOptions { /** */ status: StreamUpdateStatus; } /** * Options to pass to create a StreamInstance */ export interface StreamListInstanceCreateOptions { /** Relative or absolute URL where WebSocket connection will be established. */ url: string; /** The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream. */ name?: string; /** */ track?: StreamTrack; /** Absolute URL to which Twilio sends status callback HTTP requests. */ statusCallback?: string; /** The HTTP method Twilio uses when sending `status_callback` requests. Possible values are `GET` and `POST`. Default is `POST`. */ statusCallbackMethod?: string; /** Parameter name */ "parameter1.name"?: string; /** Parameter value */ "parameter1.value"?: string; /** Parameter name */ "parameter2.name"?: string; /** Parameter value */ "parameter2.value"?: string; /** Parameter name */ "parameter3.name"?: string; /** Parameter value */ "parameter3.value"?: string; /** Parameter name */ "parameter4.name"?: string; /** Parameter value */ "parameter4.value"?: string; /** Parameter name */ "parameter5.name"?: string; /** Parameter value */ "parameter5.value"?: string; /** Parameter name */ "parameter6.name"?: string; /** Parameter value */ "parameter6.value"?: string; /** Parameter name */ "parameter7.name"?: string; /** Parameter value */ "parameter7.value"?: string; /** Parameter name */ "parameter8.name"?: string; /** Parameter value */ "parameter8.value"?: string; /** Parameter name */ "parameter9.name"?: string; /** Parameter value */ "parameter9.value"?: string; /** Parameter name */ "parameter10.name"?: string; /** Parameter value */ "parameter10.value"?: string; /** Parameter name */ "parameter11.name"?: string; /** Parameter value */ "parameter11.value"?: string; /** Parameter name */ "parameter12.name"?: string; /** Parameter value */ "parameter12.value"?: string; /** Parameter name */ "parameter13.name"?: string; /** Parameter value */ "parameter13.value"?: string; /** Parameter name */ "parameter14.name"?: string; /** Parameter value */ "parameter14.value"?: string; /** Parameter name */ "parameter15.name"?: string; /** Parameter value */ "parameter15.value"?: string; /** Parameter name */ "parameter16.name"?: string; /** Parameter value */ "parameter16.value"?: string; /** Parameter name */ "parameter17.name"?: string; /** Parameter value */ "parameter17.value"?: string; /** Parameter name */ "parameter18.name"?: string; /** Parameter value */ "parameter18.value"?: string; /** Parameter name */ "parameter19.name"?: string; /** Parameter value */ "parameter19.value"?: string; /** Parameter name */ "parameter20.name"?: string; /** Parameter value */ "parameter20.value"?: string; /** Parameter name */ "parameter21.name"?: string; /** Parameter value */ "parameter21.value"?: string; /** Parameter name */ "parameter22.name"?: string; /** Parameter value */ "parameter22.value"?: string; /** Parameter name */ "parameter23.name"?: string; /** Parameter value */ "parameter23.value"?: string; /** Parameter name */ "parameter24.name"?: string; /** Parameter value */ "parameter24.value"?: string; /** Parameter name */ "parameter25.name"?: string; /** Parameter value */ "parameter25.value"?: string; /** Parameter name */ "parameter26.name"?: string; /** Parameter value */ "parameter26.value"?: string; /** Parameter name */ "parameter27.name"?: string; /** Parameter value */ "parameter27.value"?: string; /** Parameter name */ "parameter28.name"?: string; /** Parameter value */ "parameter28.value"?: string; /** Parameter name */ "parameter29.name"?: string; /** Parameter value */ "parameter29.value"?: string; /** Parameter name */ "parameter30.name"?: string; /** Parameter value */ "parameter30.value"?: string; /** Parameter name */ "parameter31.name"?: string; /** Parameter value */ "parameter31.value"?: string; /** Parameter name */ "parameter32.name"?: string; /** Parameter value */ "parameter32.value"?: string; /** Parameter name */ "parameter33.name"?: string; /** Parameter value */ "parameter33.value"?: string; /** Parameter name */ "parameter34.name"?: string; /** Parameter value */ "parameter34.value"?: string; /** Parameter name */ "parameter35.name"?: string; /** Parameter value */ "parameter35.value"?: string; /** Parameter name */ "parameter36.name"?: string; /** Parameter value */ "parameter36.value"?: string; /** Parameter name */ "parameter37.name"?: string; /** Parameter value */ "parameter37.value"?: string; /** Parameter name */ "parameter38.name"?: string; /** Parameter value */ "parameter38.value"?: string; /** Parameter name */ "parameter39.name"?: string; /** Parameter value */ "parameter39.value"?: string; /** Parameter name */ "parameter40.name"?: string; /** Parameter value */ "parameter40.value"?: string; /** Parameter name */ "parameter41.name"?: string; /** Parameter value */ "parameter41.value"?: string; /** Parameter name */ "parameter42.name"?: string; /** Parameter value */ "parameter42.value"?: string; /** Parameter name */ "parameter43.name"?: string; /** Parameter value */ "parameter43.value"?: string; /** Parameter name */ "parameter44.name"?: string; /** Parameter value */ "parameter44.value"?: string; /** Parameter name */ "parameter45.name"?: string; /** Parameter value */ "parameter45.value"?: string; /** Parameter name */ "parameter46.name"?: string; /** Parameter value */ "parameter46.value"?: string; /** Parameter name */ "parameter47.name"?: string; /** Parameter value */ "parameter47.value"?: string; /** Parameter name */ "parameter48.name"?: string; /** Parameter value */ "parameter48.value"?: string; /** Parameter name */ "parameter49.name"?: string; /** Parameter value */ "parameter49.value"?: string; /** Parameter name */ "parameter50.name"?: string; /** Parameter value */ "parameter50.value"?: string; /** Parameter name */ "parameter51.name"?: string; /** Parameter value */ "parameter51.value"?: string; /** Parameter name */ "parameter52.name"?: string; /** Parameter value */ "parameter52.value"?: string; /** Parameter name */ "parameter53.name"?: string; /** Parameter value */ "parameter53.value"?: string; /** Parameter name */ "parameter54.name"?: string; /** Parameter value */ "parameter54.value"?: string; /** Parameter name */ "parameter55.name"?: string; /** Parameter value */ "parameter55.value"?: string; /** Parameter name */ "parameter56.name"?: string; /** Parameter value */ "parameter56.value"?: string; /** Parameter name */ "parameter57.name"?: string; /** Parameter value */ "parameter57.value"?: string; /** Parameter name */ "parameter58.name"?: string; /** Parameter value */ "parameter58.value"?: string; /** Parameter name */ "parameter59.name"?: string; /** Parameter value */ "parameter59.value"?: string; /** Parameter name */ "parameter60.name"?: string; /** Parameter value */ "parameter60.value"?: string; /** Parameter name */ "parameter61.name"?: string; /** Parameter value */ "parameter61.value"?: string; /** Parameter name */ "parameter62.name"?: string; /** Parameter value */ "parameter62.value"?: string; /** Parameter name */ "parameter63.name"?: string; /** Parameter value */ "parameter63.value"?: string; /** Parameter name */ "parameter64.name"?: string; /** Parameter value */ "parameter64.value"?: string; /** Parameter name */ "parameter65.name"?: string; /** Parameter value */ "parameter65.value"?: string; /** Parameter name */ "parameter66.name"?: string; /** Parameter value */ "parameter66.value"?: string; /** Parameter name */ "parameter67.name"?: string; /** Parameter value */ "parameter67.value"?: string; /** Parameter name */ "parameter68.name"?: string; /** Parameter value */ "parameter68.value"?: string; /** Parameter name */ "parameter69.name"?: string; /** Parameter value */ "parameter69.value"?: string; /** Parameter name */ "parameter70.name"?: string; /** Parameter value */ "parameter70.value"?: string; /** Parameter name */ "parameter71.name"?: string; /** Parameter value */ "parameter71.value"?: string; /** Parameter name */ "parameter72.name"?: string; /** Parameter value */ "parameter72.value"?: string; /** Parameter name */ "parameter73.name"?: string; /** Parameter value */ "parameter73.value"?: string; /** Parameter name */ "parameter74.name"?: string; /** Parameter value */ "parameter74.value"?: string; /** Parameter name */ "parameter75.name"?: string; /** Parameter value */ "parameter75.value"?: string; /** Parameter name */ "parameter76.name"?: string; /** Parameter value */ "parameter76.value"?: string; /** Parameter name */ "parameter77.name"?: string; /** Parameter value */ "parameter77.value"?: string; /** Parameter name */ "parameter78.name"?: string; /** Parameter value */ "parameter78.value"?: string; /** Parameter name */ "parameter79.name"?: string; /** Parameter value */ "parameter79.value"?: string; /** Parameter name */ "parameter80.name"?: string; /** Parameter value */ "parameter80.value"?: string; /** Parameter name */ "parameter81.name"?: string; /** Parameter value */ "parameter81.value"?: string; /** Parameter name */ "parameter82.name"?: string; /** Parameter value */ "parameter82.value"?: string; /** Parameter name */ "parameter83.name"?: string; /** Parameter value */ "parameter83.value"?: string; /** Parameter name */ "parameter84.name"?: string; /** Parameter value */ "parameter84.value"?: string; /** Parameter name */ "parameter85.name"?: string; /** Parameter value */ "parameter85.value"?: string; /** Parameter name */ "parameter86.name"?: string; /** Parameter value */ "parameter86.value"?: string; /** Parameter name */ "parameter87.name"?: string; /** Parameter value */ "parameter87.value"?: string; /** Parameter name */ "parameter88.name"?: string; /** Parameter value */ "parameter88.value"?: string; /** Parameter name */ "parameter89.name"?: string; /** Parameter value */ "parameter89.value"?: string; /** Parameter name */ "parameter90.name"?: string; /** Parameter value */ "parameter90.value"?: string; /** Parameter name */ "parameter91.name"?: string; /** Parameter value */ "parameter91.value"?: string; /** Parameter name */ "parameter92.name"?: string; /** Parameter value */ "parameter92.value"?: string; /** Parameter name */ "parameter93.name"?: string; /** Parameter value */ "parameter93.value"?: string; /** Parameter name */ "parameter94.name"?: string; /** Parameter value */ "parameter94.value"?: string; /** Parameter name */ "parameter95.name"?: string; /** Parameter value */ "parameter95.value"?: string; /** Parameter name */ "parameter96.name"?: string; /** Parameter value */ "parameter96.value"?: string; /** Parameter name */ "parameter97.name"?: string; /** Parameter value */ "parameter97.value"?: string; /** Parameter name */ "parameter98.name"?: string; /** Parameter value */ "parameter98.value"?: string; /** Parameter name */ "parameter99.name"?: string; /** Parameter value */ "parameter99.value"?: string; } export interface StreamContext { /** * Update a StreamInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed StreamInstance */ update(params: StreamContextUpdateOptions, callback?: (error: Error | null, item?: StreamInstance) => any): Promise<StreamInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface StreamContextSolution { accountSid: string; callSid: string; sid: string; } export declare class StreamContextImpl implements StreamContext { protected _version: V2010; protected _solution: StreamContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, callSid: string, sid: string); update(params: StreamContextUpdateOptions, callback?: (error: Error | null, item?: StreamInstance) => any): Promise<StreamInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): StreamContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface StreamResource { sid: string; account_sid: string; call_sid: string; name: string; status: StreamStatus; date_updated: Date; uri: string; } export declare class StreamInstance { protected _version: V2010; protected _solution: StreamContextSolution; protected _context?: StreamContext; constructor(_version: V2010, payload: StreamResource, accountSid: string, callSid: string, sid?: string); /** * The SID of the Stream resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. */ accountSid: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Stream resource is associated with. */ callSid: string; /** * The user-specified name of this Stream, if one was given when the Stream was created. This can be used to stop the Stream. */ name: string; status: StreamStatus; /** * The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Update a StreamInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed StreamInstance */ update(params: StreamContextUpdateOptions, callback?: (error: Error | null, item?: StreamInstance) => any): Promise<StreamInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; callSid: string; name: string; status: StreamStatus; dateUpdated: Date; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface StreamSolution { accountSid: string; callSid: string; } export interface StreamListInstance { _version: V2010; _solution: StreamSolution; _uri: string; (sid: string): StreamContext; get(sid: string): StreamContext; /** * Create a StreamInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed StreamInstance */ create(params: StreamListInstanceCreateOptions, callback?: (error: Error | null, item?: StreamInstance) => any): Promise<StreamInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function StreamListInstance(version: V2010, accountSid: string, callSid: string): StreamListInstance; export {}; rest/api/v2010/account/call/payment.d.ts000064400000021126151677225100013670 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2010 from "../../../V2010"; export type PaymentBankAccountType = "consumer-checking" | "consumer-savings" | "commercial-checking"; export type PaymentCapture = "payment-card-number" | "expiration-date" | "security-code" | "postal-code" | "bank-routing-number" | "bank-account-number"; export type PaymentPaymentMethod = "credit-card" | "ach-debit"; export type PaymentStatus = "complete" | "cancel"; export type PaymentTokenType = "one-time" | "reusable" | "payment-method"; /** * Options to pass to update a PaymentInstance */ export interface PaymentContextUpdateOptions { /** A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated. */ idempotencyKey: string; /** Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the [Update](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-update) and [Complete/Cancel](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-cancelcomplete) POST requests. */ statusCallback: string; /** */ capture?: PaymentCapture; /** */ status?: PaymentStatus; } /** * Options to pass to create a PaymentInstance */ export interface PaymentListInstanceCreateOptions { /** A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated. */ idempotencyKey: string; /** Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the [expected StatusCallback values](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback) */ statusCallback: string; /** */ bankAccountType?: PaymentBankAccountType; /** A positive decimal value less than 1,000,000 to charge against the credit card or bank account. Default currency can be overwritten with `currency` field. Leave blank or set to 0 to tokenize. */ chargeAmount?: number; /** The currency of the `charge_amount`, formatted as [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format. The default value is `USD` and all values allowed from the Pay Connector are accepted. */ currency?: string; /** The description can be used to provide more details regarding the transaction. This information is submitted along with the payment details to the Payment Connector which are then posted on the transactions. */ description?: string; /** A list of inputs that should be accepted. Currently only `dtmf` is supported. All digits captured during a pay session are redacted from the logs. */ input?: string; /** A positive integer that is used to validate the length of the `PostalCode` inputted by the user. User must enter this many digits. */ minPostalCodeLength?: number; /** A single-level JSON object used to pass custom parameters to payment processors. (Required for ACH payments). The information that has to be included here depends on the <Pay> Connector. [Read more](https://www.twilio.com/console/voice/pay-connectors). */ parameter?: any; /** This is the unique name corresponding to the Pay Connector installed in the Twilio Add-ons. Learn more about [<Pay> Connectors](https://www.twilio.com/console/voice/pay-connectors). The default value is `Default`. */ paymentConnector?: string; /** */ paymentMethod?: PaymentPaymentMethod; /** Indicates whether the credit card postal code (zip code) is a required piece of payment information that must be provided by the caller. The default is `true`. */ postalCode?: boolean; /** Indicates whether the credit card security code is a required piece of payment information that must be provided by the caller. The default is `true`. */ securityCode?: boolean; /** The number of seconds that <Pay> should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. The default is `5`, maximum is `600`. */ timeout?: number; /** */ tokenType?: PaymentTokenType; /** Credit card types separated by space that Pay should accept. The default value is `visa mastercard amex` */ validCardTypes?: string; } export interface PaymentContext { /** * Update a PaymentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PaymentInstance */ update(params: PaymentContextUpdateOptions, callback?: (error: Error | null, item?: PaymentInstance) => any): Promise<PaymentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PaymentContextSolution { accountSid: string; callSid: string; sid: string; } export declare class PaymentContextImpl implements PaymentContext { protected _version: V2010; protected _solution: PaymentContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, callSid: string, sid: string); update(params: PaymentContextUpdateOptions, callback?: (error: Error | null, item?: PaymentInstance) => any): Promise<PaymentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PaymentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PaymentResource { account_sid: string; call_sid: string; sid: string; date_created: Date; date_updated: Date; uri: string; } export declare class PaymentInstance { protected _version: V2010; protected _solution: PaymentContextSolution; protected _context?: PaymentContext; constructor(_version: V2010, payload: PaymentResource, accountSid: string, callSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. */ accountSid: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF. */ callSid: string; /** * The SID of the Payments resource. */ sid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; private get _proxy(); /** * Update a PaymentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PaymentInstance */ update(params: PaymentContextUpdateOptions, callback?: (error: Error | null, item?: PaymentInstance) => any): Promise<PaymentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; callSid: string; sid: string; dateCreated: Date; dateUpdated: Date; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PaymentSolution { accountSid: string; callSid: string; } export interface PaymentListInstance { _version: V2010; _solution: PaymentSolution; _uri: string; (sid: string): PaymentContext; get(sid: string): PaymentContext; /** * Create a PaymentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PaymentInstance */ create(params: PaymentListInstanceCreateOptions, callback?: (error: Error | null, item?: PaymentInstance) => any): Promise<PaymentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PaymentListInstance(version: V2010, accountSid: string, callSid: string): PaymentListInstance; export {}; rest/api/v2010/account/call/event.d.ts000064400000013317151677225100013337 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; /** * Options to pass to each */ export interface EventListInstanceEachOptions { /** 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: EventInstance, 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 EventListInstanceOptions { /** 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 EventListInstancePageOptions { /** 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 EventSolution { accountSid: string; callSid: string; } export interface EventListInstance { _version: V2010; _solution: EventSolution; _uri: string; /** * Streams EventInstance 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 { EventListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EventInstance, done: (err?: Error) => void) => void): void; each(params: EventListInstanceEachOptions, callback?: (item: EventInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EventInstance 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: EventPage) => any): Promise<EventPage>; /** * Lists EventInstance 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 { EventListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>; list(params: EventListInstanceOptions, callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>; /** * Retrieve a single page of EventInstance 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 { EventListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>; page(params: EventListInstancePageOptions, callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EventListInstance(version: V2010, accountSid: string, callSid: string): EventListInstance; interface EventPayload extends TwilioResponsePayload { events: EventResource[]; } interface EventResource { request: any; response: any; } export declare class EventInstance { protected _version: V2010; constructor(_version: V2010, payload: EventResource, accountSid: string, callSid: string); /** * Contains a dictionary representing the request of the call. */ request: any; /** * Contains a dictionary representing the call response, including a list of the call events. */ response: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { request: any; response: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class EventPage extends Page<V2010, EventPayload, EventResource, EventInstance> { /** * Initialize the EventPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: EventSolution); /** * Build an instance of EventInstance * * @param payload - Payload response from the API */ getInstance(payload: EventResource): EventInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/call/recording.js000064400000030216151677225100013733 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.RecordingPage = exports.RecordingListInstance = exports.RecordingInstance = exports.RecordingContextImpl = void 0; 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 RecordingContextImpl { constructor(_version, accountSid, callSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { accountSid, callSid, sid }; this._uri = `/Accounts/${accountSid}/Calls/${callSid}/Recordings/${sid}.json`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; if (params["pauseBehavior"] !== undefined) data["PauseBehavior"] = params["pauseBehavior"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid, 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.RecordingContextImpl = RecordingContextImpl; class RecordingInstance { constructor(_version, payload, accountSid, callSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.apiVersion = payload.api_version; this.callSid = payload.call_sid; this.conferenceSid = payload.conference_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.startTime = deserialize.rfc2822DateTime(payload.start_time); this.duration = payload.duration; this.sid = payload.sid; this.price = payload.price; this.uri = payload.uri; this.encryptionDetails = payload.encryption_details; this.priceUnit = payload.price_unit; this.status = payload.status; this.channels = deserialize.integer(payload.channels); this.source = payload.source; this.errorCode = deserialize.integer(payload.error_code); this.track = payload.track; this._solution = { accountSid, callSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RecordingContextImpl(this._version, this._solution.accountSid, this._solution.callSid, this._solution.sid); return this._context; } /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, apiVersion: this.apiVersion, callSid: this.callSid, conferenceSid: this.conferenceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, startTime: this.startTime, duration: this.duration, sid: this.sid, price: this.price, uri: this.uri, encryptionDetails: this.encryptionDetails, priceUnit: this.priceUnit, status: this.status, channels: this.channels, source: this.source, errorCode: this.errorCode, track: this.track, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingInstance = RecordingInstance; function RecordingListInstance(version, accountSid, callSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(callSid)) { throw new Error("Parameter 'callSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RecordingContextImpl(version, accountSid, callSid, sid); }; instance._version = version; instance._solution = { accountSid, callSid }; instance._uri = `/Accounts/${accountSid}/Calls/${callSid}/Recordings.json`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["recordingStatusCallbackEvent"] !== undefined) data["RecordingStatusCallbackEvent"] = serialize.map(params["recordingStatusCallbackEvent"], (e) => e); if (params["recordingStatusCallback"] !== undefined) data["RecordingStatusCallback"] = params["recordingStatusCallback"]; if (params["recordingStatusCallbackMethod"] !== undefined) data["RecordingStatusCallbackMethod"] = params["recordingStatusCallbackMethod"]; if (params["trim"] !== undefined) data["Trim"] = params["trim"]; if (params["recordingChannels"] !== undefined) data["RecordingChannels"] = params["recordingChannels"]; if (params["recordingTrack"] !== undefined) data["RecordingTrack"] = params["recordingTrack"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.accountSid, instance._solution.callSid)); 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["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601Date(params["dateCreated"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreated<"] = serialize.iso8601Date(params["dateCreatedBefore"]); if (params["dateCreatedAfter"] !== undefined) data["DateCreated>"] = serialize.iso8601Date(params["dateCreatedAfter"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingPage(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 RecordingPage(instance._version, payload, 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; } exports.RecordingListInstance = RecordingListInstance; class RecordingPage extends Page_1.default { /** * Initialize the RecordingPage * * @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 RecordingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RecordingInstance(this._version, payload, this._solution.accountSid, this._solution.callSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingPage = RecordingPage; rest/api/v2010/account/call/recording.d.ts000064400000044300151677225100014166 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2010 from "../../../V2010"; export type RecordingSource = "DialVerb" | "Conference" | "OutboundAPI" | "Trunking" | "RecordVerb" | "StartCallRecordingAPI" | "StartConferenceRecordingAPI"; export type RecordingStatus = "in-progress" | "paused" | "stopped" | "processing" | "completed" | "absent"; /** * Options to pass to update a RecordingInstance */ export interface RecordingContextUpdateOptions { /** */ status: RecordingStatus; /** Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. */ pauseBehavior?: string; } /** * Options to pass to create a RecordingInstance */ export interface RecordingListInstanceCreateOptions { /** The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space. */ recordingStatusCallbackEvent?: Array<string>; /** The URL we should call using the `recording_status_callback_method` on each recording event specified in `recording_status_callback_event`. For more information, see [RecordingStatusCallback parameters](https://www.twilio.com/docs/voice/api/recording#recordingstatuscallback). */ recordingStatusCallback?: string; /** The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. */ recordingStatusCallbackMethod?: string; /** Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. */ trim?: string; /** The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels. */ recordingChannels?: string; /** The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. */ recordingTrack?: string; } /** * Options to pass to each */ export interface RecordingListInstanceEachOptions { /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreated?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedBefore?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: RecordingInstance, 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 RecordingListInstanceOptions { /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreated?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedBefore?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface RecordingListInstancePageOptions { /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreated?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedBefore?: Date; /** The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. */ dateCreatedAfter?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface RecordingContext { /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Update a RecordingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RecordingContextSolution { accountSid: string; callSid: string; sid: string; } export declare class RecordingContextImpl implements RecordingContext { protected _version: V2010; protected _solution: RecordingContextSolution; protected _uri: string; constructor(_version: V2010, accountSid: string, callSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RecordingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RecordingPayload extends TwilioResponsePayload { recordings: RecordingResource[]; } interface RecordingResource { account_sid: string; api_version: string; call_sid: string; conference_sid: string; date_created: Date; date_updated: Date; start_time: Date; duration: string; sid: string; price: number; uri: string; encryption_details: any; price_unit: string; status: RecordingStatus; channels: number; source: RecordingSource; error_code: number; track: string; } export declare class RecordingInstance { protected _version: V2010; protected _solution: RecordingContextSolution; protected _context?: RecordingContext; constructor(_version: V2010, payload: RecordingResource, accountSid: string, callSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. */ accountSid: string; /** * The API version used to make the recording. */ apiVersion: string; /** * The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. */ callSid: string; /** * The Conference SID that identifies the conference associated with the recording, if a conference recording. */ conferenceSid: string; /** * The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateCreated: Date; /** * The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. */ dateUpdated: Date; /** * The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. */ startTime: Date; /** * The length of the recording in seconds. */ duration: string; /** * The unique string that that we created to identify the Recording resource. */ sid: string; /** * The one-time cost of creating the recording in the `price_unit` currency. */ price: number; /** * The URI of the resource, relative to `https://api.twilio.com`. */ uri: string; /** * How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. */ encryptionDetails: any; /** * The currency used in the `price` property. Example: `USD`. */ priceUnit: string; status: RecordingStatus; /** * The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. */ channels: number; source: RecordingSource; /** * The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. */ errorCode: number; /** * The recorded track. Can be: `inbound`, `outbound`, or `both`. */ track: string; private get _proxy(); /** * Remove a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Update a RecordingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; apiVersion: string; callSid: string; conferenceSid: string; dateCreated: Date; dateUpdated: Date; startTime: Date; duration: string; sid: string; price: number; uri: string; encryptionDetails: any; priceUnit: string; status: RecordingStatus; channels: number; source: RecordingSource; errorCode: number; track: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RecordingSolution { accountSid: string; callSid: string; } export interface RecordingListInstance { _version: V2010; _solution: RecordingSolution; _uri: string; (sid: string): RecordingContext; get(sid: string): RecordingContext; /** * Create a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ create(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Create a RecordingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ create(params: RecordingListInstanceCreateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Streams RecordingInstance 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 { RecordingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RecordingInstance, done: (err?: Error) => void) => void): void; each(params: RecordingListInstanceEachOptions, callback?: (item: RecordingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RecordingInstance 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: RecordingPage) => any): Promise<RecordingPage>; /** * Lists RecordingInstance 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 { RecordingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RecordingInstance[]) => any): Promise<RecordingInstance[]>; list(params: RecordingListInstanceOptions, callback?: (error: Error | null, items: RecordingInstance[]) => any): Promise<RecordingInstance[]>; /** * Retrieve a single page of RecordingInstance 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 { RecordingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RecordingPage) => any): Promise<RecordingPage>; page(params: RecordingListInstancePageOptions, callback?: (error: Error | null, items: RecordingPage) => any): Promise<RecordingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RecordingListInstance(version: V2010, accountSid: string, callSid: string): RecordingListInstance; export declare class RecordingPage extends Page<V2010, RecordingPayload, RecordingResource, RecordingInstance> { /** * Initialize the RecordingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: RecordingSolution); /** * Build an instance of RecordingInstance * * @param payload - Payload response from the API */ getInstance(payload: RecordingResource): RecordingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/v2010/account/token.js000064400000006755151677225100012177 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.TokenInstance = exports.TokenListInstance = exports.ApiV2010AccountTokenIceServers = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class ApiV2010AccountTokenIceServers { } exports.ApiV2010AccountTokenIceServers = ApiV2010AccountTokenIceServers; function TokenListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/Tokens.json`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TokenInstance(operationVersion, payload, instance._solution.accountSid)); 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; } exports.TokenListInstance = TokenListInstance; class TokenInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.rfc2822DateTime(payload.date_created); this.dateUpdated = deserialize.rfc2822DateTime(payload.date_updated); this.iceServers = payload.ice_servers; this.password = payload.password; this.ttl = payload.ttl; this.username = payload.username; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, iceServers: this.iceServers, password: this.password, ttl: this.ttl, username: this.username, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TokenInstance = TokenInstance; rest/api/v2010/account/validationRequest.js000064400000007671151677225100014560 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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.ValidationRequestInstance = exports.ValidationRequestListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function ValidationRequestListInstance(version, accountSid) { if (!(0, utility_1.isValidPathParam)(accountSid)) { throw new Error("Parameter 'accountSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { accountSid }; instance._uri = `/Accounts/${accountSid}/OutgoingCallerIds.json`; 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"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["callDelay"] !== undefined) data["CallDelay"] = params["callDelay"]; if (params["extension"] !== undefined) data["Extension"] = params["extension"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ValidationRequestInstance(operationVersion, payload, instance._solution.accountSid)); 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; } exports.ValidationRequestListInstance = ValidationRequestListInstance; class ValidationRequestInstance { constructor(_version, payload, accountSid) { this._version = _version; this.accountSid = payload.account_sid; this.callSid = payload.call_sid; this.friendlyName = payload.friendly_name; this.phoneNumber = payload.phone_number; this.validationCode = payload.validation_code; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, callSid: this.callSid, friendlyName: this.friendlyName, phoneNumber: this.phoneNumber, validationCode: this.validationCode, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ValidationRequestInstance = ValidationRequestInstance; rest/api/v2010/account.d.ts000064400000045520151677225100011304 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2010 from "../V2010"; import { AddressListInstance } from "./account/address"; import { ApplicationListInstance } from "./account/application"; import { AuthorizedConnectAppListInstance } from "./account/authorizedConnectApp"; import { AvailablePhoneNumberCountryListInstance } from "./account/availablePhoneNumberCountry"; import { BalanceListInstance } from "./account/balance"; import { CallListInstance } from "./account/call"; import { ConferenceListInstance } from "./account/conference"; import { ConnectAppListInstance } from "./account/connectApp"; import { IncomingPhoneNumberListInstance } from "./account/incomingPhoneNumber"; import { KeyListInstance } from "./account/key"; import { MessageListInstance } from "./account/message"; import { NewKeyListInstance } from "./account/newKey"; import { NewSigningKeyListInstance } from "./account/newSigningKey"; import { NotificationListInstance } from "./account/notification"; import { OutgoingCallerIdListInstance } from "./account/outgoingCallerId"; import { QueueListInstance } from "./account/queue"; import { RecordingListInstance } from "./account/recording"; import { ShortCodeListInstance } from "./account/shortCode"; import { SigningKeyListInstance } from "./account/signingKey"; import { SipListInstance } from "./account/sip"; import { TokenListInstance } from "./account/token"; import { TranscriptionListInstance } from "./account/transcription"; import { UsageListInstance } from "./account/usage"; import { ValidationRequestListInstance } from "./account/validationRequest"; export type AccountStatus = "active" | "suspended" | "closed"; export type AccountType = "Trial" | "Full"; /** * Options to pass to update a AccountInstance */ export interface AccountContextUpdateOptions { /** Update the human-readable description of this Account */ friendlyName?: string; /** */ status?: AccountStatus; } /** * Options to pass to create a AccountInstance */ export interface AccountListInstanceCreateOptions { /** A human readable description of the account to create, defaults to `SubAccount Created at {YYYY-MM-DD HH:MM meridian}` */ friendlyName?: string; } /** * Options to pass to each */ export interface AccountListInstanceEachOptions { /** Only return the Account resources with friendly names that exactly match this name. */ friendlyName?: string; /** Only return Account resources with the given status. Can be `closed`, `suspended` or `active`. */ status?: AccountStatus; /** 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: AccountInstance, 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 AccountListInstanceOptions { /** Only return the Account resources with friendly names that exactly match this name. */ friendlyName?: string; /** Only return Account resources with the given status. Can be `closed`, `suspended` or `active`. */ status?: AccountStatus; /** 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 AccountListInstancePageOptions { /** Only return the Account resources with friendly names that exactly match this name. */ friendlyName?: string; /** Only return Account resources with the given status. Can be `closed`, `suspended` or `active`. */ status?: AccountStatus; /** 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 AccountContext { addresses: AddressListInstance; applications: ApplicationListInstance; authorizedConnectApps: AuthorizedConnectAppListInstance; availablePhoneNumbers: AvailablePhoneNumberCountryListInstance; balance: BalanceListInstance; calls: CallListInstance; conferences: ConferenceListInstance; connectApps: ConnectAppListInstance; incomingPhoneNumbers: IncomingPhoneNumberListInstance; keys: KeyListInstance; messages: MessageListInstance; newKeys: NewKeyListInstance; newSigningKeys: NewSigningKeyListInstance; notifications: NotificationListInstance; outgoingCallerIds: OutgoingCallerIdListInstance; queues: QueueListInstance; recordings: RecordingListInstance; shortCodes: ShortCodeListInstance; signingKeys: SigningKeyListInstance; sip: SipListInstance; tokens: TokenListInstance; transcriptions: TranscriptionListInstance; usage: UsageListInstance; validationRequests: ValidationRequestListInstance; /** * Fetch a AccountInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountInstance */ fetch(callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; /** * Update a AccountInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountInstance */ update(callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; /** * Update a AccountInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountInstance */ update(params: AccountContextUpdateOptions, callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AccountContextSolution { sid: string; } export declare class AccountContextImpl implements AccountContext { protected _version: V2010; protected _solution: AccountContextSolution; protected _uri: string; protected _addresses?: AddressListInstance; protected _applications?: ApplicationListInstance; protected _authorizedConnectApps?: AuthorizedConnectAppListInstance; protected _availablePhoneNumbers?: AvailablePhoneNumberCountryListInstance; protected _balance?: BalanceListInstance; protected _calls?: CallListInstance; protected _conferences?: ConferenceListInstance; protected _connectApps?: ConnectAppListInstance; protected _incomingPhoneNumbers?: IncomingPhoneNumberListInstance; protected _keys?: KeyListInstance; protected _messages?: MessageListInstance; protected _newKeys?: NewKeyListInstance; protected _newSigningKeys?: NewSigningKeyListInstance; protected _notifications?: NotificationListInstance; protected _outgoingCallerIds?: OutgoingCallerIdListInstance; protected _queues?: QueueListInstance; protected _recordings?: RecordingListInstance; protected _shortCodes?: ShortCodeListInstance; protected _signingKeys?: SigningKeyListInstance; protected _sip?: SipListInstance; protected _tokens?: TokenListInstance; protected _transcriptions?: TranscriptionListInstance; protected _usage?: UsageListInstance; protected _validationRequests?: ValidationRequestListInstance; constructor(_version: V2010, sid: string); get addresses(): AddressListInstance; get applications(): ApplicationListInstance; get authorizedConnectApps(): AuthorizedConnectAppListInstance; get availablePhoneNumbers(): AvailablePhoneNumberCountryListInstance; get balance(): BalanceListInstance; get calls(): CallListInstance; get conferences(): ConferenceListInstance; get connectApps(): ConnectAppListInstance; get incomingPhoneNumbers(): IncomingPhoneNumberListInstance; get keys(): KeyListInstance; get messages(): MessageListInstance; get newKeys(): NewKeyListInstance; get newSigningKeys(): NewSigningKeyListInstance; get notifications(): NotificationListInstance; get outgoingCallerIds(): OutgoingCallerIdListInstance; get queues(): QueueListInstance; get recordings(): RecordingListInstance; get shortCodes(): ShortCodeListInstance; get signingKeys(): SigningKeyListInstance; get sip(): SipListInstance; get tokens(): TokenListInstance; get transcriptions(): TranscriptionListInstance; get usage(): UsageListInstance; get validationRequests(): ValidationRequestListInstance; fetch(callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; update(params?: AccountContextUpdateOptions | ((error: Error | null, item?: AccountInstance) => any), callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AccountContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AccountPayload extends TwilioResponsePayload { accounts: AccountResource[]; } interface AccountResource { auth_token: string; date_created: Date; date_updated: Date; friendly_name: string; owner_account_sid: string; sid: string; status: AccountStatus; subresource_uris: Record<string, string>; type: AccountType; uri: string; } export declare class AccountInstance { protected _version: V2010; protected _solution: AccountContextSolution; protected _context?: AccountContext; constructor(_version: V2010, payload: AccountResource, sid?: string); /** * The authorization token for this account. This token should be kept a secret, so no sharing. */ authToken: string; /** * The date that this account was created, in GMT in RFC 2822 format */ dateCreated: Date; /** * The date that this account was last updated, in GMT in RFC 2822 format. */ dateUpdated: Date; /** * A human readable description of this account, up to 64 characters long. By default the FriendlyName is your email address. */ friendlyName: string; /** * The unique 34 character id that represents the parent of this account. The OwnerAccountSid of a parent account is it\'s own sid. */ ownerAccountSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; status: AccountStatus; /** * A Map of various subresources available for the given Account Instance */ subresourceUris: Record<string, string>; type: AccountType; /** * The URI for this resource, relative to `https://api.twilio.com` */ uri: string; private get _proxy(); /** * Fetch a AccountInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountInstance */ fetch(callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; /** * Update a AccountInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountInstance */ update(callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; /** * Update a AccountInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountInstance */ update(params: AccountContextUpdateOptions, callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; /** * Access the addresses. */ addresses(): AddressListInstance; /** * Access the applications. */ applications(): ApplicationListInstance; /** * Access the authorizedConnectApps. */ authorizedConnectApps(): AuthorizedConnectAppListInstance; /** * Access the availablePhoneNumbers. */ availablePhoneNumbers(): AvailablePhoneNumberCountryListInstance; /** * Access the balance. */ balance(): BalanceListInstance; /** * Access the calls. */ calls(): CallListInstance; /** * Access the conferences. */ conferences(): ConferenceListInstance; /** * Access the connectApps. */ connectApps(): ConnectAppListInstance; /** * Access the incomingPhoneNumbers. */ incomingPhoneNumbers(): IncomingPhoneNumberListInstance; /** * Access the keys. */ keys(): KeyListInstance; /** * Access the messages. */ messages(): MessageListInstance; /** * Access the newKeys. */ newKeys(): NewKeyListInstance; /** * Access the newSigningKeys. */ newSigningKeys(): NewSigningKeyListInstance; /** * Access the notifications. */ notifications(): NotificationListInstance; /** * Access the outgoingCallerIds. */ outgoingCallerIds(): OutgoingCallerIdListInstance; /** * Access the queues. */ queues(): QueueListInstance; /** * Access the recordings. */ recordings(): RecordingListInstance; /** * Access the shortCodes. */ shortCodes(): ShortCodeListInstance; /** * Access the signingKeys. */ signingKeys(): SigningKeyListInstance; /** * Access the sip. */ sip(): SipListInstance; /** * Access the tokens. */ tokens(): TokenListInstance; /** * Access the transcriptions. */ transcriptions(): TranscriptionListInstance; /** * Access the usage. */ usage(): UsageListInstance; /** * Access the validationRequests. */ validationRequests(): ValidationRequestListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { authToken: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; ownerAccountSid: string; sid: string; status: AccountStatus; subresourceUris: Record<string, string>; type: AccountType; uri: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AccountSolution { } export interface AccountListInstance { _version: V2010; _solution: AccountSolution; _uri: string; (sid: string): AccountContext; get(sid: string): AccountContext; /** * Create a AccountInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountInstance */ create(callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; /** * Create a AccountInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountInstance */ create(params: AccountListInstanceCreateOptions, callback?: (error: Error | null, item?: AccountInstance) => any): Promise<AccountInstance>; /** * Streams AccountInstance 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 { AccountListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AccountInstance, done: (err?: Error) => void) => void): void; each(params: AccountListInstanceEachOptions, callback?: (item: AccountInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AccountInstance 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: AccountPage) => any): Promise<AccountPage>; /** * Lists AccountInstance 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 { AccountListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AccountInstance[]) => any): Promise<AccountInstance[]>; list(params: AccountListInstanceOptions, callback?: (error: Error | null, items: AccountInstance[]) => any): Promise<AccountInstance[]>; /** * Retrieve a single page of AccountInstance 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 { AccountListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AccountPage) => any): Promise<AccountPage>; page(params: AccountListInstancePageOptions, callback?: (error: Error | null, items: AccountPage) => any): Promise<AccountPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AccountListInstance(version: V2010): AccountListInstance; export declare class AccountPage extends Page<V2010, AccountPayload, AccountResource, AccountInstance> { /** * Initialize the AccountPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2010, response: Response<string>, solution: AccountSolution); /** * Build an instance of AccountInstance * * @param payload - Payload response from the API */ getInstance(payload: AccountResource): AccountInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/api/V2010.js000064400000002706151677225100007353 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Api * 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 account_1 = require("./v2010/account"); class V2010 extends Version_1.default { /** * Initialize the V2010 version of Api * * @param domain - The Twilio (Twilio.Api) domain */ constructor(domain) { super(domain, "2010-04-01"); } /** Getter for accounts resource */ get accounts() { this._accounts = this._accounts || (0, account_1.AccountListInstance)(this); return this._accounts; } /** Getter for account resource */ get account() { this._account = this._account || (0, account_1.AccountListInstance)(this)(this.domain.twilio.accountSid); return this._account; } } exports.default = V2010; rest/api/V2010.d.ts000064400000001373151677225100007606 0ustar00import ApiBase from "../ApiBase"; import Version from "../../base/Version"; import { AccountListInstance } from "./v2010/account"; import { AccountContext } from "./v2010/account"; export default class V2010 extends Version { /** * Initialize the V2010 version of Api * * @param domain - The Twilio (Twilio.Api) domain */ constructor(domain: ApiBase); /** accounts - { Twilio.Api.V2010.AccountListInstance } resource */ protected _accounts?: AccountListInstance; /** account - { Twilio.Api.V2010.AccountContext } resource */ protected _account?: AccountContext; /** Getter for accounts resource */ get accounts(): AccountListInstance; /** Getter for account resource */ get account(): AccountContext; } rest/Content.js000064400000000747151677225100007507 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const ContentBase_1 = __importDefault(require("./ContentBase")); class Content extends ContentBase_1.default { /** * @deprecated - Use v1.contents instead */ get contents() { console.warn("contents is deprecated. Use v1.contents instead."); return this.v1.contents; } } module.exports = Content; rest/WirelessBase.d.ts000064400000000452151677225100010712 0ustar00import Domain from "../base/Domain"; import V1 from "./wireless/V1"; declare class WirelessBase extends Domain { _v1?: V1; /** * Initialize wireless domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = WirelessBase; rest/IpMessagingBase.js000064400000002332151677225100011066 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./ipMessaging/V1")); const V2_1 = __importDefault(require("./ipMessaging/V2")); class IpMessagingBase extends Domain_1.default { /** * Initialize ipMessaging domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://ip-messaging.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = IpMessagingBase; rest/RoutesBase.js000064400000002040151677225100010135 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V2_1 = __importDefault(require("./routes/V2")); class RoutesBase extends Domain_1.default { /** * Initialize routes domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://routes.twilio.com"); } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = RoutesBase; rest/RoutesBase.d.ts000064400000000442151677225100010375 0ustar00import Domain from "../base/Domain"; import V2 from "./routes/V2"; declare class RoutesBase extends Domain { _v2?: V2; /** * Initialize routes domain * * @param twilio - The twilio client */ constructor(twilio: any); get v2(): V2; } export = RoutesBase; rest/Api.js000064400000013237151677225100006604 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const ApiBase_1 = __importDefault(require("./ApiBase")); class Api extends ApiBase_1.default { get account() { return this.v2010.account; } get accounts() { return this.v2010.accounts; } /** * @deprecated - Use account.addresses instead */ get addresses() { console.warn("addresses is deprecated. Use account.addresses instead."); return this.account.addresses; } /** * @deprecated - Use account.applications instead */ get applications() { console.warn("applications is deprecated. Use account.applications instead."); return this.account.applications; } /** * @deprecated - Use account.authorizedConnectApps instead */ get authorizedConnectApps() { console.warn("authorizedConnectApps is deprecated. Use account.authorizedConnectApps instead."); return this.account.authorizedConnectApps; } /** * @deprecated - Use account.availablePhoneNumbers instead */ get availablePhoneNumbers() { console.warn("availablePhoneNumbers is deprecated. Use account.availablePhoneNumbers instead."); return this.account.availablePhoneNumbers; } /** * @deprecated - Use account.balance instead */ get balance() { console.warn("balance is deprecated. Use account.balance instead."); return this.account.balance; } /** * @deprecated - Use account.calls instead */ get calls() { console.warn("calls is deprecated. Use account.calls instead."); return this.account.calls; } /** * @deprecated - Use account.conferences instead */ get conferences() { console.warn("conferences is deprecated. Use account.conferences instead."); return this.account.conferences; } /** * @deprecated - Use account.connectApps instead */ get connectApps() { console.warn("connectApps is deprecated. Use account.connectApps instead."); return this.account.connectApps; } /** * @deprecated - Use account.incomingPhoneNumbers instead */ get incomingPhoneNumbers() { console.warn("incomingPhoneNumbers is deprecated. Use account.incomingPhoneNumbers instead."); return this.account.incomingPhoneNumbers; } /** * @deprecated - Use account.keys instead */ get keys() { console.warn("keys is deprecated. Use account.keys instead."); return this.account.keys; } /** * @deprecated - Use account.messages instead */ get messages() { console.warn("messages is deprecated. Use account.messages instead."); return this.account.messages; } /** * @deprecated - Use account.newKeys instead */ get newKeys() { console.warn("newKeys is deprecated. Use account.newKeys instead."); return this.account.newKeys; } /** * @deprecated - Use account.newSigningKeys instead */ get newSigningKeys() { console.warn("newSigningKeys is deprecated. Use account.newSigningKeys instead."); return this.account.newSigningKeys; } /** * @deprecated - Use account.notifications instead */ get notifications() { console.warn("notifications is deprecated. Use account.notifications instead."); return this.account.notifications; } /** * @deprecated - Use account.outgoingCallerIds instead */ get outgoingCallerIds() { console.warn("outgoingCallerIds is deprecated. Use account.outgoingCallerIds instead."); return this.account.outgoingCallerIds; } /** * @deprecated - Use account.queues instead */ get queues() { console.warn("queues is deprecated. Use account.queues instead."); return this.account.queues; } /** * @deprecated - Use account.recordings instead */ get recordings() { console.warn("recordings is deprecated. Use account.recordings instead."); return this.account.recordings; } /** * @deprecated - Use account.signingKeys instead */ get signingKeys() { console.warn("signingKeys is deprecated. Use account.signingKeys instead."); return this.account.signingKeys; } /** * @deprecated - Use account.sip instead */ get sip() { console.warn("sip is deprecated. Use account.sip instead."); return this.account.sip; } /** * @deprecated - Use account.shortCodes instead */ get shortCodes() { console.warn("shortCodes is deprecated. Use account.shortCodes instead."); return this.account.shortCodes; } /** * @deprecated - Use account.tokens instead */ get tokens() { console.warn("tokens is deprecated. Use account.tokens instead."); return this.account.tokens; } /** * @deprecated - Use account.transcriptions instead */ get transcriptions() { console.warn("transcriptions is deprecated. Use account.transcriptions instead."); return this.account.transcriptions; } /** * @deprecated - Use account.usage instead */ get usage() { console.warn("usage is deprecated. Use account.usage instead."); return this.account.usage; } /** * @deprecated - Use account.validationRequests instead */ get validationRequests() { console.warn("validationRequests is deprecated. Use account.validationRequests instead."); return this.account.validationRequests; } } module.exports = Api; rest/Intelligence.d.ts000064400000000202151677225100010715 0ustar00import IntelligenceBase from "./IntelligenceBase"; declare class Intelligence extends IntelligenceBase { } export = Intelligence; rest/BulkexportsBase.js000064400000002071151677225100011202 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./bulkexports/V1")); class BulkexportsBase extends Domain_1.default { /** * Initialize bulkexports domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://bulkexports.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = BulkexportsBase; rest/LookupsBase.js000064400000002301151677225100010310 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./lookups/V1")); const V2_1 = __importDefault(require("./lookups/V2")); class LookupsBase extends Domain_1.default { /** * Initialize lookups domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://lookups.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = LookupsBase; rest/Supersim.js000064400000004213151677225100007674 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const SupersimBase_1 = __importDefault(require("./SupersimBase")); class Supersim extends SupersimBase_1.default { /** * @deprecated - Use v1.esimProfiles instead */ get esimProfiles() { console.warn("esimProfiles is deprecated. Use v1.esimProfiles instead."); return this.v1.esimProfiles; } /** * @deprecated - Use v1.fleets instead */ get fleets() { console.warn("fleets is deprecated. Use v1.fleets instead."); return this.v1.fleets; } /** * @deprecated - Use v1.ipCommands instead */ get ipCommands() { console.warn("ipCommands is deprecated. Use v1.ipCommands instead."); return this.v1.ipCommands; } /** * @deprecated - Use v1.networks instead */ get networks() { console.warn("networks is deprecated. Use v1.networks instead."); return this.v1.networks; } /** * @deprecated - Use v1.settingsUpdates instead */ get settingsUpdates() { console.warn("settingsUpdates is deprecated. Use v1.settingsUpdates instead."); return this.v1.settingsUpdates; } /** * @deprecated - Use v1.networkAccessProfiles instead */ get networkAccessProfiles() { console.warn("networkAccessProfiles is deprecated. Use v1.networkAccessProfiles instead."); return this.v1.networkAccessProfiles; } /** * @deprecated - Use v1.sims instead */ get sims() { console.warn("sims is deprecated. Use v1.sims instead."); return this.v1.sims; } /** * @deprecated - Use v1.smsCommands instead */ get smsCommands() { console.warn("smsCommands is deprecated. Use v1.smsCommands instead."); return this.v1.smsCommands; } /** * @deprecated - Use v1.usageRecords instead */ get usageRecords() { console.warn("usageRecords is deprecated. Use v1.usageRecords instead."); return this.v1.usageRecords; } } module.exports = Supersim; rest/MessagingBase.js000064400000002057151677225100010601 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./messaging/V1")); class MessagingBase extends Domain_1.default { /** * Initialize messaging domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://messaging.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = MessagingBase; rest/Monitor.js000064400000001226151677225100007515 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const MonitorBase_1 = __importDefault(require("./MonitorBase")); class Monitor extends MonitorBase_1.default { /** * @deprecated - Use v1.alerts instead */ get alerts() { console.warn("alerts is deprecated. Use v1.alerts instead."); return this.v1.alerts; } /** * @deprecated - Use v1.events instead */ get events() { console.warn("events is deprecated. Use v1.events instead."); return this.v1.events; } } module.exports = Monitor; rest/microvisor/V1.d.ts000064400000002561151677225100011007 0ustar00import MicrovisorBase from "../MicrovisorBase"; import Version from "../../base/Version"; import { AccountConfigListInstance } from "./v1/accountConfig"; import { AccountSecretListInstance } from "./v1/accountSecret"; import { AppListInstance } from "./v1/app"; import { DeviceListInstance } from "./v1/device"; export default class V1 extends Version { /** * Initialize the V1 version of Microvisor * * @param domain - The Twilio (Twilio.Microvisor) domain */ constructor(domain: MicrovisorBase); /** accountConfigs - { Twilio.Microvisor.V1.AccountConfigListInstance } resource */ protected _accountConfigs?: AccountConfigListInstance; /** accountSecrets - { Twilio.Microvisor.V1.AccountSecretListInstance } resource */ protected _accountSecrets?: AccountSecretListInstance; /** apps - { Twilio.Microvisor.V1.AppListInstance } resource */ protected _apps?: AppListInstance; /** devices - { Twilio.Microvisor.V1.DeviceListInstance } resource */ protected _devices?: DeviceListInstance; /** Getter for accountConfigs resource */ get accountConfigs(): AccountConfigListInstance; /** Getter for accountSecrets resource */ get accountSecrets(): AccountSecretListInstance; /** Getter for apps resource */ get apps(): AppListInstance; /** Getter for devices resource */ get devices(): DeviceListInstance; } rest/microvisor/v1/device/deviceConfig.js000064400000023122151677225100014433 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Microvisor * 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.DeviceConfigPage = exports.DeviceConfigListInstance = exports.DeviceConfigInstance = exports.DeviceConfigContextImpl = void 0; 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 DeviceConfigContextImpl { constructor(_version, deviceSid, key) { this._version = _version; if (!(0, utility_1.isValidPathParam)(deviceSid)) { throw new Error("Parameter 'deviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(key)) { throw new Error("Parameter 'key' is not valid."); } this._solution = { deviceSid, key }; this._uri = `/Devices/${deviceSid}/Configs/${key}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DeviceConfigInstance(operationVersion, payload, instance._solution.deviceSid, instance._solution.key)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["value"] === null || params["value"] === undefined) { throw new Error("Required parameter \"params['value']\" missing."); } let data = {}; data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeviceConfigInstance(operationVersion, payload, instance._solution.deviceSid, instance._solution.key)); 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.DeviceConfigContextImpl = DeviceConfigContextImpl; class DeviceConfigInstance { constructor(_version, payload, deviceSid, key) { this._version = _version; this.deviceSid = payload.device_sid; this.key = payload.key; this.value = payload.value; this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { deviceSid, key: key || this.key }; } get _proxy() { this._context = this._context || new DeviceConfigContextImpl(this._version, this._solution.deviceSid, this._solution.key); return this._context; } /** * Remove a DeviceConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DeviceConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceConfigInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { deviceSid: this.deviceSid, key: this.key, value: this.value, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeviceConfigInstance = DeviceConfigInstance; function DeviceConfigListInstance(version, deviceSid) { if (!(0, utility_1.isValidPathParam)(deviceSid)) { throw new Error("Parameter 'deviceSid' is not valid."); } const instance = ((key) => instance.get(key)); instance.get = function get(key) { return new DeviceConfigContextImpl(version, deviceSid, key); }; instance._version = version; instance._solution = { deviceSid }; instance._uri = `/Devices/${deviceSid}/Configs`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["key"] === null || params["key"] === undefined) { throw new Error("Required parameter \"params['key']\" missing."); } if (params["value"] === null || params["value"] === undefined) { throw new Error("Required parameter \"params['value']\" missing."); } let data = {}; data["Key"] = params["key"]; data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeviceConfigInstance(operationVersion, payload, instance._solution.deviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DeviceConfigPage(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 DeviceConfigPage(instance._version, payload, 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; } exports.DeviceConfigListInstance = DeviceConfigListInstance; class DeviceConfigPage extends Page_1.default { /** * Initialize the DeviceConfigPage * * @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 DeviceConfigInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DeviceConfigInstance(this._version, payload, this._solution.deviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeviceConfigPage = DeviceConfigPage; rest/microvisor/v1/device/deviceSecret.d.ts000064400000024005151677225100014710 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to update a DeviceSecretInstance */ export interface DeviceSecretContextUpdateOptions { /** The secret value; up to 4096 characters. */ value: string; } /** * Options to pass to create a DeviceSecretInstance */ export interface DeviceSecretListInstanceCreateOptions { /** The secret key; up to 100 characters. */ key: string; /** The secret value; up to 4096 characters. */ value: string; } /** * Options to pass to each */ export interface DeviceSecretListInstanceEachOptions { /** 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: DeviceSecretInstance, 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 DeviceSecretListInstanceOptions { /** 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 DeviceSecretListInstancePageOptions { /** 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 DeviceSecretContext { /** * Remove a DeviceSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DeviceSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceSecretInstance */ fetch(callback?: (error: Error | null, item?: DeviceSecretInstance) => any): Promise<DeviceSecretInstance>; /** * Update a DeviceSecretInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceSecretInstance */ update(params: DeviceSecretContextUpdateOptions, callback?: (error: Error | null, item?: DeviceSecretInstance) => any): Promise<DeviceSecretInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DeviceSecretContextSolution { deviceSid: string; key: string; } export declare class DeviceSecretContextImpl implements DeviceSecretContext { protected _version: V1; protected _solution: DeviceSecretContextSolution; protected _uri: string; constructor(_version: V1, deviceSid: string, key: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DeviceSecretInstance) => any): Promise<DeviceSecretInstance>; update(params: DeviceSecretContextUpdateOptions, callback?: (error: Error | null, item?: DeviceSecretInstance) => any): Promise<DeviceSecretInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DeviceSecretContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DeviceSecretPayload extends TwilioResponsePayload { secrets: DeviceSecretResource[]; } interface DeviceSecretResource { device_sid: string; key: string; date_rotated: Date; url: string; } export declare class DeviceSecretInstance { protected _version: V1; protected _solution: DeviceSecretContextSolution; protected _context?: DeviceSecretContext; constructor(_version: V1, payload: DeviceSecretResource, deviceSid: string, key?: string); /** * A 34-character string that uniquely identifies the parent Device. */ deviceSid: string; /** * The secret key; up to 100 characters. */ key: string; dateRotated: Date; /** * The absolute URL of the Secret. */ url: string; private get _proxy(); /** * Remove a DeviceSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DeviceSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceSecretInstance */ fetch(callback?: (error: Error | null, item?: DeviceSecretInstance) => any): Promise<DeviceSecretInstance>; /** * Update a DeviceSecretInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceSecretInstance */ update(params: DeviceSecretContextUpdateOptions, callback?: (error: Error | null, item?: DeviceSecretInstance) => any): Promise<DeviceSecretInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { deviceSid: string; key: string; dateRotated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DeviceSecretSolution { deviceSid: string; } export interface DeviceSecretListInstance { _version: V1; _solution: DeviceSecretSolution; _uri: string; (key: string): DeviceSecretContext; get(key: string): DeviceSecretContext; /** * Create a DeviceSecretInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceSecretInstance */ create(params: DeviceSecretListInstanceCreateOptions, callback?: (error: Error | null, item?: DeviceSecretInstance) => any): Promise<DeviceSecretInstance>; /** * Streams DeviceSecretInstance 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 { DeviceSecretListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DeviceSecretInstance, done: (err?: Error) => void) => void): void; each(params: DeviceSecretListInstanceEachOptions, callback?: (item: DeviceSecretInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DeviceSecretInstance 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: DeviceSecretPage) => any): Promise<DeviceSecretPage>; /** * Lists DeviceSecretInstance 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 { DeviceSecretListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DeviceSecretInstance[]) => any): Promise<DeviceSecretInstance[]>; list(params: DeviceSecretListInstanceOptions, callback?: (error: Error | null, items: DeviceSecretInstance[]) => any): Promise<DeviceSecretInstance[]>; /** * Retrieve a single page of DeviceSecretInstance 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 { DeviceSecretListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DeviceSecretPage) => any): Promise<DeviceSecretPage>; page(params: DeviceSecretListInstancePageOptions, callback?: (error: Error | null, items: DeviceSecretPage) => any): Promise<DeviceSecretPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DeviceSecretListInstance(version: V1, deviceSid: string): DeviceSecretListInstance; export declare class DeviceSecretPage extends Page<V1, DeviceSecretPayload, DeviceSecretResource, DeviceSecretInstance> { /** * Initialize the DeviceSecretPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DeviceSecretSolution); /** * Build an instance of DeviceSecretInstance * * @param payload - Payload response from the API */ getInstance(payload: DeviceSecretResource): DeviceSecretInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/microvisor/v1/device/deviceSecret.js000064400000023017151677225100014456 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Microvisor * 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.DeviceSecretPage = exports.DeviceSecretListInstance = exports.DeviceSecretInstance = exports.DeviceSecretContextImpl = void 0; 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 DeviceSecretContextImpl { constructor(_version, deviceSid, key) { this._version = _version; if (!(0, utility_1.isValidPathParam)(deviceSid)) { throw new Error("Parameter 'deviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(key)) { throw new Error("Parameter 'key' is not valid."); } this._solution = { deviceSid, key }; this._uri = `/Devices/${deviceSid}/Secrets/${key}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DeviceSecretInstance(operationVersion, payload, instance._solution.deviceSid, instance._solution.key)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["value"] === null || params["value"] === undefined) { throw new Error("Required parameter \"params['value']\" missing."); } let data = {}; data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeviceSecretInstance(operationVersion, payload, instance._solution.deviceSid, instance._solution.key)); 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.DeviceSecretContextImpl = DeviceSecretContextImpl; class DeviceSecretInstance { constructor(_version, payload, deviceSid, key) { this._version = _version; this.deviceSid = payload.device_sid; this.key = payload.key; this.dateRotated = deserialize.iso8601DateTime(payload.date_rotated); this.url = payload.url; this._solution = { deviceSid, key: key || this.key }; } get _proxy() { this._context = this._context || new DeviceSecretContextImpl(this._version, this._solution.deviceSid, this._solution.key); return this._context; } /** * Remove a DeviceSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DeviceSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceSecretInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { deviceSid: this.deviceSid, key: this.key, dateRotated: this.dateRotated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeviceSecretInstance = DeviceSecretInstance; function DeviceSecretListInstance(version, deviceSid) { if (!(0, utility_1.isValidPathParam)(deviceSid)) { throw new Error("Parameter 'deviceSid' is not valid."); } const instance = ((key) => instance.get(key)); instance.get = function get(key) { return new DeviceSecretContextImpl(version, deviceSid, key); }; instance._version = version; instance._solution = { deviceSid }; instance._uri = `/Devices/${deviceSid}/Secrets`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["key"] === null || params["key"] === undefined) { throw new Error("Required parameter \"params['key']\" missing."); } if (params["value"] === null || params["value"] === undefined) { throw new Error("Required parameter \"params['value']\" missing."); } let data = {}; data["Key"] = params["key"]; data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeviceSecretInstance(operationVersion, payload, instance._solution.deviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DeviceSecretPage(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 DeviceSecretPage(instance._version, payload, 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; } exports.DeviceSecretListInstance = DeviceSecretListInstance; class DeviceSecretPage extends Page_1.default { /** * Initialize the DeviceSecretPage * * @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 DeviceSecretInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DeviceSecretInstance(this._version, payload, this._solution.deviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeviceSecretPage = DeviceSecretPage; rest/microvisor/v1/device/deviceConfig.d.ts000064400000024202151677225100014667 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to update a DeviceConfigInstance */ export interface DeviceConfigContextUpdateOptions { /** The config value; up to 4096 characters. */ value: string; } /** * Options to pass to create a DeviceConfigInstance */ export interface DeviceConfigListInstanceCreateOptions { /** The config key; up to 100 characters. */ key: string; /** The config value; up to 4096 characters. */ value: string; } /** * Options to pass to each */ export interface DeviceConfigListInstanceEachOptions { /** 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: DeviceConfigInstance, 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 DeviceConfigListInstanceOptions { /** 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 DeviceConfigListInstancePageOptions { /** 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 DeviceConfigContext { /** * Remove a DeviceConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DeviceConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceConfigInstance */ fetch(callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>; /** * Update a DeviceConfigInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceConfigInstance */ update(params: DeviceConfigContextUpdateOptions, callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DeviceConfigContextSolution { deviceSid: string; key: string; } export declare class DeviceConfigContextImpl implements DeviceConfigContext { protected _version: V1; protected _solution: DeviceConfigContextSolution; protected _uri: string; constructor(_version: V1, deviceSid: string, key: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>; update(params: DeviceConfigContextUpdateOptions, callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DeviceConfigContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DeviceConfigPayload extends TwilioResponsePayload { configs: DeviceConfigResource[]; } interface DeviceConfigResource { device_sid: string; key: string; value: string; date_updated: Date; url: string; } export declare class DeviceConfigInstance { protected _version: V1; protected _solution: DeviceConfigContextSolution; protected _context?: DeviceConfigContext; constructor(_version: V1, payload: DeviceConfigResource, deviceSid: string, key?: string); /** * A 34-character string that uniquely identifies the parent Device. */ deviceSid: string; /** * The config key; up to 100 characters. */ key: string; /** * The config value; up to 4096 characters. */ value: string; dateUpdated: Date; /** * The absolute URL of the Config. */ url: string; private get _proxy(); /** * Remove a DeviceConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DeviceConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceConfigInstance */ fetch(callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>; /** * Update a DeviceConfigInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceConfigInstance */ update(params: DeviceConfigContextUpdateOptions, callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { deviceSid: string; key: string; value: string; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DeviceConfigSolution { deviceSid: string; } export interface DeviceConfigListInstance { _version: V1; _solution: DeviceConfigSolution; _uri: string; (key: string): DeviceConfigContext; get(key: string): DeviceConfigContext; /** * Create a DeviceConfigInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceConfigInstance */ create(params: DeviceConfigListInstanceCreateOptions, callback?: (error: Error | null, item?: DeviceConfigInstance) => any): Promise<DeviceConfigInstance>; /** * Streams DeviceConfigInstance 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 { DeviceConfigListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DeviceConfigInstance, done: (err?: Error) => void) => void): void; each(params: DeviceConfigListInstanceEachOptions, callback?: (item: DeviceConfigInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DeviceConfigInstance 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: DeviceConfigPage) => any): Promise<DeviceConfigPage>; /** * Lists DeviceConfigInstance 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 { DeviceConfigListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DeviceConfigInstance[]) => any): Promise<DeviceConfigInstance[]>; list(params: DeviceConfigListInstanceOptions, callback?: (error: Error | null, items: DeviceConfigInstance[]) => any): Promise<DeviceConfigInstance[]>; /** * Retrieve a single page of DeviceConfigInstance 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 { DeviceConfigListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DeviceConfigPage) => any): Promise<DeviceConfigPage>; page(params: DeviceConfigListInstancePageOptions, callback?: (error: Error | null, items: DeviceConfigPage) => any): Promise<DeviceConfigPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DeviceConfigListInstance(version: V1, deviceSid: string): DeviceConfigListInstance; export declare class DeviceConfigPage extends Page<V1, DeviceConfigPayload, DeviceConfigResource, DeviceConfigInstance> { /** * Initialize the DeviceConfigPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DeviceConfigSolution); /** * Build an instance of DeviceConfigInstance * * @param payload - Payload response from the API */ getInstance(payload: DeviceConfigResource): DeviceConfigInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/microvisor/v1/device.d.ts000064400000026237151677225100012314 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { DeviceConfigListInstance } from "./device/deviceConfig"; import { DeviceSecretListInstance } from "./device/deviceSecret"; /** * Options to pass to update a DeviceInstance */ export interface DeviceContextUpdateOptions { /** A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID. */ uniqueName?: string; /** The SID or unique name of the App to be targeted to the Device. */ targetApp?: string; /** A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours. */ loggingEnabled?: boolean; /** Set to true to restart the App running on the Device. */ restartApp?: boolean; } /** * Options to pass to each */ export interface DeviceListInstanceEachOptions { /** 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: DeviceInstance, 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 DeviceListInstanceOptions { /** 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 DeviceListInstancePageOptions { /** 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 DeviceContext { deviceConfigs: DeviceConfigListInstance; deviceSecrets: DeviceSecretListInstance; /** * Fetch a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ fetch(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Update a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ update(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Update a DeviceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ update(params: DeviceContextUpdateOptions, callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DeviceContextSolution { sid: string; } export declare class DeviceContextImpl implements DeviceContext { protected _version: V1; protected _solution: DeviceContextSolution; protected _uri: string; protected _deviceConfigs?: DeviceConfigListInstance; protected _deviceSecrets?: DeviceSecretListInstance; constructor(_version: V1, sid: string); get deviceConfigs(): DeviceConfigListInstance; get deviceSecrets(): DeviceSecretListInstance; fetch(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; update(params?: DeviceContextUpdateOptions | ((error: Error | null, item?: DeviceInstance) => any), callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DeviceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DevicePayload extends TwilioResponsePayload { devices: DeviceResource[]; } interface DeviceResource { sid: string; unique_name: string; account_sid: string; app: any; logging: any; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class DeviceInstance { protected _version: V1; protected _solution: DeviceContextSolution; protected _context?: DeviceContext; constructor(_version: V1, payload: DeviceResource, sid?: string); /** * A 34-character string that uniquely identifies this Device. */ sid: string; /** * A developer-defined string that uniquely identifies the Device. This value must be unique for all Devices on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. */ uniqueName: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * Information about the target App and the App reported by this Device. Contains the properties `target_sid`, `date_targeted`, `update_status` (one of `up-to-date`, `pending` and `error`), `update_error_code`, `reported_sid` and `date_reported`. */ app: any; /** * Object specifying whether application logging is enabled for this Device. Contains the properties `enabled` and `date_expires`. */ logging: any; /** * The date that this Device was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date that this Device was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The URL of this resource. */ url: string; /** * The absolute URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ fetch(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Update a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ update(callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Update a DeviceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ update(params: DeviceContextUpdateOptions, callback?: (error: Error | null, item?: DeviceInstance) => any): Promise<DeviceInstance>; /** * Access the deviceConfigs. */ deviceConfigs(): DeviceConfigListInstance; /** * Access the deviceSecrets. */ deviceSecrets(): DeviceSecretListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; app: any; logging: any; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DeviceSolution { } export interface DeviceListInstance { _version: V1; _solution: DeviceSolution; _uri: string; (sid: string): DeviceContext; get(sid: string): DeviceContext; /** * Streams DeviceInstance 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 { DeviceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DeviceInstance, done: (err?: Error) => void) => void): void; each(params: DeviceListInstanceEachOptions, callback?: (item: DeviceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DeviceInstance 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: DevicePage) => any): Promise<DevicePage>; /** * Lists DeviceInstance 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 { DeviceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DeviceInstance[]) => any): Promise<DeviceInstance[]>; list(params: DeviceListInstanceOptions, callback?: (error: Error | null, items: DeviceInstance[]) => any): Promise<DeviceInstance[]>; /** * Retrieve a single page of DeviceInstance 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 { DeviceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DevicePage) => any): Promise<DevicePage>; page(params: DeviceListInstancePageOptions, callback?: (error: Error | null, items: DevicePage) => any): Promise<DevicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DeviceListInstance(version: V1): DeviceListInstance; export declare class DevicePage extends Page<V1, DevicePayload, DeviceResource, DeviceInstance> { /** * Initialize the DevicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DeviceSolution); /** * Build an instance of DeviceInstance * * @param payload - Payload response from the API */ getInstance(payload: DeviceResource): DeviceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/microvisor/v1/accountConfig.d.ts000064400000023710151677225100013630 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to update a AccountConfigInstance */ export interface AccountConfigContextUpdateOptions { /** The config value; up to 4096 characters. */ value: string; } /** * Options to pass to create a AccountConfigInstance */ export interface AccountConfigListInstanceCreateOptions { /** The config key; up to 100 characters. */ key: string; /** The config value; up to 4096 characters. */ value: string; } /** * Options to pass to each */ export interface AccountConfigListInstanceEachOptions { /** 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: AccountConfigInstance, 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 AccountConfigListInstanceOptions { /** 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 AccountConfigListInstancePageOptions { /** 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 AccountConfigContext { /** * Remove a AccountConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AccountConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountConfigInstance */ fetch(callback?: (error: Error | null, item?: AccountConfigInstance) => any): Promise<AccountConfigInstance>; /** * Update a AccountConfigInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountConfigInstance */ update(params: AccountConfigContextUpdateOptions, callback?: (error: Error | null, item?: AccountConfigInstance) => any): Promise<AccountConfigInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AccountConfigContextSolution { key: string; } export declare class AccountConfigContextImpl implements AccountConfigContext { protected _version: V1; protected _solution: AccountConfigContextSolution; protected _uri: string; constructor(_version: V1, key: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AccountConfigInstance) => any): Promise<AccountConfigInstance>; update(params: AccountConfigContextUpdateOptions, callback?: (error: Error | null, item?: AccountConfigInstance) => any): Promise<AccountConfigInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AccountConfigContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AccountConfigPayload extends TwilioResponsePayload { configs: AccountConfigResource[]; } interface AccountConfigResource { key: string; date_updated: Date; value: string; url: string; } export declare class AccountConfigInstance { protected _version: V1; protected _solution: AccountConfigContextSolution; protected _context?: AccountConfigContext; constructor(_version: V1, payload: AccountConfigResource, key?: string); /** * The config key; up to 100 characters. */ key: string; dateUpdated: Date; /** * The config value; up to 4096 characters. */ value: string; /** * The absolute URL of the Config. */ url: string; private get _proxy(); /** * Remove a AccountConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AccountConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountConfigInstance */ fetch(callback?: (error: Error | null, item?: AccountConfigInstance) => any): Promise<AccountConfigInstance>; /** * Update a AccountConfigInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountConfigInstance */ update(params: AccountConfigContextUpdateOptions, callback?: (error: Error | null, item?: AccountConfigInstance) => any): Promise<AccountConfigInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { key: string; dateUpdated: Date; value: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AccountConfigSolution { } export interface AccountConfigListInstance { _version: V1; _solution: AccountConfigSolution; _uri: string; (key: string): AccountConfigContext; get(key: string): AccountConfigContext; /** * Create a AccountConfigInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountConfigInstance */ create(params: AccountConfigListInstanceCreateOptions, callback?: (error: Error | null, item?: AccountConfigInstance) => any): Promise<AccountConfigInstance>; /** * Streams AccountConfigInstance 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 { AccountConfigListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AccountConfigInstance, done: (err?: Error) => void) => void): void; each(params: AccountConfigListInstanceEachOptions, callback?: (item: AccountConfigInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AccountConfigInstance 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: AccountConfigPage) => any): Promise<AccountConfigPage>; /** * Lists AccountConfigInstance 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 { AccountConfigListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AccountConfigInstance[]) => any): Promise<AccountConfigInstance[]>; list(params: AccountConfigListInstanceOptions, callback?: (error: Error | null, items: AccountConfigInstance[]) => any): Promise<AccountConfigInstance[]>; /** * Retrieve a single page of AccountConfigInstance 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 { AccountConfigListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AccountConfigPage) => any): Promise<AccountConfigPage>; page(params: AccountConfigListInstancePageOptions, callback?: (error: Error | null, items: AccountConfigPage) => any): Promise<AccountConfigPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AccountConfigListInstance(version: V1): AccountConfigListInstance; export declare class AccountConfigPage extends Page<V1, AccountConfigPayload, AccountConfigResource, AccountConfigInstance> { /** * Initialize the AccountConfigPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AccountConfigSolution); /** * Build an instance of AccountConfigInstance * * @param payload - Payload response from the API */ getInstance(payload: AccountConfigResource): AccountConfigInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/microvisor/v1/accountConfig.js000064400000022004151677225100013367 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Microvisor * 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.AccountConfigPage = exports.AccountConfigListInstance = exports.AccountConfigInstance = exports.AccountConfigContextImpl = void 0; 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 AccountConfigContextImpl { constructor(_version, key) { this._version = _version; if (!(0, utility_1.isValidPathParam)(key)) { throw new Error("Parameter 'key' is not valid."); } this._solution = { key }; this._uri = `/Configs/${key}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AccountConfigInstance(operationVersion, payload, instance._solution.key)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["value"] === null || params["value"] === undefined) { throw new Error("Required parameter \"params['value']\" missing."); } let data = {}; data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AccountConfigInstance(operationVersion, payload, instance._solution.key)); 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.AccountConfigContextImpl = AccountConfigContextImpl; class AccountConfigInstance { constructor(_version, payload, key) { this._version = _version; this.key = payload.key; this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.value = payload.value; this.url = payload.url; this._solution = { key: key || this.key }; } get _proxy() { this._context = this._context || new AccountConfigContextImpl(this._version, this._solution.key); return this._context; } /** * Remove a AccountConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AccountConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountConfigInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { key: this.key, dateUpdated: this.dateUpdated, value: this.value, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AccountConfigInstance = AccountConfigInstance; function AccountConfigListInstance(version) { const instance = ((key) => instance.get(key)); instance.get = function get(key) { return new AccountConfigContextImpl(version, key); }; instance._version = version; instance._solution = {}; instance._uri = `/Configs`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["key"] === null || params["key"] === undefined) { throw new Error("Required parameter \"params['key']\" missing."); } if (params["value"] === null || params["value"] === undefined) { throw new Error("Required parameter \"params['value']\" missing."); } let data = {}; data["Key"] = params["key"]; data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AccountConfigInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AccountConfigPage(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 AccountConfigPage(instance._version, payload, 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; } exports.AccountConfigListInstance = AccountConfigListInstance; class AccountConfigPage extends Page_1.default { /** * Initialize the AccountConfigPage * * @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 AccountConfigInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AccountConfigInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AccountConfigPage = AccountConfigPage; rest/microvisor/v1/accountSecret.js000064400000021701151677225100013412 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Microvisor * 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.AccountSecretPage = exports.AccountSecretListInstance = exports.AccountSecretInstance = exports.AccountSecretContextImpl = void 0; 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 AccountSecretContextImpl { constructor(_version, key) { this._version = _version; if (!(0, utility_1.isValidPathParam)(key)) { throw new Error("Parameter 'key' is not valid."); } this._solution = { key }; this._uri = `/Secrets/${key}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AccountSecretInstance(operationVersion, payload, instance._solution.key)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["value"] === null || params["value"] === undefined) { throw new Error("Required parameter \"params['value']\" missing."); } let data = {}; data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AccountSecretInstance(operationVersion, payload, instance._solution.key)); 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.AccountSecretContextImpl = AccountSecretContextImpl; class AccountSecretInstance { constructor(_version, payload, key) { this._version = _version; this.key = payload.key; this.dateRotated = deserialize.iso8601DateTime(payload.date_rotated); this.url = payload.url; this._solution = { key: key || this.key }; } get _proxy() { this._context = this._context || new AccountSecretContextImpl(this._version, this._solution.key); return this._context; } /** * Remove a AccountSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AccountSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountSecretInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { key: this.key, dateRotated: this.dateRotated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AccountSecretInstance = AccountSecretInstance; function AccountSecretListInstance(version) { const instance = ((key) => instance.get(key)); instance.get = function get(key) { return new AccountSecretContextImpl(version, key); }; instance._version = version; instance._solution = {}; instance._uri = `/Secrets`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["key"] === null || params["key"] === undefined) { throw new Error("Required parameter \"params['key']\" missing."); } if (params["value"] === null || params["value"] === undefined) { throw new Error("Required parameter \"params['value']\" missing."); } let data = {}; data["Key"] = params["key"]; data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AccountSecretInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AccountSecretPage(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 AccountSecretPage(instance._version, payload, 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; } exports.AccountSecretListInstance = AccountSecretListInstance; class AccountSecretPage extends Page_1.default { /** * Initialize the AccountSecretPage * * @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 AccountSecretInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AccountSecretInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AccountSecretPage = AccountSecretPage; rest/microvisor/v1/app.js000064400000016407151677225100011377 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Microvisor * 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.AppPage = exports.AppListInstance = exports.AppInstance = exports.AppContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const appManifest_1 = require("./app/appManifest"); class AppContextImpl { 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 = `/Apps/${sid}`; } get appManifests() { this._appManifests = this._appManifests || (0, appManifest_1.AppManifestListInstance)(this._version, this._solution.sid); return this._appManifests; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AppInstance(operationVersion, payload, 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.AppContextImpl = AppContextImpl; class AppInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.hash = payload.hash; this.uniqueName = payload.unique_name; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AppContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a AppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AppInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the appManifests. */ appManifests() { return this._proxy.appManifests; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, hash: this.hash, uniqueName: this.uniqueName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AppInstance = AppInstance; function AppListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AppContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Apps`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AppPage(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 AppPage(instance._version, payload, 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; } exports.AppListInstance = AppListInstance; class AppPage extends Page_1.default { /** * Initialize the AppPage * * @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 AppInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AppInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AppPage = AppPage; rest/microvisor/v1/accountSecret.d.ts000064400000023513151677225100013651 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to update a AccountSecretInstance */ export interface AccountSecretContextUpdateOptions { /** The secret value; up to 4096 characters. */ value: string; } /** * Options to pass to create a AccountSecretInstance */ export interface AccountSecretListInstanceCreateOptions { /** The secret key; up to 100 characters. */ key: string; /** The secret value; up to 4096 characters. */ value: string; } /** * Options to pass to each */ export interface AccountSecretListInstanceEachOptions { /** 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: AccountSecretInstance, 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 AccountSecretListInstanceOptions { /** 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 AccountSecretListInstancePageOptions { /** 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 AccountSecretContext { /** * Remove a AccountSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AccountSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountSecretInstance */ fetch(callback?: (error: Error | null, item?: AccountSecretInstance) => any): Promise<AccountSecretInstance>; /** * Update a AccountSecretInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountSecretInstance */ update(params: AccountSecretContextUpdateOptions, callback?: (error: Error | null, item?: AccountSecretInstance) => any): Promise<AccountSecretInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AccountSecretContextSolution { key: string; } export declare class AccountSecretContextImpl implements AccountSecretContext { protected _version: V1; protected _solution: AccountSecretContextSolution; protected _uri: string; constructor(_version: V1, key: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AccountSecretInstance) => any): Promise<AccountSecretInstance>; update(params: AccountSecretContextUpdateOptions, callback?: (error: Error | null, item?: AccountSecretInstance) => any): Promise<AccountSecretInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AccountSecretContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AccountSecretPayload extends TwilioResponsePayload { secrets: AccountSecretResource[]; } interface AccountSecretResource { key: string; date_rotated: Date; url: string; } export declare class AccountSecretInstance { protected _version: V1; protected _solution: AccountSecretContextSolution; protected _context?: AccountSecretContext; constructor(_version: V1, payload: AccountSecretResource, key?: string); /** * The secret key; up to 100 characters. */ key: string; dateRotated: Date; /** * The absolute URL of the Secret. */ url: string; private get _proxy(); /** * Remove a AccountSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AccountSecretInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountSecretInstance */ fetch(callback?: (error: Error | null, item?: AccountSecretInstance) => any): Promise<AccountSecretInstance>; /** * Update a AccountSecretInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountSecretInstance */ update(params: AccountSecretContextUpdateOptions, callback?: (error: Error | null, item?: AccountSecretInstance) => any): Promise<AccountSecretInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { key: string; dateRotated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AccountSecretSolution { } export interface AccountSecretListInstance { _version: V1; _solution: AccountSecretSolution; _uri: string; (key: string): AccountSecretContext; get(key: string): AccountSecretContext; /** * Create a AccountSecretInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccountSecretInstance */ create(params: AccountSecretListInstanceCreateOptions, callback?: (error: Error | null, item?: AccountSecretInstance) => any): Promise<AccountSecretInstance>; /** * Streams AccountSecretInstance 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 { AccountSecretListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AccountSecretInstance, done: (err?: Error) => void) => void): void; each(params: AccountSecretListInstanceEachOptions, callback?: (item: AccountSecretInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AccountSecretInstance 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: AccountSecretPage) => any): Promise<AccountSecretPage>; /** * Lists AccountSecretInstance 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 { AccountSecretListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AccountSecretInstance[]) => any): Promise<AccountSecretInstance[]>; list(params: AccountSecretListInstanceOptions, callback?: (error: Error | null, items: AccountSecretInstance[]) => any): Promise<AccountSecretInstance[]>; /** * Retrieve a single page of AccountSecretInstance 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 { AccountSecretListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AccountSecretPage) => any): Promise<AccountSecretPage>; page(params: AccountSecretListInstancePageOptions, callback?: (error: Error | null, items: AccountSecretPage) => any): Promise<AccountSecretPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AccountSecretListInstance(version: V1): AccountSecretListInstance; export declare class AccountSecretPage extends Page<V1, AccountSecretPayload, AccountSecretResource, AccountSecretInstance> { /** * Initialize the AccountSecretPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AccountSecretSolution); /** * Build an instance of AccountSecretInstance * * @param payload - Payload response from the API */ getInstance(payload: AccountSecretResource): AccountSecretInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/microvisor/v1/device.js000064400000021113151677225100012044 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Microvisor * 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.DevicePage = exports.DeviceListInstance = exports.DeviceInstance = exports.DeviceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const deviceConfig_1 = require("./device/deviceConfig"); const deviceSecret_1 = require("./device/deviceSecret"); class DeviceContextImpl { 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 = `/Devices/${sid}`; } get deviceConfigs() { this._deviceConfigs = this._deviceConfigs || (0, deviceConfig_1.DeviceConfigListInstance)(this._version, this._solution.sid); return this._deviceConfigs; } get deviceSecrets() { this._deviceSecrets = this._deviceSecrets || (0, deviceSecret_1.DeviceSecretListInstance)(this._version, this._solution.sid); return this._deviceSecrets; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DeviceInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["targetApp"] !== undefined) data["TargetApp"] = params["targetApp"]; if (params["loggingEnabled"] !== undefined) data["LoggingEnabled"] = serialize.bool(params["loggingEnabled"]); if (params["restartApp"] !== undefined) data["RestartApp"] = serialize.bool(params["restartApp"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeviceInstance(operationVersion, payload, 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.DeviceContextImpl = DeviceContextImpl; class DeviceInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.app = payload.app; this.logging = payload.logging; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new DeviceContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a DeviceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeviceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the deviceConfigs. */ deviceConfigs() { return this._proxy.deviceConfigs; } /** * Access the deviceSecrets. */ deviceSecrets() { return this._proxy.deviceSecrets; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, app: this.app, logging: this.logging, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeviceInstance = DeviceInstance; function DeviceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new DeviceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Devices`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DevicePage(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 DevicePage(instance._version, payload, 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; } exports.DeviceListInstance = DeviceListInstance; class DevicePage extends Page_1.default { /** * Initialize the DevicePage * * @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 DeviceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DeviceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DevicePage = DevicePage; rest/microvisor/v1/app.d.ts000064400000021410151677225100011621 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { AppManifestListInstance } from "./app/appManifest"; /** * Options to pass to each */ export interface AppListInstanceEachOptions { /** 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: AppInstance, 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 AppListInstanceOptions { /** 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 AppListInstancePageOptions { /** 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 AppContext { appManifests: AppManifestListInstance; /** * Remove a AppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AppInstance */ fetch(callback?: (error: Error | null, item?: AppInstance) => any): Promise<AppInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AppContextSolution { sid: string; } export declare class AppContextImpl implements AppContext { protected _version: V1; protected _solution: AppContextSolution; protected _uri: string; protected _appManifests?: AppManifestListInstance; constructor(_version: V1, sid: string); get appManifests(): AppManifestListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AppInstance) => any): Promise<AppInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AppContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AppPayload extends TwilioResponsePayload { apps: AppResource[]; } interface AppResource { sid: string; account_sid: string; hash: string; unique_name: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class AppInstance { protected _version: V1; protected _solution: AppContextSolution; protected _context?: AppContext; constructor(_version: V1, payload: AppResource, sid?: string); /** * A 34-character string that uniquely identifies this App. */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * App manifest hash represented as `hash_algorithm:hash_value`. */ hash: string; /** * A developer-defined string that uniquely identifies the App. This value must be unique for all Apps on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. */ uniqueName: string; /** * The date that this App was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date that this App was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The URL of this resource. */ url: string; links: Record<string, string>; private get _proxy(); /** * Remove a AppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AppInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AppInstance */ fetch(callback?: (error: Error | null, item?: AppInstance) => any): Promise<AppInstance>; /** * Access the appManifests. */ appManifests(): AppManifestListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; hash: string; uniqueName: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AppSolution { } export interface AppListInstance { _version: V1; _solution: AppSolution; _uri: string; (sid: string): AppContext; get(sid: string): AppContext; /** * Streams AppInstance 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 { AppListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AppInstance, done: (err?: Error) => void) => void): void; each(params: AppListInstanceEachOptions, callback?: (item: AppInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AppInstance 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: AppPage) => any): Promise<AppPage>; /** * Lists AppInstance 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 { AppListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AppInstance[]) => any): Promise<AppInstance[]>; list(params: AppListInstanceOptions, callback?: (error: Error | null, items: AppInstance[]) => any): Promise<AppInstance[]>; /** * Retrieve a single page of AppInstance 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 { AppListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AppPage) => any): Promise<AppPage>; page(params: AppListInstancePageOptions, callback?: (error: Error | null, items: AppPage) => any): Promise<AppPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AppListInstance(version: V1): AppListInstance; export declare class AppPage extends Page<V1, AppPayload, AppResource, AppInstance> { /** * Initialize the AppPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AppSolution); /** * Build an instance of AppInstance * * @param payload - Payload response from the API */ getInstance(payload: AppResource): AppInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/microvisor/v1/app/appManifest.js000064400000007540151677225100013644 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Microvisor * 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.AppManifestListInstance = exports.AppManifestInstance = exports.AppManifestContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class AppManifestContextImpl { constructor(_version, appSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(appSid)) { throw new Error("Parameter 'appSid' is not valid."); } this._solution = { appSid }; this._uri = `/Apps/${appSid}/Manifest`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AppManifestInstance(operationVersion, payload, instance._solution.appSid)); 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.AppManifestContextImpl = AppManifestContextImpl; class AppManifestInstance { constructor(_version, payload, appSid) { this._version = _version; this.appSid = payload.app_sid; this.hash = payload.hash; this.encodedBytes = payload.encoded_bytes; this.url = payload.url; this._solution = { appSid }; } get _proxy() { this._context = this._context || new AppManifestContextImpl(this._version, this._solution.appSid); return this._context; } /** * Fetch a AppManifestInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AppManifestInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { appSid: this.appSid, hash: this.hash, encodedBytes: this.encodedBytes, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AppManifestInstance = AppManifestInstance; function AppManifestListInstance(version, appSid) { if (!(0, utility_1.isValidPathParam)(appSid)) { throw new Error("Parameter 'appSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new AppManifestContextImpl(version, appSid); }; instance._version = version; instance._solution = { appSid }; 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; } exports.AppManifestListInstance = AppManifestListInstance; rest/microvisor/v1/app/appManifest.d.ts000064400000005712151677225100014077 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export interface AppManifestContext { /** * Fetch a AppManifestInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AppManifestInstance */ fetch(callback?: (error: Error | null, item?: AppManifestInstance) => any): Promise<AppManifestInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AppManifestContextSolution { appSid: string; } export declare class AppManifestContextImpl implements AppManifestContext { protected _version: V1; protected _solution: AppManifestContextSolution; protected _uri: string; constructor(_version: V1, appSid: string); fetch(callback?: (error: Error | null, item?: AppManifestInstance) => any): Promise<AppManifestInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AppManifestContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AppManifestResource { app_sid: string; hash: string; encoded_bytes: string; url: string; } export declare class AppManifestInstance { protected _version: V1; protected _solution: AppManifestContextSolution; protected _context?: AppManifestContext; constructor(_version: V1, payload: AppManifestResource, appSid: string); /** * A 34-character string that uniquely identifies this App. */ appSid: string; /** * App manifest hash represented as `hash_algorithm:hash_value`. */ hash: string; /** * The base-64 encoded manifest */ encodedBytes: string; /** * The absolute URL of this Manifest. */ url: string; private get _proxy(); /** * Fetch a AppManifestInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AppManifestInstance */ fetch(callback?: (error: Error | null, item?: AppManifestInstance) => any): Promise<AppManifestInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { appSid: string; hash: string; encodedBytes: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AppManifestSolution { appSid: string; } export interface AppManifestListInstance { _version: V1; _solution: AppManifestSolution; _uri: string; (): AppManifestContext; get(): AppManifestContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AppManifestListInstance(version: V1, appSid: string): AppManifestListInstance; export {}; rest/microvisor/V1.js000064400000003747151677225100010562 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Microvisor * 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 accountConfig_1 = require("./v1/accountConfig"); const accountSecret_1 = require("./v1/accountSecret"); const app_1 = require("./v1/app"); const device_1 = require("./v1/device"); class V1 extends Version_1.default { /** * Initialize the V1 version of Microvisor * * @param domain - The Twilio (Twilio.Microvisor) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for accountConfigs resource */ get accountConfigs() { this._accountConfigs = this._accountConfigs || (0, accountConfig_1.AccountConfigListInstance)(this); return this._accountConfigs; } /** Getter for accountSecrets resource */ get accountSecrets() { this._accountSecrets = this._accountSecrets || (0, accountSecret_1.AccountSecretListInstance)(this); return this._accountSecrets; } /** Getter for apps resource */ get apps() { this._apps = this._apps || (0, app_1.AppListInstance)(this); return this._apps; } /** Getter for devices resource */ get devices() { this._devices = this._devices || (0, device_1.DeviceListInstance)(this); return this._devices; } } exports.default = V1; rest/StudioBase.js000064400000002273151677225100010133 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./studio/V1")); const V2_1 = __importDefault(require("./studio/V2")); class StudioBase extends Domain_1.default { /** * Initialize studio domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://studio.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = StudioBase; rest/conversations/V1.d.ts000064400000005242151677225100011507 0ustar00import ConversationsBase from "../ConversationsBase"; import Version from "../../base/Version"; import { AddressConfigurationListInstance } from "./v1/addressConfiguration"; import { ConfigurationListInstance } from "./v1/configuration"; import { ConversationListInstance } from "./v1/conversation"; import { CredentialListInstance } from "./v1/credential"; import { ParticipantConversationListInstance } from "./v1/participantConversation"; import { RoleListInstance } from "./v1/role"; import { ServiceListInstance } from "./v1/service"; import { UserListInstance } from "./v1/user"; export default class V1 extends Version { /** * Initialize the V1 version of Conversations * * @param domain - The Twilio (Twilio.Conversations) domain */ constructor(domain: ConversationsBase); /** addressConfigurations - { Twilio.Conversations.V1.AddressConfigurationListInstance } resource */ protected _addressConfigurations?: AddressConfigurationListInstance; /** configuration - { Twilio.Conversations.V1.ConfigurationListInstance } resource */ protected _configuration?: ConfigurationListInstance; /** conversations - { Twilio.Conversations.V1.ConversationListInstance } resource */ protected _conversations?: ConversationListInstance; /** credentials - { Twilio.Conversations.V1.CredentialListInstance } resource */ protected _credentials?: CredentialListInstance; /** participantConversations - { Twilio.Conversations.V1.ParticipantConversationListInstance } resource */ protected _participantConversations?: ParticipantConversationListInstance; /** roles - { Twilio.Conversations.V1.RoleListInstance } resource */ protected _roles?: RoleListInstance; /** services - { Twilio.Conversations.V1.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** users - { Twilio.Conversations.V1.UserListInstance } resource */ protected _users?: UserListInstance; /** Getter for addressConfigurations resource */ get addressConfigurations(): AddressConfigurationListInstance; /** Getter for configuration resource */ get configuration(): ConfigurationListInstance; /** Getter for conversations resource */ get conversations(): ConversationListInstance; /** Getter for credentials resource */ get credentials(): CredentialListInstance; /** Getter for participantConversations resource */ get participantConversations(): ParticipantConversationListInstance; /** Getter for roles resource */ get roles(): RoleListInstance; /** Getter for services resource */ get services(): ServiceListInstance; /** Getter for users resource */ get users(): UserListInstance; } rest/conversations/v1/user/userConversation.d.ts000064400000034034151677225100016077 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type UserConversationNotificationLevel = "default" | "muted"; export type UserConversationState = "inactive" | "active" | "closed"; /** * Options to pass to update a UserConversationInstance */ export interface UserConversationContextUpdateOptions { /** */ notificationLevel?: UserConversationNotificationLevel; /** The date of the last message read in conversation by the user, given in ISO 8601 format. */ lastReadTimestamp?: Date; /** The index of the last Message in the Conversation that the Participant has read. */ lastReadMessageIndex?: number; } /** * Options to pass to each */ export interface UserConversationListInstanceEachOptions { /** 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: UserConversationInstance, 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 UserConversationListInstanceOptions { /** 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 UserConversationListInstancePageOptions { /** 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 UserConversationContext { /** * Remove a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ fetch(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Update a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ update(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Update a UserConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ update(params: UserConversationContextUpdateOptions, callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserConversationContextSolution { userSid: string; conversationSid: string; } export declare class UserConversationContextImpl implements UserConversationContext { protected _version: V1; protected _solution: UserConversationContextSolution; protected _uri: string; constructor(_version: V1, userSid: string, conversationSid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; update(params?: UserConversationContextUpdateOptions | ((error: Error | null, item?: UserConversationInstance) => any), callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserConversationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserConversationPayload extends TwilioResponsePayload { conversations: UserConversationResource[]; } interface UserConversationResource { account_sid: string; chat_service_sid: string; conversation_sid: string; unread_messages_count: number; last_read_message_index: number; participant_sid: string; user_sid: string; friendly_name: string; conversation_state: UserConversationState; timers: any; attributes: string; date_created: Date; date_updated: Date; created_by: string; notification_level: UserConversationNotificationLevel; unique_name: string; url: string; links: Record<string, string>; } export declare class UserConversationInstance { protected _version: V1; protected _solution: UserConversationContextSolution; protected _context?: UserConversationContext; constructor(_version: V1, payload: UserConversationResource, userSid: string, conversationSid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. */ accountSid: string; /** * The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. */ chatServiceSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. */ conversationSid: string; /** * The number of unread Messages in the Conversation for the Participant. */ unreadMessagesCount: number; /** * The index of the last Message in the Conversation that the Participant has read. */ lastReadMessageIndex: number; /** * The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. */ participantSid: string; /** * The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). */ userSid: string; /** * The human-readable name of this conversation, limited to 256 characters. Optional. */ friendlyName: string; conversationState: UserConversationState; /** * Timer date values representing state update for this conversation. */ timers: any; /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. */ attributes: string; /** * The date that this conversation was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this conversation was last updated, given in ISO 8601 format. */ dateUpdated: Date; /** * Identity of the creator of this Conversation. */ createdBy: string; notificationLevel: UserConversationNotificationLevel; /** * An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource\'s `conversation_sid` in the URL. */ uniqueName: string; url: string; /** * Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. */ links: Record<string, string>; private get _proxy(); /** * Remove a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ fetch(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Update a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ update(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Update a UserConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ update(params: UserConversationContextUpdateOptions, callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; conversationSid: string; unreadMessagesCount: number; lastReadMessageIndex: number; participantSid: string; userSid: string; friendlyName: string; conversationState: UserConversationState; timers: any; attributes: string; dateCreated: Date; dateUpdated: Date; createdBy: string; notificationLevel: UserConversationNotificationLevel; uniqueName: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserConversationSolution { userSid: string; } export interface UserConversationListInstance { _version: V1; _solution: UserConversationSolution; _uri: string; (conversationSid: string): UserConversationContext; get(conversationSid: string): UserConversationContext; /** * Streams UserConversationInstance 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 { UserConversationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserConversationInstance, done: (err?: Error) => void) => void): void; each(params: UserConversationListInstanceEachOptions, callback?: (item: UserConversationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserConversationInstance 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: UserConversationPage) => any): Promise<UserConversationPage>; /** * Lists UserConversationInstance 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 { UserConversationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserConversationInstance[]) => any): Promise<UserConversationInstance[]>; list(params: UserConversationListInstanceOptions, callback?: (error: Error | null, items: UserConversationInstance[]) => any): Promise<UserConversationInstance[]>; /** * Retrieve a single page of UserConversationInstance 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 { UserConversationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserConversationPage) => any): Promise<UserConversationPage>; page(params: UserConversationListInstancePageOptions, callback?: (error: Error | null, items: UserConversationPage) => any): Promise<UserConversationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserConversationListInstance(version: V1, userSid: string): UserConversationListInstance; export declare class UserConversationPage extends Page<V1, UserConversationPayload, UserConversationResource, UserConversationInstance> { /** * Initialize the UserConversationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UserConversationSolution); /** * Build an instance of UserConversationInstance * * @param payload - Payload response from the API */ getInstance(payload: UserConversationResource): UserConversationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/user/userConversation.js000064400000024535151677225100015650 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.UserConversationPage = exports.UserConversationListInstance = exports.UserConversationInstance = exports.UserConversationContextImpl = void 0; 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 UserConversationContextImpl { constructor(_version, userSid, conversationSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } this._solution = { userSid, conversationSid }; this._uri = `/Users/${userSid}/Conversations/${conversationSid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserConversationInstance(operationVersion, payload, instance._solution.userSid, instance._solution.conversationSid)); 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["notificationLevel"] !== undefined) data["NotificationLevel"] = params["notificationLevel"]; if (params["lastReadTimestamp"] !== undefined) data["LastReadTimestamp"] = serialize.iso8601DateTime(params["lastReadTimestamp"]); if (params["lastReadMessageIndex"] !== undefined) data["LastReadMessageIndex"] = params["lastReadMessageIndex"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserConversationInstance(operationVersion, payload, instance._solution.userSid, instance._solution.conversationSid)); 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.UserConversationContextImpl = UserConversationContextImpl; class UserConversationInstance { constructor(_version, payload, userSid, conversationSid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.conversationSid = payload.conversation_sid; this.unreadMessagesCount = deserialize.integer(payload.unread_messages_count); this.lastReadMessageIndex = deserialize.integer(payload.last_read_message_index); this.participantSid = payload.participant_sid; this.userSid = payload.user_sid; this.friendlyName = payload.friendly_name; this.conversationState = payload.conversation_state; this.timers = payload.timers; this.attributes = payload.attributes; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this.notificationLevel = payload.notification_level; this.uniqueName = payload.unique_name; this.url = payload.url; this.links = payload.links; this._solution = { userSid, conversationSid: conversationSid || this.conversationSid, }; } get _proxy() { this._context = this._context || new UserConversationContextImpl(this._version, this._solution.userSid, this._solution.conversationSid); return this._context; } /** * Remove a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, conversationSid: this.conversationSid, unreadMessagesCount: this.unreadMessagesCount, lastReadMessageIndex: this.lastReadMessageIndex, participantSid: this.participantSid, userSid: this.userSid, friendlyName: this.friendlyName, conversationState: this.conversationState, timers: this.timers, attributes: this.attributes, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, notificationLevel: this.notificationLevel, uniqueName: this.uniqueName, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserConversationInstance = UserConversationInstance; function UserConversationListInstance(version, userSid) { if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } const instance = ((conversationSid) => instance.get(conversationSid)); instance.get = function get(conversationSid) { return new UserConversationContextImpl(version, userSid, conversationSid); }; instance._version = version; instance._solution = { userSid }; instance._uri = `/Users/${userSid}/Conversations`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserConversationPage(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 UserConversationPage(instance._version, payload, 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; } exports.UserConversationListInstance = UserConversationListInstance; class UserConversationPage extends Page_1.default { /** * Initialize the UserConversationPage * * @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 UserConversationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserConversationInstance(this._version, payload, this._solution.userSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserConversationPage = UserConversationPage; rest/conversations/v1/configuration/webhook.d.ts000064400000013272151677225100016056 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export type WebhookMethod = "GET" | "POST"; export type WebhookTarget = "webhook" | "flex"; /** * Options to pass to update a WebhookInstance */ export interface WebhookContextUpdateOptions { /** The HTTP method to be used when sending a webhook request. */ method?: string; /** The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` */ filters?: Array<string>; /** The absolute url the pre-event webhook request should be sent to. */ preWebhookUrl?: string; /** The absolute url the post-event webhook request should be sent to. */ postWebhookUrl?: string; /** */ target?: WebhookTarget; } export interface WebhookContext { /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WebhookContextSolution { } export declare class WebhookContextImpl implements WebhookContext { protected _version: V1; protected _solution: WebhookContextSolution; protected _uri: string; constructor(_version: V1); fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; update(params?: WebhookContextUpdateOptions | ((error: Error | null, item?: WebhookInstance) => any), callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WebhookContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WebhookResource { account_sid: string; method: WebhookMethod; filters: Array<string>; pre_webhook_url: string; post_webhook_url: string; target: WebhookTarget; url: string; } export declare class WebhookInstance { protected _version: V1; protected _solution: WebhookContextSolution; protected _context?: WebhookContext; constructor(_version: V1, payload: WebhookResource); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. */ accountSid: string; method: WebhookMethod; /** * The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` */ filters: Array<string>; /** * The absolute url the pre-event webhook request should be sent to. */ preWebhookUrl: string; /** * The absolute url the post-event webhook request should be sent to. */ postWebhookUrl: string; target: WebhookTarget; /** * An absolute API resource API resource URL for this webhook. */ url: string; private get _proxy(); /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; method: WebhookMethod; filters: string[]; preWebhookUrl: string; postWebhookUrl: string; target: WebhookTarget; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WebhookSolution { } export interface WebhookListInstance { _version: V1; _solution: WebhookSolution; _uri: string; (): WebhookContext; get(): WebhookContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WebhookListInstance(version: V1): WebhookListInstance; export {}; rest/conversations/v1/configuration/webhook.js000064400000012012151677225100015611 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.WebhookListInstance = exports.WebhookInstance = exports.WebhookContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); class WebhookContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/Configuration/Webhooks`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload)); 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["method"] !== undefined) data["Method"] = params["method"]; if (params["filters"] !== undefined) data["Filters"] = serialize.map(params["filters"], (e) => e); if (params["preWebhookUrl"] !== undefined) data["PreWebhookUrl"] = params["preWebhookUrl"]; if (params["postWebhookUrl"] !== undefined) data["PostWebhookUrl"] = params["postWebhookUrl"]; if (params["target"] !== undefined) data["Target"] = params["target"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload)); 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.WebhookContextImpl = WebhookContextImpl; class WebhookInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.method = payload.method; this.filters = payload.filters; this.preWebhookUrl = payload.pre_webhook_url; this.postWebhookUrl = payload.post_webhook_url; this.target = payload.target; this.url = payload.url; this._solution = {}; } get _proxy() { this._context = this._context || new WebhookContextImpl(this._version); return this._context; } /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, method: this.method, filters: this.filters, preWebhookUrl: this.preWebhookUrl, postWebhookUrl: this.postWebhookUrl, target: this.target, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookInstance = WebhookInstance; function WebhookListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new WebhookContextImpl(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; } exports.WebhookListInstance = WebhookListInstance; rest/conversations/v1/configuration.d.ts000064400000015022151677225100014413 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; import { WebhookListInstance } from "./configuration/webhook"; /** * Options to pass to update a ConfigurationInstance */ export interface ConfigurationContextUpdateOptions { /** The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) to use when creating a conversation. */ defaultChatServiceSid?: string; /** The SID of the default [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to use when creating a conversation. */ defaultMessagingServiceSid?: string; /** Default ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. */ defaultInactiveTimer?: string; /** Default ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. */ defaultClosedTimer?: string; } export interface ConfigurationContext { /** * Fetch a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(params: ConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConfigurationContextSolution { } export declare class ConfigurationContextImpl implements ConfigurationContext { protected _version: V1; protected _solution: ConfigurationContextSolution; protected _uri: string; constructor(_version: V1); fetch(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; update(params?: ConfigurationContextUpdateOptions | ((error: Error | null, item?: ConfigurationInstance) => any), callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConfigurationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConfigurationResource { account_sid: string; default_chat_service_sid: string; default_messaging_service_sid: string; default_inactive_timer: string; default_closed_timer: string; url: string; links: Record<string, string>; } export declare class ConfigurationInstance { protected _version: V1; protected _solution: ConfigurationContextSolution; protected _context?: ConfigurationContext; constructor(_version: V1, payload: ConfigurationResource); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. */ accountSid: string; /** * The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) used when creating a conversation. */ defaultChatServiceSid: string; /** * The SID of the default [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) used when creating a conversation. */ defaultMessagingServiceSid: string; /** * Default ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. */ defaultInactiveTimer: string; /** * Default ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. */ defaultClosedTimer: string; /** * An absolute API resource URL for this global configuration. */ url: string; /** * Contains absolute API resource URLs to access the webhook and default service configurations. */ links: Record<string, string>; private get _proxy(); /** * Fetch a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(params: ConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; defaultChatServiceSid: string; defaultMessagingServiceSid: string; defaultInactiveTimer: string; defaultClosedTimer: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConfigurationSolution { } export interface ConfigurationListInstance { _version: V1; _solution: ConfigurationSolution; _uri: string; (): ConfigurationContext; get(): ConfigurationContext; _webhooks?: WebhookListInstance; webhooks: WebhookListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConfigurationListInstance(version: V1): ConfigurationListInstance; export {}; rest/conversations/v1/service.d.ts000064400000025610151677225100013210 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { BindingListInstance } from "./service/binding"; import { ConfigurationListInstance } from "./service/configuration"; import { ConversationListInstance } from "./service/conversation"; import { ParticipantConversationListInstance } from "./service/participantConversation"; import { RoleListInstance } from "./service/role"; import { UserListInstance } from "./service/user"; /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** The human-readable name of this service, limited to 256 characters. Optional. */ friendlyName: string; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { bindings: BindingListInstance; configuration: ConfigurationListInstance; conversations: ConversationListInstance; participantConversations: ParticipantConversationListInstance; roles: RoleListInstance; users: UserListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V1; protected _solution: ServiceContextSolution; protected _uri: string; protected _bindings?: BindingListInstance; protected _configuration?: ConfigurationListInstance; protected _conversations?: ConversationListInstance; protected _participantConversations?: ParticipantConversationListInstance; protected _roles?: RoleListInstance; protected _users?: UserListInstance; constructor(_version: V1, sid: string); get bindings(): BindingListInstance; get configuration(): ConfigurationListInstance; get conversations(): ConversationListInstance; get participantConversations(): ParticipantConversationListInstance; get roles(): RoleListInstance; get users(): UserListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { account_sid: string; sid: string; friendly_name: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ServiceInstance { protected _version: V1; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V1, payload: ServiceResource, sid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. */ accountSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The human-readable name of this service, limited to 256 characters. Optional. */ friendlyName: string; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. */ dateUpdated: Date; /** * An absolute API resource URL for this service. */ url: string; /** * Contains absolute API resource URLs to access conversations, users, roles, bindings and configuration of this service. */ links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the bindings. */ bindings(): BindingListInstance; /** * Access the configuration. */ configuration(): ConfigurationListInstance; /** * Access the conversations. */ conversations(): ConversationListInstance; /** * Access the participantConversations. */ participantConversations(): ParticipantConversationListInstance; /** * Access the roles. */ roles(): RoleListInstance; /** * Access the users. */ users(): UserListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V1; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V1): ServiceListInstance; export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/conversation.js000064400000033426151677225100014032 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.ConversationPage = exports.ConversationListInstance = exports.ConversationInstance = exports.ConversationContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const message_1 = require("./conversation/message"); const participant_1 = require("./conversation/participant"); const webhook_1 = require("./conversation/webhook"); class ConversationContextImpl { 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 = `/Conversations/${sid}`; } get messages() { this._messages = this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.sid); return this._messages; } get participants() { this._participants = this._participants || (0, participant_1.ParticipantListInstance)(this._version, this._solution.sid); return this._participants; } get webhooks() { this._webhooks = this._webhooks || (0, webhook_1.WebhookListInstance)(this._version, this._solution.sid); return this._webhooks; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["messagingServiceSid"] !== undefined) data["MessagingServiceSid"] = params["messagingServiceSid"]; if (params["state"] !== undefined) data["State"] = params["state"]; if (params["timers.inactive"] !== undefined) data["Timers.Inactive"] = params["timers.inactive"]; if (params["timers.closed"] !== undefined) data["Timers.Closed"] = params["timers.closed"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["bindings.email.address"] !== undefined) data["Bindings.Email.Address"] = params["bindings.email.address"]; if (params["bindings.email.name"] !== undefined) data["Bindings.Email.Name"] = params["bindings.email.name"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload, 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.ConversationContextImpl = ConversationContextImpl; class ConversationInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.messagingServiceSid = payload.messaging_service_sid; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.attributes = payload.attributes; this.state = payload.state; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.timers = payload.timers; this.url = payload.url; this.links = payload.links; this.bindings = payload.bindings; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ConversationContextImpl(this._version, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the messages. */ messages() { return this._proxy.messages; } /** * Access the participants. */ participants() { return this._proxy.participants; } /** * Access the webhooks. */ webhooks() { return this._proxy.webhooks; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, messagingServiceSid: this.messagingServiceSid, sid: this.sid, friendlyName: this.friendlyName, uniqueName: this.uniqueName, attributes: this.attributes, state: this.state, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, timers: this.timers, url: this.url, links: this.links, bindings: this.bindings, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConversationInstance = ConversationInstance; function ConversationListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ConversationContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Conversations`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["messagingServiceSid"] !== undefined) data["MessagingServiceSid"] = params["messagingServiceSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["state"] !== undefined) data["State"] = params["state"]; if (params["timers.inactive"] !== undefined) data["Timers.Inactive"] = params["timers.inactive"]; if (params["timers.closed"] !== undefined) data["Timers.Closed"] = params["timers.closed"]; if (params["bindings.email.address"] !== undefined) data["Bindings.Email.Address"] = params["bindings.email.address"]; if (params["bindings.email.name"] !== undefined) data["Bindings.Email.Name"] = params["bindings.email.name"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload)); 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["startDate"] !== undefined) data["StartDate"] = params["startDate"]; if (params["endDate"] !== undefined) data["EndDate"] = params["endDate"]; if (params["state"] !== undefined) data["State"] = params["state"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConversationPage(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 ConversationPage(instance._version, payload, 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; } exports.ConversationListInstance = ConversationListInstance; class ConversationPage extends Page_1.default { /** * Initialize the ConversationPage * * @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 ConversationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ConversationInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConversationPage = ConversationPage; rest/conversations/v1/conversation/message.js000064400000031052151677225100015447 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.MessagePage = exports.MessageListInstance = exports.MessageInstance = exports.MessageContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const deliveryReceipt_1 = require("./message/deliveryReceipt"); class MessageContextImpl { constructor(_version, conversationSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { conversationSid, sid }; this._uri = `/Conversations/${conversationSid}/Messages/${sid}`; } get deliveryReceipts() { this._deliveryReceipts = this._deliveryReceipts || (0, deliveryReceipt_1.DeliveryReceiptListInstance)(this._version, this._solution.conversationSid, this._solution.sid); return this._deliveryReceipts; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.conversationSid, 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["author"] !== undefined) data["Author"] = params["author"]; if (params["body"] !== undefined) data["Body"] = params["body"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["subject"] !== undefined) data["Subject"] = params["subject"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.conversationSid, 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.MessageContextImpl = MessageContextImpl; class MessageInstance { constructor(_version, payload, conversationSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.conversationSid = payload.conversation_sid; this.sid = payload.sid; this.index = deserialize.integer(payload.index); this.author = payload.author; this.body = payload.body; this.media = payload.media; this.attributes = payload.attributes; this.participantSid = payload.participant_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.delivery = payload.delivery; this.links = payload.links; this.contentSid = payload.content_sid; this._solution = { conversationSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MessageContextImpl(this._version, this._solution.conversationSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the deliveryReceipts. */ deliveryReceipts() { return this._proxy.deliveryReceipts; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, conversationSid: this.conversationSid, sid: this.sid, index: this.index, author: this.author, body: this.body, media: this.media, attributes: this.attributes, participantSid: this.participantSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, delivery: this.delivery, links: this.links, contentSid: this.contentSid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessageInstance = MessageInstance; function MessageListInstance(version, conversationSid) { if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MessageContextImpl(version, conversationSid, sid); }; instance._version = version; instance._solution = { conversationSid }; instance._uri = `/Conversations/${conversationSid}/Messages`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["author"] !== undefined) data["Author"] = params["author"]; if (params["body"] !== undefined) data["Body"] = params["body"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["mediaSid"] !== undefined) data["MediaSid"] = params["mediaSid"]; if (params["contentSid"] !== undefined) data["ContentSid"] = params["contentSid"]; if (params["contentVariables"] !== undefined) data["ContentVariables"] = params["contentVariables"]; if (params["subject"] !== undefined) data["Subject"] = params["subject"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.conversationSid)); 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["order"] !== undefined) data["Order"] = params["order"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MessagePage(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 MessagePage(instance._version, payload, 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; } exports.MessageListInstance = MessageListInstance; class MessagePage extends Page_1.default { /** * Initialize the MessagePage * * @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 MessageInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MessageInstance(this._version, payload, this._solution.conversationSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessagePage = MessagePage; rest/conversations/v1/conversation/participant.js000064400000031241151677225100016341 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.ParticipantPage = exports.ParticipantListInstance = exports.ParticipantInstance = exports.ParticipantContextImpl = void 0; 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 ParticipantContextImpl { constructor(_version, conversationSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { conversationSid, sid }; this._uri = `/Conversations/${conversationSid}/Participants/${sid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.conversationSid, 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["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["messagingBinding.proxyAddress"] !== undefined) data["MessagingBinding.ProxyAddress"] = params["messagingBinding.proxyAddress"]; if (params["messagingBinding.projectedAddress"] !== undefined) data["MessagingBinding.ProjectedAddress"] = params["messagingBinding.projectedAddress"]; if (params["identity"] !== undefined) data["Identity"] = params["identity"]; if (params["lastReadMessageIndex"] !== undefined) data["LastReadMessageIndex"] = params["lastReadMessageIndex"]; if (params["lastReadTimestamp"] !== undefined) data["LastReadTimestamp"] = params["lastReadTimestamp"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.conversationSid, 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.ParticipantContextImpl = ParticipantContextImpl; class ParticipantInstance { constructor(_version, payload, conversationSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.conversationSid = payload.conversation_sid; this.sid = payload.sid; this.identity = payload.identity; this.attributes = payload.attributes; this.messagingBinding = payload.messaging_binding; this.roleSid = payload.role_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.lastReadMessageIndex = deserialize.integer(payload.last_read_message_index); this.lastReadTimestamp = payload.last_read_timestamp; this._solution = { conversationSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ParticipantContextImpl(this._version, this._solution.conversationSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, conversationSid: this.conversationSid, sid: this.sid, identity: this.identity, attributes: this.attributes, messagingBinding: this.messagingBinding, roleSid: this.roleSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, lastReadMessageIndex: this.lastReadMessageIndex, lastReadTimestamp: this.lastReadTimestamp, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantInstance = ParticipantInstance; function ParticipantListInstance(version, conversationSid) { if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ParticipantContextImpl(version, conversationSid, sid); }; instance._version = version; instance._solution = { conversationSid }; instance._uri = `/Conversations/${conversationSid}/Participants`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["identity"] !== undefined) data["Identity"] = params["identity"]; if (params["messagingBinding.address"] !== undefined) data["MessagingBinding.Address"] = params["messagingBinding.address"]; if (params["messagingBinding.proxyAddress"] !== undefined) data["MessagingBinding.ProxyAddress"] = params["messagingBinding.proxyAddress"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["messagingBinding.projectedAddress"] !== undefined) data["MessagingBinding.ProjectedAddress"] = params["messagingBinding.projectedAddress"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.conversationSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantPage(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 ParticipantPage(instance._version, payload, 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; } exports.ParticipantListInstance = ParticipantListInstance; class ParticipantPage extends Page_1.default { /** * Initialize the ParticipantPage * * @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 ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ParticipantInstance(this._version, payload, this._solution.conversationSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantPage = ParticipantPage; rest/conversations/v1/conversation/webhook.d.ts000064400000030151151677225100015714 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type WebhookMethod = "GET" | "POST"; export type WebhookTarget = "webhook" | "trigger" | "studio"; /** * Options to pass to update a WebhookInstance */ export interface WebhookContextUpdateOptions { /** The absolute url the webhook request should be sent to. */ "configuration.url"?: string; /** */ "configuration.method"?: WebhookMethod; /** The list of events, firing webhook event for this Conversation. */ "configuration.filters"?: Array<string>; /** The list of keywords, firing webhook event for this Conversation. */ "configuration.triggers"?: Array<string>; /** The studio flow SID, where the webhook should be sent to. */ "configuration.flowSid"?: string; } /** * Options to pass to create a WebhookInstance */ export interface WebhookListInstanceCreateOptions { /** */ target: WebhookTarget; /** The absolute url the webhook request should be sent to. */ "configuration.url"?: string; /** */ "configuration.method"?: WebhookMethod; /** The list of events, firing webhook event for this Conversation. */ "configuration.filters"?: Array<string>; /** The list of keywords, firing webhook event for this Conversation. */ "configuration.triggers"?: Array<string>; /** The studio flow SID, where the webhook should be sent to. */ "configuration.flowSid"?: string; /** The message index for which and it\\\'s successors the webhook will be replayed. Not set by default */ "configuration.replayAfter"?: number; } /** * Options to pass to each */ export interface WebhookListInstanceEachOptions { /** 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: WebhookInstance, 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 WebhookListInstanceOptions { /** 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 WebhookListInstancePageOptions { /** 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 WebhookContext { /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WebhookContextSolution { conversationSid: string; sid: string; } export declare class WebhookContextImpl implements WebhookContext { protected _version: V1; protected _solution: WebhookContextSolution; protected _uri: string; constructor(_version: V1, conversationSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; update(params?: WebhookContextUpdateOptions | ((error: Error | null, item?: WebhookInstance) => any), callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WebhookContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WebhookPayload extends TwilioResponsePayload { webhooks: WebhookResource[]; } interface WebhookResource { sid: string; account_sid: string; conversation_sid: string; target: string; url: string; configuration: any; date_created: Date; date_updated: Date; } export declare class WebhookInstance { protected _version: V1; protected _solution: WebhookContextSolution; protected _context?: WebhookContext; constructor(_version: V1, payload: WebhookResource, conversationSid: string, sid?: string); /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. */ accountSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. */ conversationSid: string; /** * The target of this webhook: `webhook`, `studio`, `trigger` */ target: string; /** * An absolute API resource URL for this webhook. */ url: string; /** * The configuration of this webhook. Is defined based on target. */ configuration: any; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. */ dateUpdated: Date; private get _proxy(); /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; conversationSid: string; target: string; url: string; configuration: any; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WebhookSolution { conversationSid: string; } export interface WebhookListInstance { _version: V1; _solution: WebhookSolution; _uri: string; (sid: string): WebhookContext; get(sid: string): WebhookContext; /** * Create a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ create(params: WebhookListInstanceCreateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Streams WebhookInstance 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 { WebhookListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; each(params: WebhookListInstanceEachOptions, callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WebhookInstance 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: WebhookPage) => any): Promise<WebhookPage>; /** * Lists WebhookInstance 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 { WebhookListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; list(params: WebhookListInstanceOptions, callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; /** * Retrieve a single page of WebhookInstance 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 { WebhookListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; page(params: WebhookListInstancePageOptions, callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WebhookListInstance(version: V1, conversationSid: string): WebhookListInstance; export declare class WebhookPage extends Page<V1, WebhookPayload, WebhookResource, WebhookInstance> { /** * Initialize the WebhookPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: WebhookSolution); /** * Build an instance of WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload: WebhookResource): WebhookInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/conversation/participant.d.ts000064400000042677151677225100016614 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type ParticipantWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a ParticipantInstance */ export interface ParticipantContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ParticipantWebhookEnabledType; } /** * Options to pass to update a ParticipantInstance */ export interface ParticipantContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ParticipantWebhookEnabledType; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. */ dateUpdated?: Date; /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. */ roleSid?: string; /** The address of the Twilio phone number that the participant is in contact with. \\\'null\\\' value will remove it. */ "messagingBinding.proxyAddress"?: string; /** The address of the Twilio phone number that is used in Group MMS. \\\'null\\\' value will remove it. */ "messagingBinding.projectedAddress"?: string; /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ identity?: string; /** Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. */ lastReadMessageIndex?: number; /** Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. */ lastReadTimestamp?: string; } /** * Options to pass to create a ParticipantInstance */ export interface ParticipantListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ParticipantWebhookEnabledType; /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ identity?: string; /** The address of the participant\\\'s device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the \\\'identity\\\' field). */ "messagingBinding.address"?: string; /** The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the \\\'identity\\\' field). */ "messagingBinding.proxyAddress"?: string; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. */ dateUpdated?: Date; /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity. */ "messagingBinding.projectedAddress"?: string; /** The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. */ roleSid?: string; } /** * Options to pass to each */ export interface ParticipantListInstanceEachOptions { /** 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: ParticipantInstance, 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 ParticipantListInstanceOptions { /** 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 ParticipantListInstancePageOptions { /** 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 ParticipantContext { /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ remove(params: ParticipantContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(params: ParticipantContextUpdateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ParticipantContextSolution { conversationSid: string; sid: string; } export declare class ParticipantContextImpl implements ParticipantContext { protected _version: V1; protected _solution: ParticipantContextSolution; protected _uri: string; constructor(_version: V1, conversationSid: string, sid: string); remove(params?: ParticipantContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; update(params?: ParticipantContextUpdateOptions | ((error: Error | null, item?: ParticipantInstance) => any), callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ParticipantContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ParticipantPayload extends TwilioResponsePayload { participants: ParticipantResource[]; } interface ParticipantResource { account_sid: string; conversation_sid: string; sid: string; identity: string; attributes: string; messaging_binding: any; role_sid: string; date_created: Date; date_updated: Date; url: string; last_read_message_index: number; last_read_timestamp: string; } export declare class ParticipantInstance { protected _version: V1; protected _solution: ParticipantContextSolution; protected _context?: ParticipantContext; constructor(_version: V1, payload: ParticipantResource, conversationSid: string, sid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. */ accountSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. */ conversationSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ identity: string; /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. */ attributes: string; /** * Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. */ messagingBinding: any; /** * The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. */ roleSid: string; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. */ dateUpdated: Date; /** * An absolute API resource URL for this participant. */ url: string; /** * Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. */ lastReadMessageIndex: number; /** * Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. */ lastReadTimestamp: string; private get _proxy(); /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ remove(params: ParticipantContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(params: ParticipantContextUpdateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; conversationSid: string; sid: string; identity: string; attributes: string; messagingBinding: any; roleSid: string; dateCreated: Date; dateUpdated: Date; url: string; lastReadMessageIndex: number; lastReadTimestamp: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ParticipantSolution { conversationSid: string; } export interface ParticipantListInstance { _version: V1; _solution: ParticipantSolution; _uri: string; (sid: string): ParticipantContext; get(sid: string): ParticipantContext; /** * Create a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ create(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Create a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ create(params: ParticipantListInstanceCreateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Streams ParticipantInstance 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 { ParticipantListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; each(params: ParticipantListInstanceEachOptions, callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ParticipantInstance 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: ParticipantPage) => any): Promise<ParticipantPage>; /** * Lists ParticipantInstance 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 { ParticipantListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; list(params: ParticipantListInstanceOptions, callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; /** * Retrieve a single page of ParticipantInstance 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 { ParticipantListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; page(params: ParticipantListInstancePageOptions, callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ParticipantListInstance(version: V1, conversationSid: string): ParticipantListInstance; export declare class ParticipantPage extends Page<V1, ParticipantPayload, ParticipantResource, ParticipantInstance> { /** * Initialize the ParticipantPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ParticipantSolution); /** * Build an instance of ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload: ParticipantResource): ParticipantInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/conversation/message.d.ts000064400000041753151677225100015714 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { DeliveryReceiptListInstance } from "./message/deliveryReceipt"; export type MessageOrderType = "asc" | "desc"; export type MessageWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a MessageInstance */ export interface MessageContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; } /** * Options to pass to update a MessageInstance */ export interface MessageContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; /** The channel specific identifier of the message\\\'s author. Defaults to `system`. */ author?: string; /** The content of the message, can be up to 1,600 characters long. */ body?: string; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. `null` if the message has not been edited. */ dateUpdated?: Date; /** A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** The subject of the message, can be up to 256 characters long. */ subject?: string; } /** * Options to pass to create a MessageInstance */ export interface MessageListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; /** The channel specific identifier of the message\\\'s author. Defaults to `system`. */ author?: string; /** The content of the message, can be up to 1,600 characters long. */ body?: string; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. `null` if the message has not been edited. */ dateUpdated?: Date; /** A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** The Media SID to be attached to the new Message. */ mediaSid?: string; /** The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. */ contentSid?: string; /** A structurally valid JSON string that contains values to resolve Rich Content template variables. */ contentVariables?: string; /** The subject of the message, can be up to 256 characters long. */ subject?: string; } /** * Options to pass to each */ export interface MessageListInstanceEachOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. */ order?: MessageOrderType; /** 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: MessageInstance, 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 MessageListInstanceOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. */ order?: MessageOrderType; /** 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 MessageListInstancePageOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. */ order?: MessageOrderType; /** 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 MessageContext { deliveryReceipts: DeliveryReceiptListInstance; /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ remove(params: MessageContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MessageContextSolution { conversationSid: string; sid: string; } export declare class MessageContextImpl implements MessageContext { protected _version: V1; protected _solution: MessageContextSolution; protected _uri: string; protected _deliveryReceipts?: DeliveryReceiptListInstance; constructor(_version: V1, conversationSid: string, sid: string); get deliveryReceipts(): DeliveryReceiptListInstance; remove(params?: MessageContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; update(params?: MessageContextUpdateOptions | ((error: Error | null, item?: MessageInstance) => any), callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MessageContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MessagePayload extends TwilioResponsePayload { messages: MessageResource[]; } interface MessageResource { account_sid: string; conversation_sid: string; sid: string; index: number; author: string; body: string; media: Array<any>; attributes: string; participant_sid: string; date_created: Date; date_updated: Date; url: string; delivery: any; links: Record<string, string>; content_sid: string; } export declare class MessageInstance { protected _version: V1; protected _solution: MessageContextSolution; protected _context?: MessageContext; constructor(_version: V1, payload: MessageResource, conversationSid: string, sid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. */ accountSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. */ conversationSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). Indices may skip numbers, but will always be in order of when the message was received. */ index: number; /** * The channel specific identifier of the message\'s author. Defaults to `system`. */ author: string; /** * The content of the message, can be up to 1,600 characters long. */ body: string; /** * An array of objects that describe the Message\'s media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object\'s file size in bytes. If the Message has no media, this value is `null`. */ media: Array<any>; /** * A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. */ attributes: string; /** * The unique ID of messages\'s author participant. Null in case of `system` sent message. */ participantSid: string; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. `null` if the message has not been edited. */ dateUpdated: Date; /** * An absolute API resource API URL for this message. */ url: string; /** * An object that contains the summary of delivery statuses for the message to non-chat participants. */ delivery: any; /** * Contains an absolute API resource URL to access the delivery & read receipts of this message. */ links: Record<string, string>; /** * The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template. */ contentSid: string; private get _proxy(); /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ remove(params: MessageContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Access the deliveryReceipts. */ deliveryReceipts(): DeliveryReceiptListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; conversationSid: string; sid: string; index: number; author: string; body: string; media: any[]; attributes: string; participantSid: string; dateCreated: Date; dateUpdated: Date; url: string; delivery: any; links: Record<string, string>; contentSid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MessageSolution { conversationSid: string; } export interface MessageListInstance { _version: V1; _solution: MessageSolution; _uri: string; (sid: string): MessageContext; get(sid: string): MessageContext; /** * Create a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Create a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(params: MessageListInstanceCreateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Streams MessageInstance 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 { MessageListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; each(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MessageInstance 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: MessagePage) => any): Promise<MessagePage>; /** * Lists MessageInstance 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 { MessageListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; list(params: MessageListInstanceOptions, callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; /** * Retrieve a single page of MessageInstance 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 { MessageListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; page(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessageListInstance(version: V1, conversationSid: string): MessageListInstance; export declare class MessagePage extends Page<V1, MessagePayload, MessageResource, MessageInstance> { /** * Initialize the MessagePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: MessageSolution); /** * Build an instance of MessageInstance * * @param payload - Payload response from the API */ getInstance(payload: MessageResource): MessageInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/conversation/message/deliveryReceipt.d.ts000064400000023351151677225100021045 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type DeliveryReceiptDeliveryStatus = "read" | "failed" | "delivered" | "undelivered" | "sent"; /** * Options to pass to each */ export interface DeliveryReceiptListInstanceEachOptions { /** 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: DeliveryReceiptInstance, 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 DeliveryReceiptListInstanceOptions { /** 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 DeliveryReceiptListInstancePageOptions { /** 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 DeliveryReceiptContext { /** * Fetch a DeliveryReceiptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeliveryReceiptInstance */ fetch(callback?: (error: Error | null, item?: DeliveryReceiptInstance) => any): Promise<DeliveryReceiptInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DeliveryReceiptContextSolution { conversationSid: string; messageSid: string; sid: string; } export declare class DeliveryReceiptContextImpl implements DeliveryReceiptContext { protected _version: V1; protected _solution: DeliveryReceiptContextSolution; protected _uri: string; constructor(_version: V1, conversationSid: string, messageSid: string, sid: string); fetch(callback?: (error: Error | null, item?: DeliveryReceiptInstance) => any): Promise<DeliveryReceiptInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DeliveryReceiptContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DeliveryReceiptPayload extends TwilioResponsePayload { delivery_receipts: DeliveryReceiptResource[]; } interface DeliveryReceiptResource { account_sid: string; conversation_sid: string; sid: string; message_sid: string; channel_message_sid: string; participant_sid: string; status: DeliveryReceiptDeliveryStatus; error_code: number; date_created: Date; date_updated: Date; url: string; } export declare class DeliveryReceiptInstance { protected _version: V1; protected _solution: DeliveryReceiptContextSolution; protected _context?: DeliveryReceiptContext; constructor(_version: V1, payload: DeliveryReceiptResource, conversationSid: string, messageSid: string, sid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. */ accountSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. */ conversationSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to */ messageSid: string; /** * A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. */ channelMessageSid: string; /** * The unique ID of the participant the delivery receipt belongs to. */ participantSid: string; status: DeliveryReceiptDeliveryStatus; /** * The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, */ errorCode: number; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. `null` if the delivery receipt has not been updated. */ dateUpdated: Date; /** * An absolute API resource URL for this delivery receipt. */ url: string; private get _proxy(); /** * Fetch a DeliveryReceiptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeliveryReceiptInstance */ fetch(callback?: (error: Error | null, item?: DeliveryReceiptInstance) => any): Promise<DeliveryReceiptInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; conversationSid: string; sid: string; messageSid: string; channelMessageSid: string; participantSid: string; status: DeliveryReceiptDeliveryStatus; errorCode: number; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DeliveryReceiptSolution { conversationSid: string; messageSid: string; } export interface DeliveryReceiptListInstance { _version: V1; _solution: DeliveryReceiptSolution; _uri: string; (sid: string): DeliveryReceiptContext; get(sid: string): DeliveryReceiptContext; /** * Streams DeliveryReceiptInstance 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 { DeliveryReceiptListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DeliveryReceiptInstance, done: (err?: Error) => void) => void): void; each(params: DeliveryReceiptListInstanceEachOptions, callback?: (item: DeliveryReceiptInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DeliveryReceiptInstance 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: DeliveryReceiptPage) => any): Promise<DeliveryReceiptPage>; /** * Lists DeliveryReceiptInstance 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 { DeliveryReceiptListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DeliveryReceiptInstance[]) => any): Promise<DeliveryReceiptInstance[]>; list(params: DeliveryReceiptListInstanceOptions, callback?: (error: Error | null, items: DeliveryReceiptInstance[]) => any): Promise<DeliveryReceiptInstance[]>; /** * Retrieve a single page of DeliveryReceiptInstance 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 { DeliveryReceiptListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DeliveryReceiptPage) => any): Promise<DeliveryReceiptPage>; page(params: DeliveryReceiptListInstancePageOptions, callback?: (error: Error | null, items: DeliveryReceiptPage) => any): Promise<DeliveryReceiptPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DeliveryReceiptListInstance(version: V1, conversationSid: string, messageSid: string): DeliveryReceiptListInstance; export declare class DeliveryReceiptPage extends Page<V1, DeliveryReceiptPayload, DeliveryReceiptResource, DeliveryReceiptInstance> { /** * Initialize the DeliveryReceiptPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DeliveryReceiptSolution); /** * Build an instance of DeliveryReceiptInstance * * @param payload - Payload response from the API */ getInstance(payload: DeliveryReceiptResource): DeliveryReceiptInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/conversation/message/deliveryReceipt.js000064400000020053151677225100020605 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.DeliveryReceiptPage = exports.DeliveryReceiptListInstance = exports.DeliveryReceiptInstance = exports.DeliveryReceiptContextImpl = void 0; 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 DeliveryReceiptContextImpl { constructor(_version, conversationSid, messageSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(messageSid)) { throw new Error("Parameter 'messageSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { conversationSid, messageSid, sid }; this._uri = `/Conversations/${conversationSid}/Messages/${messageSid}/Receipts/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DeliveryReceiptInstance(operationVersion, payload, instance._solution.conversationSid, instance._solution.messageSid, 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.DeliveryReceiptContextImpl = DeliveryReceiptContextImpl; class DeliveryReceiptInstance { constructor(_version, payload, conversationSid, messageSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.conversationSid = payload.conversation_sid; this.sid = payload.sid; this.messageSid = payload.message_sid; this.channelMessageSid = payload.channel_message_sid; this.participantSid = payload.participant_sid; this.status = payload.status; this.errorCode = deserialize.integer(payload.error_code); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { conversationSid, messageSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new DeliveryReceiptContextImpl(this._version, this._solution.conversationSid, this._solution.messageSid, this._solution.sid); return this._context; } /** * Fetch a DeliveryReceiptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeliveryReceiptInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, conversationSid: this.conversationSid, sid: this.sid, messageSid: this.messageSid, channelMessageSid: this.channelMessageSid, participantSid: this.participantSid, status: this.status, errorCode: this.errorCode, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeliveryReceiptInstance = DeliveryReceiptInstance; function DeliveryReceiptListInstance(version, conversationSid, messageSid) { if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(messageSid)) { throw new Error("Parameter 'messageSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new DeliveryReceiptContextImpl(version, conversationSid, messageSid, sid); }; instance._version = version; instance._solution = { conversationSid, messageSid }; instance._uri = `/Conversations/${conversationSid}/Messages/${messageSid}/Receipts`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DeliveryReceiptPage(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 DeliveryReceiptPage(instance._version, payload, 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; } exports.DeliveryReceiptListInstance = DeliveryReceiptListInstance; class DeliveryReceiptPage extends Page_1.default { /** * Initialize the DeliveryReceiptPage * * @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 DeliveryReceiptInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DeliveryReceiptInstance(this._version, payload, this._solution.conversationSid, this._solution.messageSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeliveryReceiptPage = DeliveryReceiptPage; rest/conversations/v1/conversation/webhook.js000064400000026127151677225100015470 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.WebhookPage = exports.WebhookListInstance = exports.WebhookInstance = exports.WebhookContextImpl = void 0; 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 WebhookContextImpl { constructor(_version, conversationSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { conversationSid, sid }; this._uri = `/Conversations/${conversationSid}/Webhooks/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.conversationSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["configuration.url"] !== undefined) data["Configuration.Url"] = params["configuration.url"]; if (params["configuration.method"] !== undefined) data["Configuration.Method"] = params["configuration.method"]; if (params["configuration.filters"] !== undefined) data["Configuration.Filters"] = serialize.map(params["configuration.filters"], (e) => e); if (params["configuration.triggers"] !== undefined) data["Configuration.Triggers"] = serialize.map(params["configuration.triggers"], (e) => e); if (params["configuration.flowSid"] !== undefined) data["Configuration.FlowSid"] = params["configuration.flowSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.conversationSid, 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.WebhookContextImpl = WebhookContextImpl; class WebhookInstance { constructor(_version, payload, conversationSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.conversationSid = payload.conversation_sid; this.target = payload.target; this.url = payload.url; this.configuration = payload.configuration; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { conversationSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WebhookContextImpl(this._version, this._solution.conversationSid, this._solution.sid); return this._context; } /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, conversationSid: this.conversationSid, target: this.target, url: this.url, configuration: this.configuration, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookInstance = WebhookInstance; function WebhookListInstance(version, conversationSid) { if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WebhookContextImpl(version, conversationSid, sid); }; instance._version = version; instance._solution = { conversationSid }; instance._uri = `/Conversations/${conversationSid}/Webhooks`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["target"] === null || params["target"] === undefined) { throw new Error("Required parameter \"params['target']\" missing."); } let data = {}; data["Target"] = params["target"]; if (params["configuration.url"] !== undefined) data["Configuration.Url"] = params["configuration.url"]; if (params["configuration.method"] !== undefined) data["Configuration.Method"] = params["configuration.method"]; if (params["configuration.filters"] !== undefined) data["Configuration.Filters"] = serialize.map(params["configuration.filters"], (e) => e); if (params["configuration.triggers"] !== undefined) data["Configuration.Triggers"] = serialize.map(params["configuration.triggers"], (e) => e); if (params["configuration.flowSid"] !== undefined) data["Configuration.FlowSid"] = params["configuration.flowSid"]; if (params["configuration.replayAfter"] !== undefined) data["Configuration.ReplayAfter"] = params["configuration.replayAfter"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.conversationSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookPage(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 WebhookPage(instance._version, payload, 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; } exports.WebhookListInstance = WebhookListInstance; class WebhookPage extends Page_1.default { /** * Initialize the WebhookPage * * @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 WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WebhookInstance(this._version, payload, this._solution.conversationSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookPage = WebhookPage; rest/conversations/v1/configuration.js000064400000013222151677225100014157 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.ConfigurationListInstance = exports.ConfigurationInstance = exports.ConfigurationContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const webhook_1 = require("./configuration/webhook"); class ConfigurationContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/Configuration`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ConfigurationInstance(operationVersion, payload)); 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["defaultChatServiceSid"] !== undefined) data["DefaultChatServiceSid"] = params["defaultChatServiceSid"]; if (params["defaultMessagingServiceSid"] !== undefined) data["DefaultMessagingServiceSid"] = params["defaultMessagingServiceSid"]; if (params["defaultInactiveTimer"] !== undefined) data["DefaultInactiveTimer"] = params["defaultInactiveTimer"]; if (params["defaultClosedTimer"] !== undefined) data["DefaultClosedTimer"] = params["defaultClosedTimer"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConfigurationInstance(operationVersion, payload)); 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.ConfigurationContextImpl = ConfigurationContextImpl; class ConfigurationInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.defaultChatServiceSid = payload.default_chat_service_sid; this.defaultMessagingServiceSid = payload.default_messaging_service_sid; this.defaultInactiveTimer = payload.default_inactive_timer; this.defaultClosedTimer = payload.default_closed_timer; this.url = payload.url; this.links = payload.links; this._solution = {}; } get _proxy() { this._context = this._context || new ConfigurationContextImpl(this._version); return this._context; } /** * Fetch a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, defaultChatServiceSid: this.defaultChatServiceSid, defaultMessagingServiceSid: this.defaultMessagingServiceSid, defaultInactiveTimer: this.defaultInactiveTimer, defaultClosedTimer: this.defaultClosedTimer, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConfigurationInstance = ConfigurationInstance; function ConfigurationListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new ConfigurationContextImpl(version); }; instance._version = version; instance._solution = {}; instance._uri = ``; Object.defineProperty(instance, "webhooks", { get: function webhooks() { if (!instance._webhooks) { instance._webhooks = (0, webhook_1.WebhookListInstance)(instance._version); } return instance._webhooks; }, }); 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; } exports.ConfigurationListInstance = ConfigurationListInstance; rest/conversations/v1/participantConversation.d.ts000064400000027250151677225100016463 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type ParticipantConversationState = "inactive" | "active" | "closed"; /** * Options to pass to each */ export interface ParticipantConversationListInstanceEachOptions { /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ identity?: string; /** A unique string identifier for the conversation participant who\'s not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. */ address?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ParticipantConversationInstance, 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 ParticipantConversationListInstanceOptions { /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ identity?: string; /** A unique string identifier for the conversation participant who\'s not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. */ address?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ParticipantConversationListInstancePageOptions { /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ identity?: string; /** A unique string identifier for the conversation participant who\'s not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. */ address?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ParticipantConversationSolution { } export interface ParticipantConversationListInstance { _version: V1; _solution: ParticipantConversationSolution; _uri: string; /** * Streams ParticipantConversationInstance 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 { ParticipantConversationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ParticipantConversationInstance, done: (err?: Error) => void) => void): void; each(params: ParticipantConversationListInstanceEachOptions, callback?: (item: ParticipantConversationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ParticipantConversationInstance 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: ParticipantConversationPage) => any): Promise<ParticipantConversationPage>; /** * Lists ParticipantConversationInstance 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 { ParticipantConversationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ParticipantConversationInstance[]) => any): Promise<ParticipantConversationInstance[]>; list(params: ParticipantConversationListInstanceOptions, callback?: (error: Error | null, items: ParticipantConversationInstance[]) => any): Promise<ParticipantConversationInstance[]>; /** * Retrieve a single page of ParticipantConversationInstance 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 { ParticipantConversationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ParticipantConversationPage) => any): Promise<ParticipantConversationPage>; page(params: ParticipantConversationListInstancePageOptions, callback?: (error: Error | null, items: ParticipantConversationPage) => any): Promise<ParticipantConversationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ParticipantConversationListInstance(version: V1): ParticipantConversationListInstance; interface ParticipantConversationPayload extends TwilioResponsePayload { conversations: ParticipantConversationResource[]; } interface ParticipantConversationResource { account_sid: string; chat_service_sid: string; participant_sid: string; participant_user_sid: string; participant_identity: string; participant_messaging_binding: any; conversation_sid: string; conversation_unique_name: string; conversation_friendly_name: string; conversation_attributes: string; conversation_date_created: Date; conversation_date_updated: Date; conversation_created_by: string; conversation_state: ParticipantConversationState; conversation_timers: any; links: Record<string, string>; } export declare class ParticipantConversationInstance { protected _version: V1; constructor(_version: V1, payload: ParticipantConversationResource); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. */ accountSid: string; /** * The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. */ chatServiceSid: string; /** * The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). */ participantSid: string; /** * The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). */ participantUserSid: string; /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ participantIdentity: string; /** * Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. */ participantMessagingBinding: any; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. */ conversationSid: string; /** * An application-defined string that uniquely identifies the Conversation resource. */ conversationUniqueName: string; /** * The human-readable name of this conversation, limited to 256 characters. Optional. */ conversationFriendlyName: string; /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. */ conversationAttributes: string; /** * The date that this conversation was created, given in ISO 8601 format. */ conversationDateCreated: Date; /** * The date that this conversation was last updated, given in ISO 8601 format. */ conversationDateUpdated: Date; /** * Identity of the creator of this Conversation. */ conversationCreatedBy: string; conversationState: ParticipantConversationState; /** * Timer date values representing state update for this conversation. */ conversationTimers: any; /** * Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. */ links: Record<string, string>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; participantSid: string; participantUserSid: string; participantIdentity: string; participantMessagingBinding: any; conversationSid: string; conversationUniqueName: string; conversationFriendlyName: string; conversationAttributes: string; conversationDateCreated: Date; conversationDateUpdated: Date; conversationCreatedBy: string; conversationState: ParticipantConversationState; conversationTimers: any; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class ParticipantConversationPage extends Page<V1, ParticipantConversationPayload, ParticipantConversationResource, ParticipantConversationInstance> { /** * Initialize the ParticipantConversationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ParticipantConversationSolution); /** * Build an instance of ParticipantConversationInstance * * @param payload - Payload response from the API */ getInstance(payload: ParticipantConversationResource): ParticipantConversationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service.js000064400000024254151677225100012757 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const binding_1 = require("./service/binding"); const configuration_1 = require("./service/configuration"); const conversation_1 = require("./service/conversation"); const participantConversation_1 = require("./service/participantConversation"); const role_1 = require("./service/role"); const user_1 = require("./service/user"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get bindings() { this._bindings = this._bindings || (0, binding_1.BindingListInstance)(this._version, this._solution.sid); return this._bindings; } get configuration() { this._configuration = this._configuration || (0, configuration_1.ConfigurationListInstance)(this._version, this._solution.sid); return this._configuration; } get conversations() { this._conversations = this._conversations || (0, conversation_1.ConversationListInstance)(this._version, this._solution.sid); return this._conversations; } get participantConversations() { this._participantConversations = this._participantConversations || (0, participantConversation_1.ParticipantConversationListInstance)(this._version, this._solution.sid); return this._participantConversations; } get roles() { this._roles = this._roles || (0, role_1.RoleListInstance)(this._version, this._solution.sid); return this._roles; } get users() { this._users = this._users || (0, user_1.UserListInstance)(this._version, this._solution.sid); return this._users; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.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.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the bindings. */ bindings() { return this._proxy.bindings; } /** * Access the configuration. */ configuration() { return this._proxy.configuration; } /** * Access the conversations. */ conversations() { return this._proxy.conversations; } /** * Access the participantConversations. */ participantConversations() { return this._proxy.participantConversations; } /** * Access the roles. */ roles() { return this._proxy.roles; } /** * Access the users. */ users() { return this._proxy.users; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/conversations/v1/user.js000064400000025427151677225100012300 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.UserPage = exports.UserListInstance = exports.UserInstance = exports.UserContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const userConversation_1 = require("./user/userConversation"); class UserContextImpl { 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 = `/Users/${sid}`; } get userConversations() { this._userConversations = this._userConversations || (0, userConversation_1.UserConversationListInstance)(this._version, this._solution.sid); return this._userConversations; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, 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.UserContextImpl = UserContextImpl; class UserInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.roleSid = payload.role_sid; this.identity = payload.identity; this.friendlyName = payload.friendly_name; this.attributes = payload.attributes; this.isOnline = payload.is_online; this.isNotifiable = payload.is_notifiable; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserContextImpl(this._version, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the userConversations. */ userConversations() { return this._proxy.userConversations; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, roleSid: this.roleSid, identity: this.identity, friendlyName: this.friendlyName, attributes: this.attributes, isOnline: this.isOnline, isNotifiable: this.isNotifiable, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserInstance = UserInstance; function UserListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Users`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserPage(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 UserPage(instance._version, payload, 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; } exports.UserListInstance = UserListInstance; class UserPage extends Page_1.default { /** * Initialize the UserPage * * @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 UserInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserPage = UserPage; rest/conversations/v1/role.d.ts000064400000026070151677225100012512 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type RoleRoleType = "conversation" | "service"; /** * Options to pass to update a RoleInstance */ export interface RoleContextUpdateOptions { /** A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role\\\'s `type`. */ permission: Array<string>; } /** * Options to pass to create a RoleInstance */ export interface RoleListInstanceCreateOptions { /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName: string; /** */ type: RoleRoleType; /** A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role\\\'s `type`. */ permission: Array<string>; } /** * Options to pass to each */ export interface RoleListInstanceEachOptions { /** 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: RoleInstance, 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 RoleListInstanceOptions { /** 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 RoleListInstancePageOptions { /** 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 RoleContext { /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RoleContextSolution { sid: string; } export declare class RoleContextImpl implements RoleContext { protected _version: V1; protected _solution: RoleContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RoleContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RolePayload extends TwilioResponsePayload { roles: RoleResource[]; } interface RoleResource { sid: string; account_sid: string; chat_service_sid: string; friendly_name: string; type: RoleRoleType; permissions: Array<string>; date_created: Date; date_updated: Date; url: string; } export declare class RoleInstance { protected _version: V1; protected _solution: RoleContextSolution; protected _context?: RoleContext; constructor(_version: V1, payload: RoleResource, sid?: string); /** * The unique string that we created to identify the Role resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. */ chatServiceSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; type: RoleRoleType; /** * An array of the permissions the role has been granted. */ permissions: Array<string>; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * An absolute API resource URL for this user role. */ url: string; private get _proxy(); /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; chatServiceSid: string; friendlyName: string; type: RoleRoleType; permissions: string[]; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RoleSolution { } export interface RoleListInstance { _version: V1; _solution: RoleSolution; _uri: string; (sid: string): RoleContext; get(sid: string): RoleContext; /** * Create a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ create(params: RoleListInstanceCreateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Streams RoleInstance 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 { RoleListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; each(params: RoleListInstanceEachOptions, callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RoleInstance 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: RolePage) => any): Promise<RolePage>; /** * Lists RoleInstance 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 { RoleListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; list(params: RoleListInstanceOptions, callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; /** * Retrieve a single page of RoleInstance 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 { RoleListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; page(params: RoleListInstancePageOptions, callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RoleListInstance(version: V1): RoleListInstance; export declare class RolePage extends Page<V1, RolePayload, RoleResource, RoleInstance> { /** * Initialize the RolePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RoleSolution); /** * Build an instance of RoleInstance * * @param payload - Payload response from the API */ getInstance(payload: RoleResource): RoleInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/participantConversation.js000064400000014715151677225100016231 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.ParticipantConversationPage = exports.ParticipantConversationInstance = exports.ParticipantConversationListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function ParticipantConversationListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/ParticipantConversations`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["identity"] !== undefined) data["Identity"] = params["identity"]; if (params["address"] !== undefined) data["Address"] = params["address"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantConversationPage(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 ParticipantConversationPage(instance._version, payload, 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; } exports.ParticipantConversationListInstance = ParticipantConversationListInstance; class ParticipantConversationInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.participantSid = payload.participant_sid; this.participantUserSid = payload.participant_user_sid; this.participantIdentity = payload.participant_identity; this.participantMessagingBinding = payload.participant_messaging_binding; this.conversationSid = payload.conversation_sid; this.conversationUniqueName = payload.conversation_unique_name; this.conversationFriendlyName = payload.conversation_friendly_name; this.conversationAttributes = payload.conversation_attributes; this.conversationDateCreated = deserialize.iso8601DateTime(payload.conversation_date_created); this.conversationDateUpdated = deserialize.iso8601DateTime(payload.conversation_date_updated); this.conversationCreatedBy = payload.conversation_created_by; this.conversationState = payload.conversation_state; this.conversationTimers = payload.conversation_timers; this.links = payload.links; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, participantSid: this.participantSid, participantUserSid: this.participantUserSid, participantIdentity: this.participantIdentity, participantMessagingBinding: this.participantMessagingBinding, conversationSid: this.conversationSid, conversationUniqueName: this.conversationUniqueName, conversationFriendlyName: this.conversationFriendlyName, conversationAttributes: this.conversationAttributes, conversationDateCreated: this.conversationDateCreated, conversationDateUpdated: this.conversationDateUpdated, conversationCreatedBy: this.conversationCreatedBy, conversationState: this.conversationState, conversationTimers: this.conversationTimers, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantConversationInstance = ParticipantConversationInstance; class ParticipantConversationPage extends Page_1.default { /** * Initialize the ParticipantConversationPage * * @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 ParticipantConversationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ParticipantConversationInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantConversationPage = ParticipantConversationPage; rest/conversations/v1/credential.d.ts000064400000032221151677225100013656 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type CredentialPushType = "apn" | "gcm" | "fcm"; /** * Options to pass to update a CredentialInstance */ export interface CredentialContextUpdateOptions { /** */ type?: CredentialPushType; /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName?: string; /** [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----`. */ certificate?: string; /** [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----`. */ privateKey?: string; /** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox?: boolean; /** [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. */ apiKey?: string; /** [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. */ secret?: string; } /** * Options to pass to create a CredentialInstance */ export interface CredentialListInstanceCreateOptions { /** */ type: CredentialPushType; /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName?: string; /** [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----`. */ certificate?: string; /** [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----`. */ privateKey?: string; /** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox?: boolean; /** [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. */ apiKey?: string; /** [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. */ secret?: string; } /** * Options to pass to each */ export interface CredentialListInstanceEachOptions { /** 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: CredentialInstance, 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 CredentialListInstanceOptions { /** 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 CredentialListInstancePageOptions { /** 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 CredentialContext { /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialContextSolution { sid: string; } export declare class CredentialContextImpl implements CredentialContext { protected _version: V1; protected _solution: CredentialContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; update(params?: CredentialContextUpdateOptions | ((error: Error | null, item?: CredentialInstance) => any), callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialPayload extends TwilioResponsePayload { credentials: CredentialResource[]; } interface CredentialResource { sid: string; account_sid: string; friendly_name: string; type: CredentialPushType; sandbox: string; date_created: Date; date_updated: Date; url: string; } export declare class CredentialInstance { protected _version: V1; protected _solution: CredentialContextSolution; protected _context?: CredentialContext; constructor(_version: V1, payload: CredentialResource, sid?: string); /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this credential. */ accountSid: string; /** * The human-readable name of this credential, limited to 64 characters. Optional. */ friendlyName: string; type: CredentialPushType; /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox: string; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. */ dateUpdated: Date; /** * An absolute API resource URL for this credential. */ url: string; private get _proxy(); /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; type: CredentialPushType; sandbox: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialSolution { } export interface CredentialListInstance { _version: V1; _solution: CredentialSolution; _uri: string; (sid: string): CredentialContext; get(sid: string): CredentialContext; /** * Create a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ create(params: CredentialListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Streams CredentialInstance 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 { CredentialListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListInstanceEachOptions, callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialInstance 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: CredentialPage) => any): Promise<CredentialPage>; /** * Lists CredentialInstance 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 { CredentialListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; list(params: CredentialListInstanceOptions, callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; /** * Retrieve a single page of CredentialInstance 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 { CredentialListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; page(params: CredentialListInstancePageOptions, callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListInstance(version: V1): CredentialListInstance; export declare class CredentialPage extends Page<V1, CredentialPayload, CredentialResource, CredentialInstance> { /** * Initialize the CredentialPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CredentialSolution); /** * Build an instance of CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialResource): CredentialInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/addressConfiguration.js000064400000031035151677225100015467 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.AddressConfigurationPage = exports.AddressConfigurationListInstance = exports.AddressConfigurationInstance = exports.AddressConfigurationContextImpl = void 0; 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 AddressConfigurationContextImpl { 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 = `/Configuration/Addresses/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AddressConfigurationInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["autoCreation.enabled"] !== undefined) data["AutoCreation.Enabled"] = serialize.bool(params["autoCreation.enabled"]); if (params["autoCreation.type"] !== undefined) data["AutoCreation.Type"] = params["autoCreation.type"]; if (params["autoCreation.conversationServiceSid"] !== undefined) data["AutoCreation.ConversationServiceSid"] = params["autoCreation.conversationServiceSid"]; if (params["autoCreation.webhookUrl"] !== undefined) data["AutoCreation.WebhookUrl"] = params["autoCreation.webhookUrl"]; if (params["autoCreation.webhookMethod"] !== undefined) data["AutoCreation.WebhookMethod"] = params["autoCreation.webhookMethod"]; if (params["autoCreation.webhookFilters"] !== undefined) data["AutoCreation.WebhookFilters"] = serialize.map(params["autoCreation.webhookFilters"], (e) => e); if (params["autoCreation.studioFlowSid"] !== undefined) data["AutoCreation.StudioFlowSid"] = params["autoCreation.studioFlowSid"]; if (params["autoCreation.studioRetryCount"] !== undefined) data["AutoCreation.StudioRetryCount"] = params["autoCreation.studioRetryCount"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AddressConfigurationInstance(operationVersion, payload, 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.AddressConfigurationContextImpl = AddressConfigurationContextImpl; class AddressConfigurationInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.type = payload.type; this.address = payload.address; this.friendlyName = payload.friendly_name; this.autoCreation = payload.auto_creation; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.addressCountry = payload.address_country; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AddressConfigurationContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a AddressConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AddressConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressConfigurationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, type: this.type, address: this.address, friendlyName: this.friendlyName, autoCreation: this.autoCreation, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, addressCountry: this.addressCountry, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AddressConfigurationInstance = AddressConfigurationInstance; function AddressConfigurationListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AddressConfigurationContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Configuration/Addresses`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } if (params["address"] === null || params["address"] === undefined) { throw new Error("Required parameter \"params['address']\" missing."); } let data = {}; data["Type"] = params["type"]; data["Address"] = params["address"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["autoCreation.enabled"] !== undefined) data["AutoCreation.Enabled"] = serialize.bool(params["autoCreation.enabled"]); if (params["autoCreation.type"] !== undefined) data["AutoCreation.Type"] = params["autoCreation.type"]; if (params["autoCreation.conversationServiceSid"] !== undefined) data["AutoCreation.ConversationServiceSid"] = params["autoCreation.conversationServiceSid"]; if (params["autoCreation.webhookUrl"] !== undefined) data["AutoCreation.WebhookUrl"] = params["autoCreation.webhookUrl"]; if (params["autoCreation.webhookMethod"] !== undefined) data["AutoCreation.WebhookMethod"] = params["autoCreation.webhookMethod"]; if (params["autoCreation.webhookFilters"] !== undefined) data["AutoCreation.WebhookFilters"] = serialize.map(params["autoCreation.webhookFilters"], (e) => e); if (params["autoCreation.studioFlowSid"] !== undefined) data["AutoCreation.StudioFlowSid"] = params["autoCreation.studioFlowSid"]; if (params["autoCreation.studioRetryCount"] !== undefined) data["AutoCreation.StudioRetryCount"] = params["autoCreation.studioRetryCount"]; if (params["addressCountry"] !== undefined) data["AddressCountry"] = params["addressCountry"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AddressConfigurationInstance(operationVersion, payload)); 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["type"] !== undefined) data["Type"] = params["type"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AddressConfigurationPage(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 AddressConfigurationPage(instance._version, payload, 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; } exports.AddressConfigurationListInstance = AddressConfigurationListInstance; class AddressConfigurationPage extends Page_1.default { /** * Initialize the AddressConfigurationPage * * @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 AddressConfigurationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AddressConfigurationInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AddressConfigurationPage = AddressConfigurationPage; rest/conversations/v1/conversation.d.ts000064400000053306151677225100014265 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { MessageListInstance } from "./conversation/message"; import { ParticipantListInstance } from "./conversation/participant"; import { WebhookListInstance } from "./conversation/webhook"; export type ConversationState = "inactive" | "active" | "closed"; export type ConversationWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a ConversationInstance */ export interface ConversationContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ConversationWebhookEnabledType; } /** * Options to pass to update a ConversationInstance */ export interface ConversationContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ConversationWebhookEnabledType; /** The human-readable name of this conversation, limited to 256 characters. Optional. */ friendlyName?: string; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. */ dateUpdated?: Date; /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. */ messagingServiceSid?: string; /** */ state?: ConversationState; /** ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. */ "timers.inactive"?: string; /** ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. */ "timers.closed"?: string; /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\\\'s `sid` in the URL. */ uniqueName?: string; /** The default email address that will be used when sending outbound emails in this conversation. */ "bindings.email.address"?: string; /** The default name that will be used when sending outbound emails in this conversation. */ "bindings.email.name"?: string; } /** * Options to pass to create a ConversationInstance */ export interface ConversationListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ConversationWebhookEnabledType; /** The human-readable name of this conversation, limited to 256 characters. Optional. */ friendlyName?: string; /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\\\'s `sid` in the URL. */ uniqueName?: string; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. */ dateUpdated?: Date; /** The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. */ messagingServiceSid?: string; /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** */ state?: ConversationState; /** ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. */ "timers.inactive"?: string; /** ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. */ "timers.closed"?: string; /** The default email address that will be used when sending outbound emails in this conversation. */ "bindings.email.address"?: string; /** The default name that will be used when sending outbound emails in this conversation. */ "bindings.email.name"?: string; } /** * Options to pass to each */ export interface ConversationListInstanceEachOptions { /** Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ startDate?: string; /** Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ endDate?: string; /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ state?: ConversationState; /** 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: ConversationInstance, 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 ConversationListInstanceOptions { /** Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ startDate?: string; /** Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ endDate?: string; /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ state?: ConversationState; /** 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 ConversationListInstancePageOptions { /** Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ startDate?: string; /** Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ endDate?: string; /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ state?: ConversationState; /** 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 ConversationContext { messages: MessageListInstance; participants: ParticipantListInstance; webhooks: WebhookListInstance; /** * Remove a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ remove(params: ConversationContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ fetch(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Update a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ update(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Update a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ update(params: ConversationContextUpdateOptions, callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConversationContextSolution { sid: string; } export declare class ConversationContextImpl implements ConversationContext { protected _version: V1; protected _solution: ConversationContextSolution; protected _uri: string; protected _messages?: MessageListInstance; protected _participants?: ParticipantListInstance; protected _webhooks?: WebhookListInstance; constructor(_version: V1, sid: string); get messages(): MessageListInstance; get participants(): ParticipantListInstance; get webhooks(): WebhookListInstance; remove(params?: ConversationContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; update(params?: ConversationContextUpdateOptions | ((error: Error | null, item?: ConversationInstance) => any), callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConversationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConversationPayload extends TwilioResponsePayload { conversations: ConversationResource[]; } interface ConversationResource { account_sid: string; chat_service_sid: string; messaging_service_sid: string; sid: string; friendly_name: string; unique_name: string; attributes: string; state: ConversationState; date_created: Date; date_updated: Date; timers: any; url: string; links: Record<string, string>; bindings: any; } export declare class ConversationInstance { protected _version: V1; protected _solution: ConversationContextSolution; protected _context?: ConversationContext; constructor(_version: V1, payload: ConversationResource, sid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. */ accountSid: string; /** * The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. */ chatServiceSid: string; /** * The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. */ messagingServiceSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The human-readable name of this conversation, limited to 256 characters. Optional. */ friendlyName: string; /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\'s `sid` in the URL. */ uniqueName: string; /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. */ attributes: string; state: ConversationState; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. */ dateUpdated: Date; /** * Timer date values representing state update for this conversation. */ timers: any; /** * An absolute API resource URL for this conversation. */ url: string; /** * Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. */ links: Record<string, string>; bindings: any; private get _proxy(); /** * Remove a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ remove(params: ConversationContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ fetch(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Update a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ update(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Update a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ update(params: ConversationContextUpdateOptions, callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Access the messages. */ messages(): MessageListInstance; /** * Access the participants. */ participants(): ParticipantListInstance; /** * Access the webhooks. */ webhooks(): WebhookListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; messagingServiceSid: string; sid: string; friendlyName: string; uniqueName: string; attributes: string; state: ConversationState; dateCreated: Date; dateUpdated: Date; timers: any; url: string; links: Record<string, string>; bindings: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConversationSolution { } export interface ConversationListInstance { _version: V1; _solution: ConversationSolution; _uri: string; (sid: string): ConversationContext; get(sid: string): ConversationContext; /** * Create a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ create(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Create a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ create(params: ConversationListInstanceCreateOptions, callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Streams ConversationInstance 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 { ConversationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ConversationInstance, done: (err?: Error) => void) => void): void; each(params: ConversationListInstanceEachOptions, callback?: (item: ConversationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ConversationInstance 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: ConversationPage) => any): Promise<ConversationPage>; /** * Lists ConversationInstance 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 { ConversationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ConversationInstance[]) => any): Promise<ConversationInstance[]>; list(params: ConversationListInstanceOptions, callback?: (error: Error | null, items: ConversationInstance[]) => any): Promise<ConversationInstance[]>; /** * Retrieve a single page of ConversationInstance 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 { ConversationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ConversationPage) => any): Promise<ConversationPage>; page(params: ConversationListInstancePageOptions, callback?: (error: Error | null, items: ConversationPage) => any): Promise<ConversationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConversationListInstance(version: V1): ConversationListInstance; export declare class ConversationPage extends Page<V1, ConversationPayload, ConversationResource, ConversationInstance> { /** * Initialize the ConversationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ConversationSolution); /** * Build an instance of ConversationInstance * * @param payload - Payload response from the API */ getInstance(payload: ConversationResource): ConversationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/credential.js000064400000024330151677225100013424 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.CredentialPage = exports.CredentialListInstance = exports.CredentialInstance = exports.CredentialContextImpl = void 0; 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 CredentialContextImpl { 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/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, 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["type"] !== undefined) data["Type"] = params["type"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, 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.CredentialContextImpl = CredentialContextImpl; class CredentialInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.sandbox = payload.sandbox; 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 CredentialContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, type: this.type, sandbox: this.sandbox, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialInstance = CredentialInstance; function CredentialListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Credentials`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["Type"] = params["type"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialPage(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 CredentialPage(instance._version, payload, 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; } exports.CredentialListInstance = CredentialListInstance; class CredentialPage extends Page_1.default { /** * Initialize the CredentialPage * * @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 CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialPage = CredentialPage; rest/conversations/v1/user.d.ts000064400000035733151677225100012535 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { UserConversationListInstance } from "./user/userConversation"; export type UserWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a UserInstance */ export interface UserContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; } /** * Options to pass to update a UserInstance */ export interface UserContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes?: string; /** The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. */ roleSid?: string; } /** * Options to pass to create a UserInstance */ export interface UserListInstanceCreateOptions { /** The application-defined string that uniquely identifies the resource\\\'s User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. */ identity: string; /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes?: string; /** The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. */ roleSid?: string; } /** * Options to pass to each */ export interface UserListInstanceEachOptions { /** 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: UserInstance, 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 UserListInstanceOptions { /** 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 UserListInstancePageOptions { /** 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 UserContext { userConversations: UserConversationListInstance; /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ remove(params: UserContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserContextSolution { sid: string; } export declare class UserContextImpl implements UserContext { protected _version: V1; protected _solution: UserContextSolution; protected _uri: string; protected _userConversations?: UserConversationListInstance; constructor(_version: V1, sid: string); get userConversations(): UserConversationListInstance; remove(params?: UserContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; update(params?: UserContextUpdateOptions | ((error: Error | null, item?: UserInstance) => any), callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserPayload extends TwilioResponsePayload { users: UserResource[]; } interface UserResource { sid: string; account_sid: string; chat_service_sid: string; role_sid: string; identity: string; friendly_name: string; attributes: string; is_online: boolean; is_notifiable: boolean; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class UserInstance { protected _version: V1; protected _solution: UserContextSolution; protected _context?: UserContext; constructor(_version: V1, payload: UserResource, sid?: string); /** * The unique string that we created to identify the User resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. */ chatServiceSid: string; /** * The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. */ roleSid: string; /** * The application-defined string that uniquely identifies the resource\'s User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. */ identity: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes: string; /** * Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service\'s `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service\'s `reachability_enabled` is `true`. */ isOnline: boolean; /** * Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service\'s `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service\'s `reachability_enabled` is `true`. */ isNotifiable: boolean; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * An absolute API resource URL for this user. */ url: string; links: Record<string, string>; private get _proxy(); /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ remove(params: UserContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Access the userConversations. */ userConversations(): UserConversationListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; chatServiceSid: string; roleSid: string; identity: string; friendlyName: string; attributes: string; isOnline: boolean; isNotifiable: boolean; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserSolution { } export interface UserListInstance { _version: V1; _solution: UserSolution; _uri: string; (sid: string): UserContext; get(sid: string): UserContext; /** * Create a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ create(params: UserListInstanceCreateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Streams UserInstance 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 { UserListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; each(params: UserListInstanceEachOptions, callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserInstance 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: UserPage) => any): Promise<UserPage>; /** * Lists UserInstance 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 { UserListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; list(params: UserListInstanceOptions, callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; /** * Retrieve a single page of UserInstance 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 { UserListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; page(params: UserListInstancePageOptions, callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserListInstance(version: V1): UserListInstance; export declare class UserPage extends Page<V1, UserPayload, UserResource, UserInstance> { /** * Initialize the UserPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UserSolution); /** * Build an instance of UserInstance * * @param payload - Payload response from the API */ getInstance(payload: UserResource): UserInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/user/userConversation.d.ts000064400000034245151677225100017543 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type UserConversationNotificationLevel = "default" | "muted"; export type UserConversationState = "inactive" | "active" | "closed"; /** * Options to pass to update a UserConversationInstance */ export interface UserConversationContextUpdateOptions { /** */ notificationLevel?: UserConversationNotificationLevel; /** The date of the last message read in conversation by the user, given in ISO 8601 format. */ lastReadTimestamp?: Date; /** The index of the last Message in the Conversation that the Participant has read. */ lastReadMessageIndex?: number; } /** * Options to pass to each */ export interface UserConversationListInstanceEachOptions { /** 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: UserConversationInstance, 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 UserConversationListInstanceOptions { /** 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 UserConversationListInstancePageOptions { /** 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 UserConversationContext { /** * Remove a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ fetch(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Update a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ update(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Update a UserConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ update(params: UserConversationContextUpdateOptions, callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserConversationContextSolution { chatServiceSid: string; userSid: string; conversationSid: string; } export declare class UserConversationContextImpl implements UserConversationContext { protected _version: V1; protected _solution: UserConversationContextSolution; protected _uri: string; constructor(_version: V1, chatServiceSid: string, userSid: string, conversationSid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; update(params?: UserConversationContextUpdateOptions | ((error: Error | null, item?: UserConversationInstance) => any), callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserConversationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserConversationPayload extends TwilioResponsePayload { conversations: UserConversationResource[]; } interface UserConversationResource { account_sid: string; chat_service_sid: string; conversation_sid: string; unread_messages_count: number; last_read_message_index: number; participant_sid: string; user_sid: string; friendly_name: string; conversation_state: UserConversationState; timers: any; attributes: string; date_created: Date; date_updated: Date; created_by: string; notification_level: UserConversationNotificationLevel; unique_name: string; url: string; links: Record<string, string>; } export declare class UserConversationInstance { protected _version: V1; protected _solution: UserConversationContextSolution; protected _context?: UserConversationContext; constructor(_version: V1, payload: UserConversationResource, chatServiceSid: string, userSid: string, conversationSid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. */ accountSid: string; /** * The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. */ chatServiceSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. */ conversationSid: string; /** * The number of unread Messages in the Conversation for the Participant. */ unreadMessagesCount: number; /** * The index of the last Message in the Conversation that the Participant has read. */ lastReadMessageIndex: number; /** * The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. */ participantSid: string; /** * The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). */ userSid: string; /** * The human-readable name of this conversation, limited to 256 characters. Optional. */ friendlyName: string; conversationState: UserConversationState; /** * Timer date values representing state update for this conversation. */ timers: any; /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. */ attributes: string; /** * The date that this conversation was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this conversation was last updated, given in ISO 8601 format. */ dateUpdated: Date; /** * Identity of the creator of this Conversation. */ createdBy: string; notificationLevel: UserConversationNotificationLevel; /** * An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource\'s `conversation_sid` in the URL. */ uniqueName: string; url: string; /** * Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. */ links: Record<string, string>; private get _proxy(); /** * Remove a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ fetch(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Update a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ update(callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Update a UserConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ update(params: UserConversationContextUpdateOptions, callback?: (error: Error | null, item?: UserConversationInstance) => any): Promise<UserConversationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; conversationSid: string; unreadMessagesCount: number; lastReadMessageIndex: number; participantSid: string; userSid: string; friendlyName: string; conversationState: UserConversationState; timers: any; attributes: string; dateCreated: Date; dateUpdated: Date; createdBy: string; notificationLevel: UserConversationNotificationLevel; uniqueName: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserConversationSolution { chatServiceSid: string; userSid: string; } export interface UserConversationListInstance { _version: V1; _solution: UserConversationSolution; _uri: string; (conversationSid: string): UserConversationContext; get(conversationSid: string): UserConversationContext; /** * Streams UserConversationInstance 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 { UserConversationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserConversationInstance, done: (err?: Error) => void) => void): void; each(params: UserConversationListInstanceEachOptions, callback?: (item: UserConversationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserConversationInstance 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: UserConversationPage) => any): Promise<UserConversationPage>; /** * Lists UserConversationInstance 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 { UserConversationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserConversationInstance[]) => any): Promise<UserConversationInstance[]>; list(params: UserConversationListInstanceOptions, callback?: (error: Error | null, items: UserConversationInstance[]) => any): Promise<UserConversationInstance[]>; /** * Retrieve a single page of UserConversationInstance 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 { UserConversationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserConversationPage) => any): Promise<UserConversationPage>; page(params: UserConversationListInstancePageOptions, callback?: (error: Error | null, items: UserConversationPage) => any): Promise<UserConversationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserConversationListInstance(version: V1, chatServiceSid: string, userSid: string): UserConversationListInstance; export declare class UserConversationPage extends Page<V1, UserConversationPayload, UserConversationResource, UserConversationInstance> { /** * Initialize the UserConversationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UserConversationSolution); /** * Build an instance of UserConversationInstance * * @param payload - Payload response from the API */ getInstance(payload: UserConversationResource): UserConversationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/user/userConversation.js000064400000025671151677225100017312 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.UserConversationPage = exports.UserConversationListInstance = exports.UserConversationInstance = exports.UserConversationContextImpl = void 0; 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 UserConversationContextImpl { constructor(_version, chatServiceSid, userSid, conversationSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } this._solution = { chatServiceSid, userSid, conversationSid }; this._uri = `/Services/${chatServiceSid}/Users/${userSid}/Conversations/${conversationSid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserConversationInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.userSid, instance._solution.conversationSid)); 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["notificationLevel"] !== undefined) data["NotificationLevel"] = params["notificationLevel"]; if (params["lastReadTimestamp"] !== undefined) data["LastReadTimestamp"] = serialize.iso8601DateTime(params["lastReadTimestamp"]); if (params["lastReadMessageIndex"] !== undefined) data["LastReadMessageIndex"] = params["lastReadMessageIndex"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserConversationInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.userSid, instance._solution.conversationSid)); 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.UserConversationContextImpl = UserConversationContextImpl; class UserConversationInstance { constructor(_version, payload, chatServiceSid, userSid, conversationSid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.conversationSid = payload.conversation_sid; this.unreadMessagesCount = deserialize.integer(payload.unread_messages_count); this.lastReadMessageIndex = deserialize.integer(payload.last_read_message_index); this.participantSid = payload.participant_sid; this.userSid = payload.user_sid; this.friendlyName = payload.friendly_name; this.conversationState = payload.conversation_state; this.timers = payload.timers; this.attributes = payload.attributes; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.createdBy = payload.created_by; this.notificationLevel = payload.notification_level; this.uniqueName = payload.unique_name; this.url = payload.url; this.links = payload.links; this._solution = { chatServiceSid, userSid, conversationSid: conversationSid || this.conversationSid, }; } get _proxy() { this._context = this._context || new UserConversationContextImpl(this._version, this._solution.chatServiceSid, this._solution.userSid, this._solution.conversationSid); return this._context; } /** * Remove a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UserConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserConversationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, conversationSid: this.conversationSid, unreadMessagesCount: this.unreadMessagesCount, lastReadMessageIndex: this.lastReadMessageIndex, participantSid: this.participantSid, userSid: this.userSid, friendlyName: this.friendlyName, conversationState: this.conversationState, timers: this.timers, attributes: this.attributes, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, createdBy: this.createdBy, notificationLevel: this.notificationLevel, uniqueName: this.uniqueName, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserConversationInstance = UserConversationInstance; function UserConversationListInstance(version, chatServiceSid, userSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(userSid)) { throw new Error("Parameter 'userSid' is not valid."); } const instance = ((conversationSid) => instance.get(conversationSid)); instance.get = function get(conversationSid) { return new UserConversationContextImpl(version, chatServiceSid, userSid, conversationSid); }; instance._version = version; instance._solution = { chatServiceSid, userSid }; instance._uri = `/Services/${chatServiceSid}/Users/${userSid}/Conversations`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserConversationPage(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 UserConversationPage(instance._version, payload, 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; } exports.UserConversationListInstance = UserConversationListInstance; class UserConversationPage extends Page_1.default { /** * Initialize the UserConversationPage * * @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 UserConversationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserConversationInstance(this._version, payload, this._solution.chatServiceSid, this._solution.userSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserConversationPage = UserConversationPage; rest/conversations/v1/service/binding.d.ts000064400000026663151677225100014633 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type BindingBindingType = "apn" | "gcm" | "fcm"; /** * Options to pass to each */ export interface BindingListInstanceEachOptions { /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ bindingType?: Array<BindingBindingType>; /** The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: BindingInstance, 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 BindingListInstanceOptions { /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ bindingType?: Array<BindingBindingType>; /** The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface BindingListInstancePageOptions { /** The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ bindingType?: Array<BindingBindingType>; /** The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details. */ identity?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface BindingContext { /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BindingContextSolution { chatServiceSid: string; sid: string; } export declare class BindingContextImpl implements BindingContext { protected _version: V1; protected _solution: BindingContextSolution; protected _uri: string; constructor(_version: V1, chatServiceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BindingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BindingPayload extends TwilioResponsePayload { bindings: BindingResource[]; } interface BindingResource { sid: string; account_sid: string; chat_service_sid: string; credential_sid: string; date_created: Date; date_updated: Date; endpoint: string; identity: string; binding_type: BindingBindingType; message_types: Array<string>; url: string; } export declare class BindingInstance { protected _version: V1; protected _solution: BindingContextSolution; protected _context?: BindingContext; constructor(_version: V1, payload: BindingResource, chatServiceSid: string, sid?: string); /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this binding. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Binding resource is associated with. */ chatServiceSid: string; /** * The SID of the [Credential](https://www.twilio.com/docs/conversations/api/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. */ credentialSid: string; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. */ dateUpdated: Date; /** * The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. */ endpoint: string; /** * The application-defined string that uniquely identifies the [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more info. */ identity: string; bindingType: BindingBindingType; /** * The [Conversation message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. */ messageTypes: Array<string>; /** * An absolute API resource URL for this binding. */ url: string; private get _proxy(); /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; chatServiceSid: string; credentialSid: string; dateCreated: Date; dateUpdated: Date; endpoint: string; identity: string; bindingType: BindingBindingType; messageTypes: string[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BindingSolution { chatServiceSid: string; } export interface BindingListInstance { _version: V1; _solution: BindingSolution; _uri: string; (sid: string): BindingContext; get(sid: string): BindingContext; /** * Streams BindingInstance 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 { BindingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void; each(params: BindingListInstanceEachOptions, callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BindingInstance 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: BindingPage) => any): Promise<BindingPage>; /** * Lists BindingInstance 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 { BindingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>; list(params: BindingListInstanceOptions, callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>; /** * Retrieve a single page of BindingInstance 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 { BindingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>; page(params: BindingListInstancePageOptions, callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BindingListInstance(version: V1, chatServiceSid: string): BindingListInstance; export declare class BindingPage extends Page<V1, BindingPayload, BindingResource, BindingInstance> { /** * Initialize the BindingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: BindingSolution); /** * Build an instance of BindingInstance * * @param payload - Payload response from the API */ getInstance(payload: BindingResource): BindingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/configuration/notification.js000064400000016520151677225100020311 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.NotificationListInstance = exports.NotificationInstance = exports.NotificationContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class NotificationContextImpl { constructor(_version, chatServiceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } this._solution = { chatServiceSid }; this._uri = `/Services/${chatServiceSid}/Configuration/Notifications`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new NotificationInstance(operationVersion, payload, instance._solution.chatServiceSid)); 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["logEnabled"] !== undefined) data["LogEnabled"] = serialize.bool(params["logEnabled"]); if (params["newMessage.enabled"] !== undefined) data["NewMessage.Enabled"] = serialize.bool(params["newMessage.enabled"]); if (params["newMessage.template"] !== undefined) data["NewMessage.Template"] = params["newMessage.template"]; if (params["newMessage.sound"] !== undefined) data["NewMessage.Sound"] = params["newMessage.sound"]; if (params["newMessage.badgeCountEnabled"] !== undefined) data["NewMessage.BadgeCountEnabled"] = serialize.bool(params["newMessage.badgeCountEnabled"]); if (params["addedToConversation.enabled"] !== undefined) data["AddedToConversation.Enabled"] = serialize.bool(params["addedToConversation.enabled"]); if (params["addedToConversation.template"] !== undefined) data["AddedToConversation.Template"] = params["addedToConversation.template"]; if (params["addedToConversation.sound"] !== undefined) data["AddedToConversation.Sound"] = params["addedToConversation.sound"]; if (params["removedFromConversation.enabled"] !== undefined) data["RemovedFromConversation.Enabled"] = serialize.bool(params["removedFromConversation.enabled"]); if (params["removedFromConversation.template"] !== undefined) data["RemovedFromConversation.Template"] = params["removedFromConversation.template"]; if (params["removedFromConversation.sound"] !== undefined) data["RemovedFromConversation.Sound"] = params["removedFromConversation.sound"]; if (params["newMessage.withMedia.enabled"] !== undefined) data["NewMessage.WithMedia.Enabled"] = serialize.bool(params["newMessage.withMedia.enabled"]); if (params["newMessage.withMedia.template"] !== undefined) data["NewMessage.WithMedia.Template"] = params["newMessage.withMedia.template"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new NotificationInstance(operationVersion, payload, instance._solution.chatServiceSid)); 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.NotificationContextImpl = NotificationContextImpl; class NotificationInstance { constructor(_version, payload, chatServiceSid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.newMessage = payload.new_message; this.addedToConversation = payload.added_to_conversation; this.removedFromConversation = payload.removed_from_conversation; this.logEnabled = payload.log_enabled; this.url = payload.url; this._solution = { chatServiceSid }; } get _proxy() { this._context = this._context || new NotificationContextImpl(this._version, this._solution.chatServiceSid); return this._context; } /** * Fetch a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, newMessage: this.newMessage, addedToConversation: this.addedToConversation, removedFromConversation: this.removedFromConversation, logEnabled: this.logEnabled, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NotificationInstance = NotificationInstance; function NotificationListInstance(version, chatServiceSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new NotificationContextImpl(version, chatServiceSid); }; instance._version = version; instance._solution = { chatServiceSid }; 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; } exports.NotificationListInstance = NotificationListInstance; rest/conversations/v1/service/configuration/webhook.d.ts000064400000015041151677225100017512 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; export type WebhookMethod = "GET" | "POST"; /** * Options to pass to update a WebhookInstance */ export interface WebhookContextUpdateOptions { /** The absolute url the pre-event webhook request should be sent to. */ preWebhookUrl?: string; /** The absolute url the post-event webhook request should be sent to. */ postWebhookUrl?: string; /** The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`. */ filters?: Array<string>; /** The HTTP method to be used when sending a webhook request. One of `GET` or `POST`. */ method?: string; } export interface WebhookContext { /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WebhookContextSolution { chatServiceSid: string; } export declare class WebhookContextImpl implements WebhookContext { protected _version: V1; protected _solution: WebhookContextSolution; protected _uri: string; constructor(_version: V1, chatServiceSid: string); fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; update(params?: WebhookContextUpdateOptions | ((error: Error | null, item?: WebhookInstance) => any), callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WebhookContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WebhookResource { account_sid: string; chat_service_sid: string; pre_webhook_url: string; post_webhook_url: string; filters: Array<string>; method: WebhookMethod; url: string; } export declare class WebhookInstance { protected _version: V1; protected _solution: WebhookContextSolution; protected _context?: WebhookContext; constructor(_version: V1, payload: WebhookResource, chatServiceSid: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. */ accountSid: string; /** * The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. */ chatServiceSid: string; /** * The absolute url the pre-event webhook request should be sent to. */ preWebhookUrl: string; /** * The absolute url the post-event webhook request should be sent to. */ postWebhookUrl: string; /** * The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`. */ filters: Array<string>; method: WebhookMethod; /** * An absolute API resource URL for this webhook. */ url: string; private get _proxy(); /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; preWebhookUrl: string; postWebhookUrl: string; filters: string[]; method: WebhookMethod; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WebhookSolution { chatServiceSid: string; } export interface WebhookListInstance { _version: V1; _solution: WebhookSolution; _uri: string; (): WebhookContext; get(): WebhookContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WebhookListInstance(version: V1, chatServiceSid: string): WebhookListInstance; export {}; rest/conversations/v1/service/configuration/notification.d.ts000064400000017164151677225100020552 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to update a NotificationInstance */ export interface NotificationContextUpdateOptions { /** Weather the notification logging is enabled. */ logEnabled?: boolean; /** Whether to send a notification when a new message is added to a conversation. The default is `false`. */ "newMessage.enabled"?: boolean; /** The template to use to create the notification text displayed when a new message is added to a conversation and `new_message.enabled` is `true`. */ "newMessage.template"?: string; /** The name of the sound to play when a new message is added to a conversation and `new_message.enabled` is `true`. */ "newMessage.sound"?: string; /** Whether the new message badge is enabled. The default is `false`. */ "newMessage.badgeCountEnabled"?: boolean; /** Whether to send a notification when a participant is added to a conversation. The default is `false`. */ "addedToConversation.enabled"?: boolean; /** The template to use to create the notification text displayed when a participant is added to a conversation and `added_to_conversation.enabled` is `true`. */ "addedToConversation.template"?: string; /** The name of the sound to play when a participant is added to a conversation and `added_to_conversation.enabled` is `true`. */ "addedToConversation.sound"?: string; /** Whether to send a notification to a user when they are removed from a conversation. The default is `false`. */ "removedFromConversation.enabled"?: boolean; /** The template to use to create the notification text displayed to a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`. */ "removedFromConversation.template"?: string; /** The name of the sound to play to a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`. */ "removedFromConversation.sound"?: string; /** Whether to send a notification when a new message with media/file attachments is added to a conversation. The default is `false`. */ "newMessage.withMedia.enabled"?: boolean; /** The template to use to create the notification text displayed when a new message with media/file attachments is added to a conversation and `new_message.attachments.enabled` is `true`. */ "newMessage.withMedia.template"?: string; } export interface NotificationContext { /** * Fetch a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ fetch(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Update a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ update(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Update a NotificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ update(params: NotificationContextUpdateOptions, callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface NotificationContextSolution { chatServiceSid: string; } export declare class NotificationContextImpl implements NotificationContext { protected _version: V1; protected _solution: NotificationContextSolution; protected _uri: string; constructor(_version: V1, chatServiceSid: string); fetch(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; update(params?: NotificationContextUpdateOptions | ((error: Error | null, item?: NotificationInstance) => any), callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): NotificationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface NotificationResource { account_sid: string; chat_service_sid: string; new_message: any; added_to_conversation: any; removed_from_conversation: any; log_enabled: boolean; url: string; } export declare class NotificationInstance { protected _version: V1; protected _solution: NotificationContextSolution; protected _context?: NotificationContext; constructor(_version: V1, payload: NotificationResource, chatServiceSid: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Configuration applies to. */ chatServiceSid: string; /** * The Push Notification configuration for New Messages. */ newMessage: any; /** * The Push Notification configuration for being added to a Conversation. */ addedToConversation: any; /** * The Push Notification configuration for being removed from a Conversation. */ removedFromConversation: any; /** * Weather the notification logging is enabled. */ logEnabled: boolean; /** * An absolute API resource URL for this configuration. */ url: string; private get _proxy(); /** * Fetch a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ fetch(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Update a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ update(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Update a NotificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ update(params: NotificationContextUpdateOptions, callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; newMessage: any; addedToConversation: any; removedFromConversation: any; logEnabled: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface NotificationSolution { chatServiceSid: string; } export interface NotificationListInstance { _version: V1; _solution: NotificationSolution; _uri: string; (): NotificationContext; get(): NotificationContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NotificationListInstance(version: V1, chatServiceSid: string): NotificationListInstance; export {}; rest/conversations/v1/service/configuration/webhook.js000064400000013067151677225100017264 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.WebhookListInstance = exports.WebhookInstance = exports.WebhookContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class WebhookContextImpl { constructor(_version, chatServiceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } this._solution = { chatServiceSid }; this._uri = `/Services/${chatServiceSid}/Configuration/Webhooks`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.chatServiceSid)); 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["preWebhookUrl"] !== undefined) data["PreWebhookUrl"] = params["preWebhookUrl"]; if (params["postWebhookUrl"] !== undefined) data["PostWebhookUrl"] = params["postWebhookUrl"]; if (params["filters"] !== undefined) data["Filters"] = serialize.map(params["filters"], (e) => e); if (params["method"] !== undefined) data["Method"] = params["method"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.chatServiceSid)); 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.WebhookContextImpl = WebhookContextImpl; class WebhookInstance { constructor(_version, payload, chatServiceSid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.preWebhookUrl = payload.pre_webhook_url; this.postWebhookUrl = payload.post_webhook_url; this.filters = payload.filters; this.method = payload.method; this.url = payload.url; this._solution = { chatServiceSid }; } get _proxy() { this._context = this._context || new WebhookContextImpl(this._version, this._solution.chatServiceSid); return this._context; } /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, preWebhookUrl: this.preWebhookUrl, postWebhookUrl: this.postWebhookUrl, filters: this.filters, method: this.method, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookInstance = WebhookInstance; function WebhookListInstance(version, chatServiceSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WebhookContextImpl(version, chatServiceSid); }; instance._version = version; instance._solution = { chatServiceSid }; 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; } exports.WebhookListInstance = WebhookListInstance; rest/conversations/v1/service/configuration.d.ts000064400000016510151677225100016056 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; import { NotificationListInstance } from "./configuration/notification"; import { WebhookListInstance } from "./configuration/webhook"; /** * Options to pass to update a ConfigurationInstance */ export interface ConfigurationContextUpdateOptions { /** The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. */ defaultConversationCreatorRoleSid?: string; /** The conversation-level role assigned to users when they are added to a conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. */ defaultConversationRoleSid?: string; /** The service-level role assigned to users when they are added to the service. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. */ defaultChatServiceRoleSid?: string; /** Whether the [Reachability Indicator](https://www.twilio.com/docs/conversations/reachability) is enabled for this Conversations Service. The default is `false`. */ reachabilityEnabled?: boolean; } export interface ConfigurationContext { /** * Fetch a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(params: ConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConfigurationContextSolution { chatServiceSid: string; } export declare class ConfigurationContextImpl implements ConfigurationContext { protected _version: V1; protected _solution: ConfigurationContextSolution; protected _uri: string; constructor(_version: V1, chatServiceSid: string); fetch(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; update(params?: ConfigurationContextUpdateOptions | ((error: Error | null, item?: ConfigurationInstance) => any), callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConfigurationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConfigurationResource { chat_service_sid: string; default_conversation_creator_role_sid: string; default_conversation_role_sid: string; default_chat_service_role_sid: string; url: string; links: Record<string, string>; reachability_enabled: boolean; } export declare class ConfigurationInstance { protected _version: V1; protected _solution: ConfigurationContextSolution; protected _context?: ConfigurationContext; constructor(_version: V1, payload: ConfigurationResource, chatServiceSid: string); /** * The unique string that we created to identify the Service configuration resource. */ chatServiceSid: string; /** * The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. */ defaultConversationCreatorRoleSid: string; /** * The conversation-level role assigned to users when they are added to a conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. */ defaultConversationRoleSid: string; /** * The service-level role assigned to users when they are added to the service. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. */ defaultChatServiceRoleSid: string; /** * An absolute API resource URL for this service configuration. */ url: string; /** * Contains an absolute API resource URL to access the push notifications configuration of this service. */ links: Record<string, string>; /** * Whether the [Reachability Indicator](https://www.twilio.com/docs/conversations/reachability) is enabled for this Conversations Service. The default is `false`. */ reachabilityEnabled: boolean; private get _proxy(); /** * Fetch a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(params: ConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { chatServiceSid: string; defaultConversationCreatorRoleSid: string; defaultConversationRoleSid: string; defaultChatServiceRoleSid: string; url: string; links: Record<string, string>; reachabilityEnabled: boolean; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConfigurationSolution { chatServiceSid: string; } export interface ConfigurationListInstance { _version: V1; _solution: ConfigurationSolution; _uri: string; (): ConfigurationContext; get(): ConfigurationContext; _notifications?: NotificationListInstance; notifications: NotificationListInstance; _webhooks?: WebhookListInstance; webhooks: WebhookListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConfigurationListInstance(version: V1, chatServiceSid: string): ConfigurationListInstance; export {}; rest/conversations/v1/service/conversation.js000064400000035006151677225100015466 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.ConversationPage = exports.ConversationListInstance = exports.ConversationInstance = exports.ConversationContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const message_1 = require("./conversation/message"); const participant_1 = require("./conversation/participant"); const webhook_1 = require("./conversation/webhook"); class ConversationContextImpl { constructor(_version, chatServiceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { chatServiceSid, sid }; this._uri = `/Services/${chatServiceSid}/Conversations/${sid}`; } get messages() { this._messages = this._messages || (0, message_1.MessageListInstance)(this._version, this._solution.chatServiceSid, this._solution.sid); return this._messages; } get participants() { this._participants = this._participants || (0, participant_1.ParticipantListInstance)(this._version, this._solution.chatServiceSid, this._solution.sid); return this._participants; } get webhooks() { this._webhooks = this._webhooks || (0, webhook_1.WebhookListInstance)(this._version, this._solution.chatServiceSid, this._solution.sid); return this._webhooks; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["messagingServiceSid"] !== undefined) data["MessagingServiceSid"] = params["messagingServiceSid"]; if (params["state"] !== undefined) data["State"] = params["state"]; if (params["timers.inactive"] !== undefined) data["Timers.Inactive"] = params["timers.inactive"]; if (params["timers.closed"] !== undefined) data["Timers.Closed"] = params["timers.closed"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["bindings.email.address"] !== undefined) data["Bindings.Email.Address"] = params["bindings.email.address"]; if (params["bindings.email.name"] !== undefined) data["Bindings.Email.Name"] = params["bindings.email.name"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload, instance._solution.chatServiceSid, 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.ConversationContextImpl = ConversationContextImpl; class ConversationInstance { constructor(_version, payload, chatServiceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.messagingServiceSid = payload.messaging_service_sid; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.attributes = payload.attributes; this.state = payload.state; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.timers = payload.timers; this.url = payload.url; this.links = payload.links; this.bindings = payload.bindings; this._solution = { chatServiceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ConversationContextImpl(this._version, this._solution.chatServiceSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the messages. */ messages() { return this._proxy.messages; } /** * Access the participants. */ participants() { return this._proxy.participants; } /** * Access the webhooks. */ webhooks() { return this._proxy.webhooks; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, messagingServiceSid: this.messagingServiceSid, sid: this.sid, friendlyName: this.friendlyName, uniqueName: this.uniqueName, attributes: this.attributes, state: this.state, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, timers: this.timers, url: this.url, links: this.links, bindings: this.bindings, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConversationInstance = ConversationInstance; function ConversationListInstance(version, chatServiceSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ConversationContextImpl(version, chatServiceSid, sid); }; instance._version = version; instance._solution = { chatServiceSid }; instance._uri = `/Services/${chatServiceSid}/Conversations`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["messagingServiceSid"] !== undefined) data["MessagingServiceSid"] = params["messagingServiceSid"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["state"] !== undefined) data["State"] = params["state"]; if (params["timers.inactive"] !== undefined) data["Timers.Inactive"] = params["timers.inactive"]; if (params["timers.closed"] !== undefined) data["Timers.Closed"] = params["timers.closed"]; if (params["bindings.email.address"] !== undefined) data["Bindings.Email.Address"] = params["bindings.email.address"]; if (params["bindings.email.name"] !== undefined) data["Bindings.Email.Name"] = params["bindings.email.name"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConversationInstance(operationVersion, payload, instance._solution.chatServiceSid)); 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["startDate"] !== undefined) data["StartDate"] = params["startDate"]; if (params["endDate"] !== undefined) data["EndDate"] = params["endDate"]; if (params["state"] !== undefined) data["State"] = params["state"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConversationPage(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 ConversationPage(instance._version, payload, 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; } exports.ConversationListInstance = ConversationListInstance; class ConversationPage extends Page_1.default { /** * Initialize the ConversationPage * * @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 ConversationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ConversationInstance(this._version, payload, this._solution.chatServiceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConversationPage = ConversationPage; rest/conversations/v1/service/conversation/message.js000064400000032445151677225100017116 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.MessagePage = exports.MessageListInstance = exports.MessageInstance = exports.MessageContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const deliveryReceipt_1 = require("./message/deliveryReceipt"); class MessageContextImpl { constructor(_version, chatServiceSid, conversationSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { chatServiceSid, conversationSid, sid }; this._uri = `/Services/${chatServiceSid}/Conversations/${conversationSid}/Messages/${sid}`; } get deliveryReceipts() { this._deliveryReceipts = this._deliveryReceipts || (0, deliveryReceipt_1.DeliveryReceiptListInstance)(this._version, this._solution.chatServiceSid, this._solution.conversationSid, this._solution.sid); return this._deliveryReceipts; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid, 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["author"] !== undefined) data["Author"] = params["author"]; if (params["body"] !== undefined) data["Body"] = params["body"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["subject"] !== undefined) data["Subject"] = params["subject"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid, 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.MessageContextImpl = MessageContextImpl; class MessageInstance { constructor(_version, payload, chatServiceSid, conversationSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.conversationSid = payload.conversation_sid; this.sid = payload.sid; this.index = deserialize.integer(payload.index); this.author = payload.author; this.body = payload.body; this.media = payload.media; this.attributes = payload.attributes; this.participantSid = payload.participant_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.delivery = payload.delivery; this.url = payload.url; this.links = payload.links; this.contentSid = payload.content_sid; this._solution = { chatServiceSid, conversationSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new MessageContextImpl(this._version, this._solution.chatServiceSid, this._solution.conversationSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the deliveryReceipts. */ deliveryReceipts() { return this._proxy.deliveryReceipts; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, conversationSid: this.conversationSid, sid: this.sid, index: this.index, author: this.author, body: this.body, media: this.media, attributes: this.attributes, participantSid: this.participantSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, delivery: this.delivery, url: this.url, links: this.links, contentSid: this.contentSid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessageInstance = MessageInstance; function MessageListInstance(version, chatServiceSid, conversationSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new MessageContextImpl(version, chatServiceSid, conversationSid, sid); }; instance._version = version; instance._solution = { chatServiceSid, conversationSid }; instance._uri = `/Services/${chatServiceSid}/Conversations/${conversationSid}/Messages`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["author"] !== undefined) data["Author"] = params["author"]; if (params["body"] !== undefined) data["Body"] = params["body"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["mediaSid"] !== undefined) data["MediaSid"] = params["mediaSid"]; if (params["contentSid"] !== undefined) data["ContentSid"] = params["contentSid"]; if (params["contentVariables"] !== undefined) data["ContentVariables"] = params["contentVariables"]; if (params["subject"] !== undefined) data["Subject"] = params["subject"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessageInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid)); 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["order"] !== undefined) data["Order"] = params["order"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MessagePage(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 MessagePage(instance._version, payload, 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; } exports.MessageListInstance = MessageListInstance; class MessagePage extends Page_1.default { /** * Initialize the MessagePage * * @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 MessageInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MessageInstance(this._version, payload, this._solution.chatServiceSid, this._solution.conversationSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessagePage = MessagePage; rest/conversations/v1/service/conversation/participant.js000064400000032575151677225100020014 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.ParticipantPage = exports.ParticipantListInstance = exports.ParticipantInstance = exports.ParticipantContextImpl = void 0; 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 ParticipantContextImpl { constructor(_version, chatServiceSid, conversationSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { chatServiceSid, conversationSid, sid }; this._uri = `/Services/${chatServiceSid}/Conversations/${conversationSid}/Participants/${sid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid, 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["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["identity"] !== undefined) data["Identity"] = params["identity"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; if (params["messagingBinding.proxyAddress"] !== undefined) data["MessagingBinding.ProxyAddress"] = params["messagingBinding.proxyAddress"]; if (params["messagingBinding.projectedAddress"] !== undefined) data["MessagingBinding.ProjectedAddress"] = params["messagingBinding.projectedAddress"]; if (params["lastReadMessageIndex"] !== undefined) data["LastReadMessageIndex"] = params["lastReadMessageIndex"]; if (params["lastReadTimestamp"] !== undefined) data["LastReadTimestamp"] = params["lastReadTimestamp"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid, 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.ParticipantContextImpl = ParticipantContextImpl; class ParticipantInstance { constructor(_version, payload, chatServiceSid, conversationSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.conversationSid = payload.conversation_sid; this.sid = payload.sid; this.identity = payload.identity; this.attributes = payload.attributes; this.messagingBinding = payload.messaging_binding; this.roleSid = payload.role_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.lastReadMessageIndex = deserialize.integer(payload.last_read_message_index); this.lastReadTimestamp = payload.last_read_timestamp; this._solution = { chatServiceSid, conversationSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ParticipantContextImpl(this._version, this._solution.chatServiceSid, this._solution.conversationSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, conversationSid: this.conversationSid, sid: this.sid, identity: this.identity, attributes: this.attributes, messagingBinding: this.messagingBinding, roleSid: this.roleSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, lastReadMessageIndex: this.lastReadMessageIndex, lastReadTimestamp: this.lastReadTimestamp, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantInstance = ParticipantInstance; function ParticipantListInstance(version, chatServiceSid, conversationSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ParticipantContextImpl(version, chatServiceSid, conversationSid, sid); }; instance._version = version; instance._solution = { chatServiceSid, conversationSid }; instance._uri = `/Services/${chatServiceSid}/Conversations/${conversationSid}/Participants`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["identity"] !== undefined) data["Identity"] = params["identity"]; if (params["messagingBinding.address"] !== undefined) data["MessagingBinding.Address"] = params["messagingBinding.address"]; if (params["messagingBinding.proxyAddress"] !== undefined) data["MessagingBinding.ProxyAddress"] = params["messagingBinding.proxyAddress"]; if (params["dateCreated"] !== undefined) data["DateCreated"] = serialize.iso8601DateTime(params["dateCreated"]); if (params["dateUpdated"] !== undefined) data["DateUpdated"] = serialize.iso8601DateTime(params["dateUpdated"]); if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["messagingBinding.projectedAddress"] !== undefined) data["MessagingBinding.ProjectedAddress"] = params["messagingBinding.projectedAddress"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantPage(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 ParticipantPage(instance._version, payload, 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; } exports.ParticipantListInstance = ParticipantListInstance; class ParticipantPage extends Page_1.default { /** * Initialize the ParticipantPage * * @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 ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ParticipantInstance(this._version, payload, this._solution.chatServiceSid, this._solution.conversationSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantPage = ParticipantPage; rest/conversations/v1/service/conversation/webhook.d.ts000064400000030766151677225100017370 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type WebhookMethod = "GET" | "POST"; export type WebhookTarget = "webhook" | "trigger" | "studio"; /** * Options to pass to update a WebhookInstance */ export interface WebhookContextUpdateOptions { /** The absolute url the webhook request should be sent to. */ "configuration.url"?: string; /** */ "configuration.method"?: WebhookMethod; /** The list of events, firing webhook event for this Conversation. */ "configuration.filters"?: Array<string>; /** The list of keywords, firing webhook event for this Conversation. */ "configuration.triggers"?: Array<string>; /** The studio flow SID, where the webhook should be sent to. */ "configuration.flowSid"?: string; } /** * Options to pass to create a WebhookInstance */ export interface WebhookListInstanceCreateOptions { /** */ target: WebhookTarget; /** The absolute url the webhook request should be sent to. */ "configuration.url"?: string; /** */ "configuration.method"?: WebhookMethod; /** The list of events, firing webhook event for this Conversation. */ "configuration.filters"?: Array<string>; /** The list of keywords, firing webhook event for this Conversation. */ "configuration.triggers"?: Array<string>; /** The studio flow SID, where the webhook should be sent to. */ "configuration.flowSid"?: string; /** The message index for which and it\\\'s successors the webhook will be replayed. Not set by default */ "configuration.replayAfter"?: number; } /** * Options to pass to each */ export interface WebhookListInstanceEachOptions { /** 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: WebhookInstance, 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 WebhookListInstanceOptions { /** 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 WebhookListInstancePageOptions { /** 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 WebhookContext { /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WebhookContextSolution { chatServiceSid: string; conversationSid: string; sid: string; } export declare class WebhookContextImpl implements WebhookContext { protected _version: V1; protected _solution: WebhookContextSolution; protected _uri: string; constructor(_version: V1, chatServiceSid: string, conversationSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; update(params?: WebhookContextUpdateOptions | ((error: Error | null, item?: WebhookInstance) => any), callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WebhookContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WebhookPayload extends TwilioResponsePayload { webhooks: WebhookResource[]; } interface WebhookResource { sid: string; account_sid: string; chat_service_sid: string; conversation_sid: string; target: string; url: string; configuration: any; date_created: Date; date_updated: Date; } export declare class WebhookInstance { protected _version: V1; protected _solution: WebhookContextSolution; protected _context?: WebhookContext; constructor(_version: V1, payload: WebhookResource, chatServiceSid: string, conversationSid: string, sid?: string); /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. */ chatServiceSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. */ conversationSid: string; /** * The target of this webhook: `webhook`, `studio`, `trigger` */ target: string; /** * An absolute API resource URL for this webhook. */ url: string; /** * The configuration of this webhook. Is defined based on target. */ configuration: any; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. */ dateUpdated: Date; private get _proxy(); /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; chatServiceSid: string; conversationSid: string; target: string; url: string; configuration: any; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WebhookSolution { chatServiceSid: string; conversationSid: string; } export interface WebhookListInstance { _version: V1; _solution: WebhookSolution; _uri: string; (sid: string): WebhookContext; get(sid: string): WebhookContext; /** * Create a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ create(params: WebhookListInstanceCreateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Streams WebhookInstance 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 { WebhookListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; each(params: WebhookListInstanceEachOptions, callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WebhookInstance 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: WebhookPage) => any): Promise<WebhookPage>; /** * Lists WebhookInstance 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 { WebhookListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; list(params: WebhookListInstanceOptions, callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; /** * Retrieve a single page of WebhookInstance 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 { WebhookListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; page(params: WebhookListInstancePageOptions, callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WebhookListInstance(version: V1, chatServiceSid: string, conversationSid: string): WebhookListInstance; export declare class WebhookPage extends Page<V1, WebhookPayload, WebhookResource, WebhookInstance> { /** * Initialize the WebhookPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: WebhookSolution); /** * Build an instance of WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload: WebhookResource): WebhookInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/conversation/participant.d.ts000064400000043664151677225100020251 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type ParticipantWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a ParticipantInstance */ export interface ParticipantContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ParticipantWebhookEnabledType; } /** * Options to pass to update a ParticipantInstance */ export interface ParticipantContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ParticipantWebhookEnabledType; /** The date on which this resource was created. */ dateCreated?: Date; /** The date on which this resource was last updated. */ dateUpdated?: Date; /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. */ identity?: string; /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. */ attributes?: string; /** The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. */ roleSid?: string; /** The address of the Twilio phone number that the participant is in contact with. \\\'null\\\' value will remove it. */ "messagingBinding.proxyAddress"?: string; /** The address of the Twilio phone number that is used in Group MMS. \\\'null\\\' value will remove it. */ "messagingBinding.projectedAddress"?: string; /** Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. */ lastReadMessageIndex?: number; /** Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. */ lastReadTimestamp?: string; } /** * Options to pass to create a ParticipantInstance */ export interface ParticipantListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ParticipantWebhookEnabledType; /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. */ identity?: string; /** The address of the participant\\\'s device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with `proxy_address`) is only null when the participant is interacting from an SDK endpoint (see the `identity` field). */ "messagingBinding.address"?: string; /** The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the `identity` field). */ "messagingBinding.proxyAddress"?: string; /** The date on which this resource was created. */ dateCreated?: Date; /** The date on which this resource was last updated. */ dateUpdated?: Date; /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. */ attributes?: string; /** The address of the Twilio phone number that is used in Group MMS. */ "messagingBinding.projectedAddress"?: string; /** The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. */ roleSid?: string; } /** * Options to pass to each */ export interface ParticipantListInstanceEachOptions { /** 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: ParticipantInstance, 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 ParticipantListInstanceOptions { /** 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 ParticipantListInstancePageOptions { /** 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 ParticipantContext { /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ remove(params: ParticipantContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(params: ParticipantContextUpdateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ParticipantContextSolution { chatServiceSid: string; conversationSid: string; sid: string; } export declare class ParticipantContextImpl implements ParticipantContext { protected _version: V1; protected _solution: ParticipantContextSolution; protected _uri: string; constructor(_version: V1, chatServiceSid: string, conversationSid: string, sid: string); remove(params?: ParticipantContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; update(params?: ParticipantContextUpdateOptions | ((error: Error | null, item?: ParticipantInstance) => any), callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ParticipantContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ParticipantPayload extends TwilioResponsePayload { participants: ParticipantResource[]; } interface ParticipantResource { account_sid: string; chat_service_sid: string; conversation_sid: string; sid: string; identity: string; attributes: string; messaging_binding: any; role_sid: string; date_created: Date; date_updated: Date; url: string; last_read_message_index: number; last_read_timestamp: string; } export declare class ParticipantInstance { protected _version: V1; protected _solution: ParticipantContextSolution; protected _context?: ParticipantContext; constructor(_version: V1, payload: ParticipantResource, chatServiceSid: string, conversationSid: string, sid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. */ chatServiceSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. */ conversationSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. */ identity: string; /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. */ attributes: string; /** * Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. */ messagingBinding: any; /** * The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. */ roleSid: string; /** * The date on which this resource was created. */ dateCreated: Date; /** * The date on which this resource was last updated. */ dateUpdated: Date; /** * An absolute API resource URL for this participant. */ url: string; /** * Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. */ lastReadMessageIndex: number; /** * Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. */ lastReadTimestamp: string; private get _proxy(); /** * Remove a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ remove(params: ParticipantContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ fetch(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Update a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ update(params: ParticipantContextUpdateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; conversationSid: string; sid: string; identity: string; attributes: string; messagingBinding: any; roleSid: string; dateCreated: Date; dateUpdated: Date; url: string; lastReadMessageIndex: number; lastReadTimestamp: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ParticipantSolution { chatServiceSid: string; conversationSid: string; } export interface ParticipantListInstance { _version: V1; _solution: ParticipantSolution; _uri: string; (sid: string): ParticipantContext; get(sid: string): ParticipantContext; /** * Create a ParticipantInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ create(callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Create a ParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ParticipantInstance */ create(params: ParticipantListInstanceCreateOptions, callback?: (error: Error | null, item?: ParticipantInstance) => any): Promise<ParticipantInstance>; /** * Streams ParticipantInstance 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 { ParticipantListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; each(params: ParticipantListInstanceEachOptions, callback?: (item: ParticipantInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ParticipantInstance 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: ParticipantPage) => any): Promise<ParticipantPage>; /** * Lists ParticipantInstance 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 { ParticipantListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; list(params: ParticipantListInstanceOptions, callback?: (error: Error | null, items: ParticipantInstance[]) => any): Promise<ParticipantInstance[]>; /** * Retrieve a single page of ParticipantInstance 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 { ParticipantListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; page(params: ParticipantListInstancePageOptions, callback?: (error: Error | null, items: ParticipantPage) => any): Promise<ParticipantPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ParticipantListInstance(version: V1, chatServiceSid: string, conversationSid: string): ParticipantListInstance; export declare class ParticipantPage extends Page<V1, ParticipantPayload, ParticipantResource, ParticipantInstance> { /** * Initialize the ParticipantPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ParticipantSolution); /** * Build an instance of ParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload: ParticipantResource): ParticipantInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/conversation/message.d.ts000064400000042433151677225100017350 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; import { DeliveryReceiptListInstance } from "./message/deliveryReceipt"; export type MessageOrderType = "asc" | "desc"; export type MessageWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a MessageInstance */ export interface MessageContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; } /** * Options to pass to update a MessageInstance */ export interface MessageContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; /** The channel specific identifier of the message\\\'s author. Defaults to `system`. */ author?: string; /** The content of the message, can be up to 1,600 characters long. */ body?: string; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. `null` if the message has not been edited. */ dateUpdated?: Date; /** A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** The subject of the message, can be up to 256 characters long. */ subject?: string; } /** * Options to pass to create a MessageInstance */ export interface MessageListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: MessageWebhookEnabledType; /** The channel specific identifier of the message\\\'s author. Defaults to `system`. */ author?: string; /** The content of the message, can be up to 1,600 characters long. */ body?: string; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. `null` if the message has not been edited. */ dateUpdated?: Date; /** A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** The Media SID to be attached to the new Message. */ mediaSid?: string; /** The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. */ contentSid?: string; /** A structurally valid JSON string that contains values to resolve Rich Content template variables. */ contentVariables?: string; /** The subject of the message, can be up to 256 characters long. */ subject?: string; } /** * Options to pass to each */ export interface MessageListInstanceEachOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. */ order?: MessageOrderType; /** 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: MessageInstance, 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 MessageListInstanceOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. */ order?: MessageOrderType; /** 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 MessageListInstancePageOptions { /** The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. */ order?: MessageOrderType; /** 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 MessageContext { deliveryReceipts: DeliveryReceiptListInstance; /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ remove(params: MessageContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MessageContextSolution { chatServiceSid: string; conversationSid: string; sid: string; } export declare class MessageContextImpl implements MessageContext { protected _version: V1; protected _solution: MessageContextSolution; protected _uri: string; protected _deliveryReceipts?: DeliveryReceiptListInstance; constructor(_version: V1, chatServiceSid: string, conversationSid: string, sid: string); get deliveryReceipts(): DeliveryReceiptListInstance; remove(params?: MessageContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; update(params?: MessageContextUpdateOptions | ((error: Error | null, item?: MessageInstance) => any), callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MessageContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MessagePayload extends TwilioResponsePayload { messages: MessageResource[]; } interface MessageResource { account_sid: string; chat_service_sid: string; conversation_sid: string; sid: string; index: number; author: string; body: string; media: Array<any>; attributes: string; participant_sid: string; date_created: Date; date_updated: Date; delivery: any; url: string; links: Record<string, string>; content_sid: string; } export declare class MessageInstance { protected _version: V1; protected _solution: MessageContextSolution; protected _context?: MessageContext; constructor(_version: V1, payload: MessageResource, chatServiceSid: string, conversationSid: string, sid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. */ chatServiceSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. */ conversationSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). */ index: number; /** * The channel specific identifier of the message\'s author. Defaults to `system`. */ author: string; /** * The content of the message, can be up to 1,600 characters long. */ body: string; /** * An array of objects that describe the Message\'s media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object\'s file size in bytes. If the Message has no media, this value is `null`. */ media: Array<any>; /** * A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. */ attributes: string; /** * The unique ID of messages\'s author participant. Null in case of `system` sent message. */ participantSid: string; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. `null` if the message has not been edited. */ dateUpdated: Date; /** * An object that contains the summary of delivery statuses for the message to non-chat participants. */ delivery: any; /** * An absolute API resource URL for this message. */ url: string; /** * Contains an absolute API resource URL to access the delivery & read receipts of this message. */ links: Record<string, string>; /** * The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content) template. */ contentSid: string; private get _proxy(); /** * Remove a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ remove(params: MessageContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ fetch(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Update a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ update(params: MessageContextUpdateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Access the deliveryReceipts. */ deliveryReceipts(): DeliveryReceiptListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; conversationSid: string; sid: string; index: number; author: string; body: string; media: any[]; attributes: string; participantSid: string; dateCreated: Date; dateUpdated: Date; delivery: any; url: string; links: Record<string, string>; contentSid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MessageSolution { chatServiceSid: string; conversationSid: string; } export interface MessageListInstance { _version: V1; _solution: MessageSolution; _uri: string; (sid: string): MessageContext; get(sid: string): MessageContext; /** * Create a MessageInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Create a MessageInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessageInstance */ create(params: MessageListInstanceCreateOptions, callback?: (error: Error | null, item?: MessageInstance) => any): Promise<MessageInstance>; /** * Streams MessageInstance 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 { MessageListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; each(params: MessageListInstanceEachOptions, callback?: (item: MessageInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MessageInstance 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: MessagePage) => any): Promise<MessagePage>; /** * Lists MessageInstance 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 { MessageListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; list(params: MessageListInstanceOptions, callback?: (error: Error | null, items: MessageInstance[]) => any): Promise<MessageInstance[]>; /** * Retrieve a single page of MessageInstance 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 { MessageListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; page(params: MessageListInstancePageOptions, callback?: (error: Error | null, items: MessagePage) => any): Promise<MessagePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessageListInstance(version: V1, chatServiceSid: string, conversationSid: string): MessageListInstance; export declare class MessagePage extends Page<V1, MessagePayload, MessageResource, MessageInstance> { /** * Initialize the MessagePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: MessageSolution); /** * Build an instance of MessageInstance * * @param payload - Payload response from the API */ getInstance(payload: MessageResource): MessageInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/conversation/message/deliveryReceipt.d.ts000064400000024162151677225100022506 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../../base/Page"; import Response from "../../../../../../http/response"; import V1 from "../../../../V1"; export type DeliveryReceiptDeliveryStatus = "read" | "failed" | "delivered" | "undelivered" | "sent"; /** * Options to pass to each */ export interface DeliveryReceiptListInstanceEachOptions { /** 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: DeliveryReceiptInstance, 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 DeliveryReceiptListInstanceOptions { /** 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 DeliveryReceiptListInstancePageOptions { /** 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 DeliveryReceiptContext { /** * Fetch a DeliveryReceiptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeliveryReceiptInstance */ fetch(callback?: (error: Error | null, item?: DeliveryReceiptInstance) => any): Promise<DeliveryReceiptInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DeliveryReceiptContextSolution { chatServiceSid: string; conversationSid: string; messageSid: string; sid: string; } export declare class DeliveryReceiptContextImpl implements DeliveryReceiptContext { protected _version: V1; protected _solution: DeliveryReceiptContextSolution; protected _uri: string; constructor(_version: V1, chatServiceSid: string, conversationSid: string, messageSid: string, sid: string); fetch(callback?: (error: Error | null, item?: DeliveryReceiptInstance) => any): Promise<DeliveryReceiptInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DeliveryReceiptContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DeliveryReceiptPayload extends TwilioResponsePayload { delivery_receipts: DeliveryReceiptResource[]; } interface DeliveryReceiptResource { account_sid: string; chat_service_sid: string; conversation_sid: string; message_sid: string; sid: string; channel_message_sid: string; participant_sid: string; status: DeliveryReceiptDeliveryStatus; error_code: number; date_created: Date; date_updated: Date; url: string; } export declare class DeliveryReceiptInstance { protected _version: V1; protected _solution: DeliveryReceiptContextSolution; protected _context?: DeliveryReceiptContext; constructor(_version: V1, payload: DeliveryReceiptResource, chatServiceSid: string, conversationSid: string, messageSid: string, sid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Message resource is associated with. */ chatServiceSid: string; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. */ conversationSid: string; /** * The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to */ messageSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. */ channelMessageSid: string; /** * The unique ID of the participant the delivery receipt belongs to. */ participantSid: string; status: DeliveryReceiptDeliveryStatus; /** * The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, */ errorCode: number; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. `null` if the delivery receipt has not been updated. */ dateUpdated: Date; /** * An absolute API resource URL for this delivery receipt. */ url: string; private get _proxy(); /** * Fetch a DeliveryReceiptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeliveryReceiptInstance */ fetch(callback?: (error: Error | null, item?: DeliveryReceiptInstance) => any): Promise<DeliveryReceiptInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; conversationSid: string; messageSid: string; sid: string; channelMessageSid: string; participantSid: string; status: DeliveryReceiptDeliveryStatus; errorCode: number; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DeliveryReceiptSolution { chatServiceSid: string; conversationSid: string; messageSid: string; } export interface DeliveryReceiptListInstance { _version: V1; _solution: DeliveryReceiptSolution; _uri: string; (sid: string): DeliveryReceiptContext; get(sid: string): DeliveryReceiptContext; /** * Streams DeliveryReceiptInstance 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 { DeliveryReceiptListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DeliveryReceiptInstance, done: (err?: Error) => void) => void): void; each(params: DeliveryReceiptListInstanceEachOptions, callback?: (item: DeliveryReceiptInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DeliveryReceiptInstance 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: DeliveryReceiptPage) => any): Promise<DeliveryReceiptPage>; /** * Lists DeliveryReceiptInstance 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 { DeliveryReceiptListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DeliveryReceiptInstance[]) => any): Promise<DeliveryReceiptInstance[]>; list(params: DeliveryReceiptListInstanceOptions, callback?: (error: Error | null, items: DeliveryReceiptInstance[]) => any): Promise<DeliveryReceiptInstance[]>; /** * Retrieve a single page of DeliveryReceiptInstance 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 { DeliveryReceiptListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DeliveryReceiptPage) => any): Promise<DeliveryReceiptPage>; page(params: DeliveryReceiptListInstancePageOptions, callback?: (error: Error | null, items: DeliveryReceiptPage) => any): Promise<DeliveryReceiptPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DeliveryReceiptListInstance(version: V1, chatServiceSid: string, conversationSid: string, messageSid: string): DeliveryReceiptListInstance; export declare class DeliveryReceiptPage extends Page<V1, DeliveryReceiptPayload, DeliveryReceiptResource, DeliveryReceiptInstance> { /** * Initialize the DeliveryReceiptPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DeliveryReceiptSolution); /** * Build an instance of DeliveryReceiptInstance * * @param payload - Payload response from the API */ getInstance(payload: DeliveryReceiptResource): DeliveryReceiptInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/conversation/message/deliveryReceipt.js000064400000021372151677225100022252 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.DeliveryReceiptPage = exports.DeliveryReceiptListInstance = exports.DeliveryReceiptInstance = exports.DeliveryReceiptContextImpl = void 0; 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 DeliveryReceiptContextImpl { constructor(_version, chatServiceSid, conversationSid, messageSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(messageSid)) { throw new Error("Parameter 'messageSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { chatServiceSid, conversationSid, messageSid, sid }; this._uri = `/Services/${chatServiceSid}/Conversations/${conversationSid}/Messages/${messageSid}/Receipts/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DeliveryReceiptInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid, instance._solution.messageSid, 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.DeliveryReceiptContextImpl = DeliveryReceiptContextImpl; class DeliveryReceiptInstance { constructor(_version, payload, chatServiceSid, conversationSid, messageSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.conversationSid = payload.conversation_sid; this.messageSid = payload.message_sid; this.sid = payload.sid; this.channelMessageSid = payload.channel_message_sid; this.participantSid = payload.participant_sid; this.status = payload.status; this.errorCode = deserialize.integer(payload.error_code); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { chatServiceSid, conversationSid, messageSid, sid: sid || this.sid, }; } get _proxy() { this._context = this._context || new DeliveryReceiptContextImpl(this._version, this._solution.chatServiceSid, this._solution.conversationSid, this._solution.messageSid, this._solution.sid); return this._context; } /** * Fetch a DeliveryReceiptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeliveryReceiptInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, conversationSid: this.conversationSid, messageSid: this.messageSid, sid: this.sid, channelMessageSid: this.channelMessageSid, participantSid: this.participantSid, status: this.status, errorCode: this.errorCode, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeliveryReceiptInstance = DeliveryReceiptInstance; function DeliveryReceiptListInstance(version, chatServiceSid, conversationSid, messageSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(messageSid)) { throw new Error("Parameter 'messageSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new DeliveryReceiptContextImpl(version, chatServiceSid, conversationSid, messageSid, sid); }; instance._version = version; instance._solution = { chatServiceSid, conversationSid, messageSid }; instance._uri = `/Services/${chatServiceSid}/Conversations/${conversationSid}/Messages/${messageSid}/Receipts`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DeliveryReceiptPage(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 DeliveryReceiptPage(instance._version, payload, 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; } exports.DeliveryReceiptListInstance = DeliveryReceiptListInstance; class DeliveryReceiptPage extends Page_1.default { /** * Initialize the DeliveryReceiptPage * * @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 DeliveryReceiptInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DeliveryReceiptInstance(this._version, payload, this._solution.chatServiceSid, this._solution.conversationSid, this._solution.messageSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeliveryReceiptPage = DeliveryReceiptPage; rest/conversations/v1/service/conversation/webhook.js000064400000027463151677225100017134 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.WebhookPage = exports.WebhookListInstance = exports.WebhookInstance = exports.WebhookContextImpl = void 0; 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 WebhookContextImpl { constructor(_version, chatServiceSid, conversationSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { chatServiceSid, conversationSid, sid }; this._uri = `/Services/${chatServiceSid}/Conversations/${conversationSid}/Webhooks/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["configuration.url"] !== undefined) data["Configuration.Url"] = params["configuration.url"]; if (params["configuration.method"] !== undefined) data["Configuration.Method"] = params["configuration.method"]; if (params["configuration.filters"] !== undefined) data["Configuration.Filters"] = serialize.map(params["configuration.filters"], (e) => e); if (params["configuration.triggers"] !== undefined) data["Configuration.Triggers"] = serialize.map(params["configuration.triggers"], (e) => e); if (params["configuration.flowSid"] !== undefined) data["Configuration.FlowSid"] = params["configuration.flowSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid, 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.WebhookContextImpl = WebhookContextImpl; class WebhookInstance { constructor(_version, payload, chatServiceSid, conversationSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.conversationSid = payload.conversation_sid; this.target = payload.target; this.url = payload.url; this.configuration = payload.configuration; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { chatServiceSid, conversationSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WebhookContextImpl(this._version, this._solution.chatServiceSid, this._solution.conversationSid, this._solution.sid); return this._context; } /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, conversationSid: this.conversationSid, target: this.target, url: this.url, configuration: this.configuration, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookInstance = WebhookInstance; function WebhookListInstance(version, chatServiceSid, conversationSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(conversationSid)) { throw new Error("Parameter 'conversationSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WebhookContextImpl(version, chatServiceSid, conversationSid, sid); }; instance._version = version; instance._solution = { chatServiceSid, conversationSid }; instance._uri = `/Services/${chatServiceSid}/Conversations/${conversationSid}/Webhooks`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["target"] === null || params["target"] === undefined) { throw new Error("Required parameter \"params['target']\" missing."); } let data = {}; data["Target"] = params["target"]; if (params["configuration.url"] !== undefined) data["Configuration.Url"] = params["configuration.url"]; if (params["configuration.method"] !== undefined) data["Configuration.Method"] = params["configuration.method"]; if (params["configuration.filters"] !== undefined) data["Configuration.Filters"] = serialize.map(params["configuration.filters"], (e) => e); if (params["configuration.triggers"] !== undefined) data["Configuration.Triggers"] = serialize.map(params["configuration.triggers"], (e) => e); if (params["configuration.flowSid"] !== undefined) data["Configuration.FlowSid"] = params["configuration.flowSid"]; if (params["configuration.replayAfter"] !== undefined) data["Configuration.ReplayAfter"] = params["configuration.replayAfter"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.conversationSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookPage(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 WebhookPage(instance._version, payload, 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; } exports.WebhookListInstance = WebhookListInstance; class WebhookPage extends Page_1.default { /** * Initialize the WebhookPage * * @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 WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WebhookInstance(this._version, payload, this._solution.chatServiceSid, this._solution.conversationSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookPage = WebhookPage; rest/conversations/v1/service/configuration.js000064400000015557151677225100015634 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.ConfigurationListInstance = exports.ConfigurationInstance = exports.ConfigurationContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const notification_1 = require("./configuration/notification"); const webhook_1 = require("./configuration/webhook"); class ConfigurationContextImpl { constructor(_version, chatServiceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } this._solution = { chatServiceSid }; this._uri = `/Services/${chatServiceSid}/Configuration`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ConfigurationInstance(operationVersion, payload, instance._solution.chatServiceSid)); 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["defaultConversationCreatorRoleSid"] !== undefined) data["DefaultConversationCreatorRoleSid"] = params["defaultConversationCreatorRoleSid"]; if (params["defaultConversationRoleSid"] !== undefined) data["DefaultConversationRoleSid"] = params["defaultConversationRoleSid"]; if (params["defaultChatServiceRoleSid"] !== undefined) data["DefaultChatServiceRoleSid"] = params["defaultChatServiceRoleSid"]; if (params["reachabilityEnabled"] !== undefined) data["ReachabilityEnabled"] = serialize.bool(params["reachabilityEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConfigurationInstance(operationVersion, payload, instance._solution.chatServiceSid)); 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.ConfigurationContextImpl = ConfigurationContextImpl; class ConfigurationInstance { constructor(_version, payload, chatServiceSid) { this._version = _version; this.chatServiceSid = payload.chat_service_sid; this.defaultConversationCreatorRoleSid = payload.default_conversation_creator_role_sid; this.defaultConversationRoleSid = payload.default_conversation_role_sid; this.defaultChatServiceRoleSid = payload.default_chat_service_role_sid; this.url = payload.url; this.links = payload.links; this.reachabilityEnabled = payload.reachability_enabled; this._solution = { chatServiceSid }; } get _proxy() { this._context = this._context || new ConfigurationContextImpl(this._version, this._solution.chatServiceSid); return this._context; } /** * Fetch a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { chatServiceSid: this.chatServiceSid, defaultConversationCreatorRoleSid: this.defaultConversationCreatorRoleSid, defaultConversationRoleSid: this.defaultConversationRoleSid, defaultChatServiceRoleSid: this.defaultChatServiceRoleSid, url: this.url, links: this.links, reachabilityEnabled: this.reachabilityEnabled, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConfigurationInstance = ConfigurationInstance; function ConfigurationListInstance(version, chatServiceSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new ConfigurationContextImpl(version, chatServiceSid); }; instance._version = version; instance._solution = { chatServiceSid }; instance._uri = ``; Object.defineProperty(instance, "notifications", { get: function notifications() { if (!instance._notifications) { instance._notifications = (0, notification_1.NotificationListInstance)(instance._version, instance._solution.chatServiceSid); } return instance._notifications; }, }); Object.defineProperty(instance, "webhooks", { get: function webhooks() { if (!instance._webhooks) { instance._webhooks = (0, webhook_1.WebhookListInstance)(instance._version, instance._solution.chatServiceSid); } return instance._webhooks; }, }); 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; } exports.ConfigurationListInstance = ConfigurationListInstance; rest/conversations/v1/service/participantConversation.d.ts000064400000027375151677225100020133 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type ParticipantConversationState = "inactive" | "active" | "closed"; /** * Options to pass to each */ export interface ParticipantConversationListInstanceEachOptions { /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ identity?: string; /** A unique string identifier for the conversation participant who\'s not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. */ address?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ParticipantConversationInstance, 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 ParticipantConversationListInstanceOptions { /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ identity?: string; /** A unique string identifier for the conversation participant who\'s not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. */ address?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ParticipantConversationListInstancePageOptions { /** A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ identity?: string; /** A unique string identifier for the conversation participant who\'s not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. */ address?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ParticipantConversationSolution { chatServiceSid: string; } export interface ParticipantConversationListInstance { _version: V1; _solution: ParticipantConversationSolution; _uri: string; /** * Streams ParticipantConversationInstance 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 { ParticipantConversationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ParticipantConversationInstance, done: (err?: Error) => void) => void): void; each(params: ParticipantConversationListInstanceEachOptions, callback?: (item: ParticipantConversationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ParticipantConversationInstance 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: ParticipantConversationPage) => any): Promise<ParticipantConversationPage>; /** * Lists ParticipantConversationInstance 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 { ParticipantConversationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ParticipantConversationInstance[]) => any): Promise<ParticipantConversationInstance[]>; list(params: ParticipantConversationListInstanceOptions, callback?: (error: Error | null, items: ParticipantConversationInstance[]) => any): Promise<ParticipantConversationInstance[]>; /** * Retrieve a single page of ParticipantConversationInstance 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 { ParticipantConversationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ParticipantConversationPage) => any): Promise<ParticipantConversationPage>; page(params: ParticipantConversationListInstancePageOptions, callback?: (error: Error | null, items: ParticipantConversationPage) => any): Promise<ParticipantConversationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ParticipantConversationListInstance(version: V1, chatServiceSid: string): ParticipantConversationListInstance; interface ParticipantConversationPayload extends TwilioResponsePayload { conversations: ParticipantConversationResource[]; } interface ParticipantConversationResource { account_sid: string; chat_service_sid: string; participant_sid: string; participant_user_sid: string; participant_identity: string; participant_messaging_binding: any; conversation_sid: string; conversation_unique_name: string; conversation_friendly_name: string; conversation_attributes: string; conversation_date_created: Date; conversation_date_updated: Date; conversation_created_by: string; conversation_state: ParticipantConversationState; conversation_timers: any; links: Record<string, string>; } export declare class ParticipantConversationInstance { protected _version: V1; constructor(_version: V1, payload: ParticipantConversationResource, chatServiceSid: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. */ accountSid: string; /** * The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. */ chatServiceSid: string; /** * The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). */ participantSid: string; /** * The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). */ participantUserSid: string; /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. */ participantIdentity: string; /** * Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. */ participantMessagingBinding: any; /** * The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. */ conversationSid: string; /** * An application-defined string that uniquely identifies the Conversation resource. */ conversationUniqueName: string; /** * The human-readable name of this conversation, limited to 256 characters. Optional. */ conversationFriendlyName: string; /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. */ conversationAttributes: string; /** * The date that this conversation was created, given in ISO 8601 format. */ conversationDateCreated: Date; /** * The date that this conversation was last updated, given in ISO 8601 format. */ conversationDateUpdated: Date; /** * Identity of the creator of this Conversation. */ conversationCreatedBy: string; conversationState: ParticipantConversationState; /** * Timer date values representing state update for this conversation. */ conversationTimers: any; /** * Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. */ links: Record<string, string>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; participantSid: string; participantUserSid: string; participantIdentity: string; participantMessagingBinding: any; conversationSid: string; conversationUniqueName: string; conversationFriendlyName: string; conversationAttributes: string; conversationDateCreated: Date; conversationDateUpdated: Date; conversationCreatedBy: string; conversationState: ParticipantConversationState; conversationTimers: any; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class ParticipantConversationPage extends Page<V1, ParticipantConversationPayload, ParticipantConversationResource, ParticipantConversationInstance> { /** * Initialize the ParticipantConversationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ParticipantConversationSolution); /** * Build an instance of ParticipantConversationInstance * * @param payload - Payload response from the API */ getInstance(payload: ParticipantConversationResource): ParticipantConversationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/binding.js000064400000020175151677225100014367 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.BindingPage = exports.BindingListInstance = exports.BindingInstance = exports.BindingContextImpl = void 0; 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 BindingContextImpl { constructor(_version, chatServiceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { chatServiceSid, sid }; this._uri = `/Services/${chatServiceSid}/Bindings/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BindingInstance(operationVersion, payload, instance._solution.chatServiceSid, 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.BindingContextImpl = BindingContextImpl; class BindingInstance { constructor(_version, payload, chatServiceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.credentialSid = payload.credential_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.endpoint = payload.endpoint; this.identity = payload.identity; this.bindingType = payload.binding_type; this.messageTypes = payload.message_types; this.url = payload.url; this._solution = { chatServiceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new BindingContextImpl(this._version, this._solution.chatServiceSid, this._solution.sid); return this._context; } /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, credentialSid: this.credentialSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, endpoint: this.endpoint, identity: this.identity, bindingType: this.bindingType, messageTypes: this.messageTypes, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BindingInstance = BindingInstance; function BindingListInstance(version, chatServiceSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new BindingContextImpl(version, chatServiceSid, sid); }; instance._version = version; instance._solution = { chatServiceSid }; instance._uri = `/Services/${chatServiceSid}/Bindings`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["bindingType"] !== undefined) data["BindingType"] = serialize.map(params["bindingType"], (e) => e); if (params["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BindingPage(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 BindingPage(instance._version, payload, 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; } exports.BindingListInstance = BindingListInstance; class BindingPage extends Page_1.default { /** * Initialize the BindingPage * * @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 BindingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BindingInstance(this._version, payload, this._solution.chatServiceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BindingPage = BindingPage; rest/conversations/v1/service/user.js000064400000026671151677225100013742 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.UserPage = exports.UserListInstance = exports.UserInstance = exports.UserContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const userConversation_1 = require("./user/userConversation"); class UserContextImpl { constructor(_version, chatServiceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { chatServiceSid, sid }; this._uri = `/Services/${chatServiceSid}/Users/${sid}`; } get userConversations() { this._userConversations = this._userConversations || (0, userConversation_1.UserConversationListInstance)(this._version, this._solution.chatServiceSid, this._solution.sid); return this._userConversations; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.chatServiceSid, 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.UserContextImpl = UserContextImpl; class UserInstance { constructor(_version, payload, chatServiceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.roleSid = payload.role_sid; this.identity = payload.identity; this.friendlyName = payload.friendly_name; this.attributes = payload.attributes; this.isOnline = payload.is_online; this.isNotifiable = payload.is_notifiable; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { chatServiceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UserContextImpl(this._version, this._solution.chatServiceSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the userConversations. */ userConversations() { return this._proxy.userConversations; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, roleSid: this.roleSid, identity: this.identity, friendlyName: this.friendlyName, attributes: this.attributes, isOnline: this.isOnline, isNotifiable: this.isNotifiable, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserInstance = UserInstance; function UserListInstance(version, chatServiceSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UserContextImpl(version, chatServiceSid, sid); }; instance._version = version; instance._solution = { chatServiceSid }; instance._uri = `/Services/${chatServiceSid}/Users`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["roleSid"] !== undefined) data["RoleSid"] = params["roleSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["xTwilioWebhookEnabled"] !== undefined) headers["X-Twilio-Webhook-Enabled"] = params["xTwilioWebhookEnabled"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UserInstance(operationVersion, payload, instance._solution.chatServiceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UserPage(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 UserPage(instance._version, payload, 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; } exports.UserListInstance = UserListInstance; class UserPage extends Page_1.default { /** * Initialize the UserPage * * @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 UserInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UserInstance(this._version, payload, this._solution.chatServiceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UserPage = UserPage; rest/conversations/v1/service/role.d.ts000064400000026301151677225100014147 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type RoleRoleType = "conversation" | "service"; /** * Options to pass to update a RoleInstance */ export interface RoleContextUpdateOptions { /** A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role\\\'s `type`. */ permission: Array<string>; } /** * Options to pass to create a RoleInstance */ export interface RoleListInstanceCreateOptions { /** A descriptive string that you create to describe the new resource. It can be up to 64 characters long. */ friendlyName: string; /** */ type: RoleRoleType; /** A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role\\\'s `type`. */ permission: Array<string>; } /** * Options to pass to each */ export interface RoleListInstanceEachOptions { /** 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: RoleInstance, 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 RoleListInstanceOptions { /** 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 RoleListInstancePageOptions { /** 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 RoleContext { /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RoleContextSolution { chatServiceSid: string; sid: string; } export declare class RoleContextImpl implements RoleContext { protected _version: V1; protected _solution: RoleContextSolution; protected _uri: string; constructor(_version: V1, chatServiceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RoleContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RolePayload extends TwilioResponsePayload { roles: RoleResource[]; } interface RoleResource { sid: string; account_sid: string; chat_service_sid: string; friendly_name: string; type: RoleRoleType; permissions: Array<string>; date_created: Date; date_updated: Date; url: string; } export declare class RoleInstance { protected _version: V1; protected _solution: RoleContextSolution; protected _context?: RoleContext; constructor(_version: V1, payload: RoleResource, chatServiceSid: string, sid?: string); /** * The unique string that we created to identify the Role resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. */ chatServiceSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; type: RoleRoleType; /** * An array of the permissions the role has been granted. */ permissions: Array<string>; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * An absolute API resource URL for this user role. */ url: string; private get _proxy(); /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Update a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ update(params: RoleContextUpdateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; chatServiceSid: string; friendlyName: string; type: RoleRoleType; permissions: string[]; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RoleSolution { chatServiceSid: string; } export interface RoleListInstance { _version: V1; _solution: RoleSolution; _uri: string; (sid: string): RoleContext; get(sid: string): RoleContext; /** * Create a RoleInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ create(params: RoleListInstanceCreateOptions, callback?: (error: Error | null, item?: RoleInstance) => any): Promise<RoleInstance>; /** * Streams RoleInstance 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 { RoleListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; each(params: RoleListInstanceEachOptions, callback?: (item: RoleInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RoleInstance 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: RolePage) => any): Promise<RolePage>; /** * Lists RoleInstance 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 { RoleListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; list(params: RoleListInstanceOptions, callback?: (error: Error | null, items: RoleInstance[]) => any): Promise<RoleInstance[]>; /** * Retrieve a single page of RoleInstance 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 { RoleListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; page(params: RoleListInstancePageOptions, callback?: (error: Error | null, items: RolePage) => any): Promise<RolePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RoleListInstance(version: V1, chatServiceSid: string): RoleListInstance; export declare class RolePage extends Page<V1, RolePayload, RoleResource, RoleInstance> { /** * Initialize the RolePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RoleSolution); /** * Build an instance of RoleInstance * * @param payload - Payload response from the API */ getInstance(payload: RoleResource): RoleInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/participantConversation.js000064400000015376151677225100017675 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.ParticipantConversationPage = exports.ParticipantConversationInstance = exports.ParticipantConversationListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function ParticipantConversationListInstance(version, chatServiceSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { chatServiceSid }; instance._uri = `/Services/${chatServiceSid}/ParticipantConversations`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["identity"] !== undefined) data["Identity"] = params["identity"]; if (params["address"] !== undefined) data["Address"] = params["address"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ParticipantConversationPage(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 ParticipantConversationPage(instance._version, payload, 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; } exports.ParticipantConversationListInstance = ParticipantConversationListInstance; class ParticipantConversationInstance { constructor(_version, payload, chatServiceSid) { this._version = _version; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.participantSid = payload.participant_sid; this.participantUserSid = payload.participant_user_sid; this.participantIdentity = payload.participant_identity; this.participantMessagingBinding = payload.participant_messaging_binding; this.conversationSid = payload.conversation_sid; this.conversationUniqueName = payload.conversation_unique_name; this.conversationFriendlyName = payload.conversation_friendly_name; this.conversationAttributes = payload.conversation_attributes; this.conversationDateCreated = deserialize.iso8601DateTime(payload.conversation_date_created); this.conversationDateUpdated = deserialize.iso8601DateTime(payload.conversation_date_updated); this.conversationCreatedBy = payload.conversation_created_by; this.conversationState = payload.conversation_state; this.conversationTimers = payload.conversation_timers; this.links = payload.links; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, participantSid: this.participantSid, participantUserSid: this.participantUserSid, participantIdentity: this.participantIdentity, participantMessagingBinding: this.participantMessagingBinding, conversationSid: this.conversationSid, conversationUniqueName: this.conversationUniqueName, conversationFriendlyName: this.conversationFriendlyName, conversationAttributes: this.conversationAttributes, conversationDateCreated: this.conversationDateCreated, conversationDateUpdated: this.conversationDateUpdated, conversationCreatedBy: this.conversationCreatedBy, conversationState: this.conversationState, conversationTimers: this.conversationTimers, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantConversationInstance = ParticipantConversationInstance; class ParticipantConversationPage extends Page_1.default { /** * Initialize the ParticipantConversationPage * * @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 ParticipantConversationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ParticipantConversationInstance(this._version, payload, this._solution.chatServiceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ParticipantConversationPage = ParticipantConversationPage; rest/conversations/v1/service/conversation.d.ts000064400000053517151677225100015731 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { MessageListInstance } from "./conversation/message"; import { ParticipantListInstance } from "./conversation/participant"; import { WebhookListInstance } from "./conversation/webhook"; export type ConversationState = "inactive" | "active" | "closed"; export type ConversationWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a ConversationInstance */ export interface ConversationContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ConversationWebhookEnabledType; } /** * Options to pass to update a ConversationInstance */ export interface ConversationContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ConversationWebhookEnabledType; /** The human-readable name of this conversation, limited to 256 characters. Optional. */ friendlyName?: string; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. */ dateUpdated?: Date; /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. */ messagingServiceSid?: string; /** */ state?: ConversationState; /** ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. */ "timers.inactive"?: string; /** ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. */ "timers.closed"?: string; /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\\\'s `sid` in the URL. */ uniqueName?: string; /** The default email address that will be used when sending outbound emails in this conversation. */ "bindings.email.address"?: string; /** The default name that will be used when sending outbound emails in this conversation. */ "bindings.email.name"?: string; } /** * Options to pass to create a ConversationInstance */ export interface ConversationListInstanceCreateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: ConversationWebhookEnabledType; /** The human-readable name of this conversation, limited to 256 characters. Optional. */ friendlyName?: string; /** An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\\\'s `sid` in the URL. */ uniqueName?: string; /** An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. */ attributes?: string; /** The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. */ messagingServiceSid?: string; /** The date that this resource was created. */ dateCreated?: Date; /** The date that this resource was last updated. */ dateUpdated?: Date; /** */ state?: ConversationState; /** ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. */ "timers.inactive"?: string; /** ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. */ "timers.closed"?: string; /** The default email address that will be used when sending outbound emails in this conversation. */ "bindings.email.address"?: string; /** The default name that will be used when sending outbound emails in this conversation. */ "bindings.email.name"?: string; } /** * Options to pass to each */ export interface ConversationListInstanceEachOptions { /** Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ startDate?: string; /** Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ endDate?: string; /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ state?: ConversationState; /** 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: ConversationInstance, 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 ConversationListInstanceOptions { /** Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ startDate?: string; /** Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ endDate?: string; /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ state?: ConversationState; /** 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 ConversationListInstancePageOptions { /** Specifies the beginning of the date range for filtering Conversations based on their creation date. Conversations that were created on or after this date will be included in the results. The date must be in ISO8601 format, specifically starting at the beginning of the specified date (YYYY-MM-DDT00:00:00Z), for precise filtering. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ startDate?: string; /** Defines the end of the date range for filtering conversations by their creation date. Only conversations that were created on or before this date will appear in the results. The date must be in ISO8601 format, specifically capturing up to the end of the specified date (YYYY-MM-DDT23:59:59Z), to ensure that conversations from the entire end day are included. This parameter can be combined with other filters. If this filter is used, the returned list is sorted by latest conversation creation date in descending order. */ endDate?: string; /** State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` */ state?: ConversationState; /** 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 ConversationContext { messages: MessageListInstance; participants: ParticipantListInstance; webhooks: WebhookListInstance; /** * Remove a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ remove(params: ConversationContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ fetch(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Update a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ update(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Update a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ update(params: ConversationContextUpdateOptions, callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConversationContextSolution { chatServiceSid: string; sid: string; } export declare class ConversationContextImpl implements ConversationContext { protected _version: V1; protected _solution: ConversationContextSolution; protected _uri: string; protected _messages?: MessageListInstance; protected _participants?: ParticipantListInstance; protected _webhooks?: WebhookListInstance; constructor(_version: V1, chatServiceSid: string, sid: string); get messages(): MessageListInstance; get participants(): ParticipantListInstance; get webhooks(): WebhookListInstance; remove(params?: ConversationContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; update(params?: ConversationContextUpdateOptions | ((error: Error | null, item?: ConversationInstance) => any), callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConversationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConversationPayload extends TwilioResponsePayload { conversations: ConversationResource[]; } interface ConversationResource { account_sid: string; chat_service_sid: string; messaging_service_sid: string; sid: string; friendly_name: string; unique_name: string; attributes: string; state: ConversationState; date_created: Date; date_updated: Date; timers: any; url: string; links: Record<string, string>; bindings: any; } export declare class ConversationInstance { protected _version: V1; protected _solution: ConversationContextSolution; protected _context?: ConversationContext; constructor(_version: V1, payload: ConversationResource, chatServiceSid: string, sid?: string); /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. */ accountSid: string; /** * The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. */ chatServiceSid: string; /** * The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. */ messagingServiceSid: string; /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The human-readable name of this conversation, limited to 256 characters. Optional. */ friendlyName: string; /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource\'s `sid` in the URL. */ uniqueName: string; /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. */ attributes: string; state: ConversationState; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. */ dateUpdated: Date; /** * Timer date values representing state update for this conversation. */ timers: any; /** * An absolute API resource URL for this conversation. */ url: string; /** * Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. */ links: Record<string, string>; bindings: any; private get _proxy(); /** * Remove a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ remove(params: ConversationContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ fetch(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Update a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ update(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Update a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ update(params: ConversationContextUpdateOptions, callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Access the messages. */ messages(): MessageListInstance; /** * Access the participants. */ participants(): ParticipantListInstance; /** * Access the webhooks. */ webhooks(): WebhookListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; chatServiceSid: string; messagingServiceSid: string; sid: string; friendlyName: string; uniqueName: string; attributes: string; state: ConversationState; dateCreated: Date; dateUpdated: Date; timers: any; url: string; links: Record<string, string>; bindings: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConversationSolution { chatServiceSid: string; } export interface ConversationListInstance { _version: V1; _solution: ConversationSolution; _uri: string; (sid: string): ConversationContext; get(sid: string): ConversationContext; /** * Create a ConversationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ create(callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Create a ConversationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConversationInstance */ create(params: ConversationListInstanceCreateOptions, callback?: (error: Error | null, item?: ConversationInstance) => any): Promise<ConversationInstance>; /** * Streams ConversationInstance 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 { ConversationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ConversationInstance, done: (err?: Error) => void) => void): void; each(params: ConversationListInstanceEachOptions, callback?: (item: ConversationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ConversationInstance 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: ConversationPage) => any): Promise<ConversationPage>; /** * Lists ConversationInstance 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 { ConversationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ConversationInstance[]) => any): Promise<ConversationInstance[]>; list(params: ConversationListInstanceOptions, callback?: (error: Error | null, items: ConversationInstance[]) => any): Promise<ConversationInstance[]>; /** * Retrieve a single page of ConversationInstance 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 { ConversationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ConversationPage) => any): Promise<ConversationPage>; page(params: ConversationListInstancePageOptions, callback?: (error: Error | null, items: ConversationPage) => any): Promise<ConversationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConversationListInstance(version: V1, chatServiceSid: string): ConversationListInstance; export declare class ConversationPage extends Page<V1, ConversationPayload, ConversationResource, ConversationInstance> { /** * Initialize the ConversationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ConversationSolution); /** * Build an instance of ConversationInstance * * @param payload - Payload response from the API */ getInstance(payload: ConversationResource): ConversationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/user.d.ts000064400000036144151677225100014172 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { UserConversationListInstance } from "./user/userConversation"; export type UserWebhookEnabledType = "true" | "false"; /** * Options to pass to remove a UserInstance */ export interface UserContextRemoveOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; } /** * Options to pass to update a UserInstance */ export interface UserContextUpdateOptions { /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes?: string; /** The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. */ roleSid?: string; } /** * Options to pass to create a UserInstance */ export interface UserListInstanceCreateOptions { /** The application-defined string that uniquely identifies the resource\\\'s User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. */ identity: string; /** The X-Twilio-Webhook-Enabled HTTP request header */ xTwilioWebhookEnabled?: UserWebhookEnabledType; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes?: string; /** The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. */ roleSid?: string; } /** * Options to pass to each */ export interface UserListInstanceEachOptions { /** 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: UserInstance, 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 UserListInstanceOptions { /** 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 UserListInstancePageOptions { /** 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 UserContext { userConversations: UserConversationListInstance; /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ remove(params: UserContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UserContextSolution { chatServiceSid: string; sid: string; } export declare class UserContextImpl implements UserContext { protected _version: V1; protected _solution: UserContextSolution; protected _uri: string; protected _userConversations?: UserConversationListInstance; constructor(_version: V1, chatServiceSid: string, sid: string); get userConversations(): UserConversationListInstance; remove(params?: UserContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; update(params?: UserContextUpdateOptions | ((error: Error | null, item?: UserInstance) => any), callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UserPayload extends TwilioResponsePayload { users: UserResource[]; } interface UserResource { sid: string; account_sid: string; chat_service_sid: string; role_sid: string; identity: string; friendly_name: string; attributes: string; is_online: boolean; is_notifiable: boolean; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class UserInstance { protected _version: V1; protected _solution: UserContextSolution; protected _context?: UserContext; constructor(_version: V1, payload: UserResource, chatServiceSid: string, sid?: string); /** * The unique string that we created to identify the User resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. */ accountSid: string; /** * The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. */ chatServiceSid: string; /** * The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. */ roleSid: string; /** * The application-defined string that uniquely identifies the resource\'s User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. */ identity: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. */ attributes: string; /** * Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service\'s `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service\'s `reachability_enabled` is `true`. */ isOnline: boolean; /** * Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service\'s `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service\'s `reachability_enabled` is `true`. */ isNotifiable: boolean; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * An absolute API resource URL for this user. */ url: string; links: Record<string, string>; private get _proxy(); /** * Remove a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ remove(params: UserContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ fetch(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Update a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ update(params: UserContextUpdateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Access the userConversations. */ userConversations(): UserConversationListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; chatServiceSid: string; roleSid: string; identity: string; friendlyName: string; attributes: string; isOnline: boolean; isNotifiable: boolean; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UserSolution { chatServiceSid: string; } export interface UserListInstance { _version: V1; _solution: UserSolution; _uri: string; (sid: string): UserContext; get(sid: string): UserContext; /** * Create a UserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UserInstance */ create(params: UserListInstanceCreateOptions, callback?: (error: Error | null, item?: UserInstance) => any): Promise<UserInstance>; /** * Streams UserInstance 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 { UserListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; each(params: UserListInstanceEachOptions, callback?: (item: UserInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UserInstance 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: UserPage) => any): Promise<UserPage>; /** * Lists UserInstance 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 { UserListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; list(params: UserListInstanceOptions, callback?: (error: Error | null, items: UserInstance[]) => any): Promise<UserInstance[]>; /** * Retrieve a single page of UserInstance 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 { UserListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; page(params: UserListInstancePageOptions, callback?: (error: Error | null, items: UserPage) => any): Promise<UserPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UserListInstance(version: V1, chatServiceSid: string): UserListInstance; export declare class UserPage extends Page<V1, UserPayload, UserResource, UserInstance> { /** * Initialize the UserPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UserSolution); /** * Build an instance of UserInstance * * @param payload - Payload response from the API */ getInstance(payload: UserResource): UserInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/service/role.js000064400000024306151677225100013716 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.RolePage = exports.RoleListInstance = exports.RoleInstance = exports.RoleContextImpl = void 0; 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 RoleContextImpl { constructor(_version, chatServiceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { chatServiceSid, sid }; this._uri = `/Services/${chatServiceSid}/Roles/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.chatServiceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.chatServiceSid, 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.RoleContextImpl = RoleContextImpl; class RoleInstance { constructor(_version, payload, chatServiceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.permissions = payload.permissions; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { chatServiceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RoleContextImpl(this._version, this._solution.chatServiceSid, this._solution.sid); return this._context; } /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, friendlyName: this.friendlyName, type: this.type, permissions: this.permissions, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoleInstance = RoleInstance; function RoleListInstance(version, chatServiceSid) { if (!(0, utility_1.isValidPathParam)(chatServiceSid)) { throw new Error("Parameter 'chatServiceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RoleContextImpl(version, chatServiceSid, sid); }; instance._version = version; instance._solution = { chatServiceSid }; instance._uri = `/Services/${chatServiceSid}/Roles`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.chatServiceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RolePage(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 RolePage(instance._version, payload, 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; } exports.RoleListInstance = RoleListInstance; class RolePage extends Page_1.default { /** * Initialize the RolePage * * @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 RoleInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RoleInstance(this._version, payload, this._solution.chatServiceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RolePage = RolePage; rest/conversations/v1/addressConfiguration.d.ts000064400000037420151677225100015727 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type AddressConfigurationAutoCreationType = "webhook" | "studio" | "default"; export type AddressConfigurationMethod = "GET" | "POST"; export type AddressConfigurationType = "sms" | "whatsapp" | "messenger" | "gbm" | "email"; /** * Options to pass to update a AddressConfigurationInstance */ export interface AddressConfigurationContextUpdateOptions { /** The human-readable name of this configuration, limited to 256 characters. Optional. */ friendlyName?: string; /** Enable/Disable auto-creating conversations for messages to this address */ "autoCreation.enabled"?: boolean; /** */ "autoCreation.type"?: AddressConfigurationAutoCreationType; /** Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service. */ "autoCreation.conversationServiceSid"?: string; /** For type `webhook`, the url for the webhook request. */ "autoCreation.webhookUrl"?: string; /** */ "autoCreation.webhookMethod"?: AddressConfigurationMethod; /** The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated` */ "autoCreation.webhookFilters"?: Array<string>; /** For type `studio`, the studio flow SID where the webhook should be sent to. */ "autoCreation.studioFlowSid"?: string; /** For type `studio`, number of times to retry the webhook request */ "autoCreation.studioRetryCount"?: number; } /** * Options to pass to create a AddressConfigurationInstance */ export interface AddressConfigurationListInstanceCreateOptions { /** */ type: AddressConfigurationType; /** The unique address to be configured. The address can be a whatsapp address or phone number */ address: string; /** The human-readable name of this configuration, limited to 256 characters. Optional. */ friendlyName?: string; /** Enable/Disable auto-creating conversations for messages to this address */ "autoCreation.enabled"?: boolean; /** */ "autoCreation.type"?: AddressConfigurationAutoCreationType; /** Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service. */ "autoCreation.conversationServiceSid"?: string; /** For type `webhook`, the url for the webhook request. */ "autoCreation.webhookUrl"?: string; /** */ "autoCreation.webhookMethod"?: AddressConfigurationMethod; /** The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated` */ "autoCreation.webhookFilters"?: Array<string>; /** For type `studio`, the studio flow SID where the webhook should be sent to. */ "autoCreation.studioFlowSid"?: string; /** For type `studio`, number of times to retry the webhook request */ "autoCreation.studioRetryCount"?: number; /** An ISO 3166-1 alpha-2n country code which the address belongs to. This is currently only applicable to short code addresses. */ addressCountry?: string; } /** * Options to pass to each */ export interface AddressConfigurationListInstanceEachOptions { /** Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`. */ type?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AddressConfigurationInstance, 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 AddressConfigurationListInstanceOptions { /** Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`. */ type?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AddressConfigurationListInstancePageOptions { /** Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`. */ type?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AddressConfigurationContext { /** * Remove a AddressConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AddressConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressConfigurationInstance */ fetch(callback?: (error: Error | null, item?: AddressConfigurationInstance) => any): Promise<AddressConfigurationInstance>; /** * Update a AddressConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressConfigurationInstance */ update(callback?: (error: Error | null, item?: AddressConfigurationInstance) => any): Promise<AddressConfigurationInstance>; /** * Update a AddressConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressConfigurationInstance */ update(params: AddressConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: AddressConfigurationInstance) => any): Promise<AddressConfigurationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AddressConfigurationContextSolution { sid: string; } export declare class AddressConfigurationContextImpl implements AddressConfigurationContext { protected _version: V1; protected _solution: AddressConfigurationContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AddressConfigurationInstance) => any): Promise<AddressConfigurationInstance>; update(params?: AddressConfigurationContextUpdateOptions | ((error: Error | null, item?: AddressConfigurationInstance) => any), callback?: (error: Error | null, item?: AddressConfigurationInstance) => any): Promise<AddressConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AddressConfigurationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AddressConfigurationPayload extends TwilioResponsePayload { address_configurations: AddressConfigurationResource[]; } interface AddressConfigurationResource { sid: string; account_sid: string; type: string; address: string; friendly_name: string; auto_creation: any; date_created: Date; date_updated: Date; url: string; address_country: string; } export declare class AddressConfigurationInstance { protected _version: V1; protected _solution: AddressConfigurationContextSolution; protected _context?: AddressConfigurationContext; constructor(_version: V1, payload: AddressConfigurationResource, sid?: string); /** * A 34 character string that uniquely identifies this resource. */ sid: string; /** * The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) the address belongs to */ accountSid: string; /** * Type of Address, value can be `whatsapp` or `sms`. */ type: string; /** * The unique address to be configured. The address can be a whatsapp address or phone number */ address: string; /** * The human-readable name of this configuration, limited to 256 characters. Optional. */ friendlyName: string; /** * Auto Creation configuration for the address. */ autoCreation: any; /** * The date that this resource was created. */ dateCreated: Date; /** * The date that this resource was last updated. */ dateUpdated: Date; /** * An absolute API resource URL for this address configuration. */ url: string; /** * An ISO 3166-1 alpha-2n country code which the address belongs to. This is currently only applicable to short code addresses. */ addressCountry: string; private get _proxy(); /** * Remove a AddressConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AddressConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressConfigurationInstance */ fetch(callback?: (error: Error | null, item?: AddressConfigurationInstance) => any): Promise<AddressConfigurationInstance>; /** * Update a AddressConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressConfigurationInstance */ update(callback?: (error: Error | null, item?: AddressConfigurationInstance) => any): Promise<AddressConfigurationInstance>; /** * Update a AddressConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressConfigurationInstance */ update(params: AddressConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: AddressConfigurationInstance) => any): Promise<AddressConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; type: string; address: string; friendlyName: string; autoCreation: any; dateCreated: Date; dateUpdated: Date; url: string; addressCountry: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AddressConfigurationSolution { } export interface AddressConfigurationListInstance { _version: V1; _solution: AddressConfigurationSolution; _uri: string; (sid: string): AddressConfigurationContext; get(sid: string): AddressConfigurationContext; /** * Create a AddressConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AddressConfigurationInstance */ create(params: AddressConfigurationListInstanceCreateOptions, callback?: (error: Error | null, item?: AddressConfigurationInstance) => any): Promise<AddressConfigurationInstance>; /** * Streams AddressConfigurationInstance 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 { AddressConfigurationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AddressConfigurationInstance, done: (err?: Error) => void) => void): void; each(params: AddressConfigurationListInstanceEachOptions, callback?: (item: AddressConfigurationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AddressConfigurationInstance 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: AddressConfigurationPage) => any): Promise<AddressConfigurationPage>; /** * Lists AddressConfigurationInstance 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 { AddressConfigurationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AddressConfigurationInstance[]) => any): Promise<AddressConfigurationInstance[]>; list(params: AddressConfigurationListInstanceOptions, callback?: (error: Error | null, items: AddressConfigurationInstance[]) => any): Promise<AddressConfigurationInstance[]>; /** * Retrieve a single page of AddressConfigurationInstance 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 { AddressConfigurationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AddressConfigurationPage) => any): Promise<AddressConfigurationPage>; page(params: AddressConfigurationListInstancePageOptions, callback?: (error: Error | null, items: AddressConfigurationPage) => any): Promise<AddressConfigurationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AddressConfigurationListInstance(version: V1): AddressConfigurationListInstance; export declare class AddressConfigurationPage extends Page<V1, AddressConfigurationPayload, AddressConfigurationResource, AddressConfigurationInstance> { /** * Initialize the AddressConfigurationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AddressConfigurationSolution); /** * Build an instance of AddressConfigurationInstance * * @param payload - Payload response from the API */ getInstance(payload: AddressConfigurationResource): AddressConfigurationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/conversations/v1/role.js000064400000023103151677225100012250 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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.RolePage = exports.RoleListInstance = exports.RoleInstance = exports.RoleContextImpl = void 0; 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 RoleContextImpl { 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 = `/Roles/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload, 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.RoleContextImpl = RoleContextImpl; class RoleInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.chatServiceSid = payload.chat_service_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.permissions = payload.permissions; 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 RoleContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RoleInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RoleInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, chatServiceSid: this.chatServiceSid, friendlyName: this.friendlyName, type: this.type, permissions: this.permissions, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RoleInstance = RoleInstance; function RoleListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RoleContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Roles`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } if (params["permission"] === null || params["permission"] === undefined) { throw new Error("Required parameter \"params['permission']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; data["Permission"] = serialize.map(params["permission"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RoleInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RolePage(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 RolePage(instance._version, payload, 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; } exports.RoleListInstance = RoleListInstance; class RolePage extends Page_1.default { /** * Initialize the RolePage * * @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 RoleInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RoleInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RolePage = RolePage; rest/conversations/V1.js000064400000006235151677225100011256 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Conversations * 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 addressConfiguration_1 = require("./v1/addressConfiguration"); const configuration_1 = require("./v1/configuration"); const conversation_1 = require("./v1/conversation"); const credential_1 = require("./v1/credential"); const participantConversation_1 = require("./v1/participantConversation"); const role_1 = require("./v1/role"); const service_1 = require("./v1/service"); const user_1 = require("./v1/user"); class V1 extends Version_1.default { /** * Initialize the V1 version of Conversations * * @param domain - The Twilio (Twilio.Conversations) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for addressConfigurations resource */ get addressConfigurations() { this._addressConfigurations = this._addressConfigurations || (0, addressConfiguration_1.AddressConfigurationListInstance)(this); return this._addressConfigurations; } /** Getter for configuration resource */ get configuration() { this._configuration = this._configuration || (0, configuration_1.ConfigurationListInstance)(this); return this._configuration; } /** Getter for conversations resource */ get conversations() { this._conversations = this._conversations || (0, conversation_1.ConversationListInstance)(this); return this._conversations; } /** Getter for credentials resource */ get credentials() { this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this); return this._credentials; } /** Getter for participantConversations resource */ get participantConversations() { this._participantConversations = this._participantConversations || (0, participantConversation_1.ParticipantConversationListInstance)(this); return this._participantConversations; } /** Getter for roles resource */ get roles() { this._roles = this._roles || (0, role_1.RoleListInstance)(this); return this._roles; } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } /** Getter for users resource */ get users() { this._users = this._users || (0, user_1.UserListInstance)(this); return this._users; } } exports.default = V1; rest/ServerlessBase.d.ts000064400000000462151677225100011253 0ustar00import Domain from "../base/Domain"; import V1 from "./serverless/V1"; declare class ServerlessBase extends Domain { _v1?: V1; /** * Initialize serverless domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = ServerlessBase; rest/ConversationsBase.d.ts000064400000000476151677225100011760 0ustar00import Domain from "../base/Domain"; import V1 from "./conversations/V1"; declare class ConversationsBase extends Domain { _v1?: V1; /** * Initialize conversations domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = ConversationsBase; rest/monitor/V1.d.ts000064400000001371151677225100010300 0ustar00import MonitorBase from "../MonitorBase"; import Version from "../../base/Version"; import { AlertListInstance } from "./v1/alert"; import { EventListInstance } from "./v1/event"; export default class V1 extends Version { /** * Initialize the V1 version of Monitor * * @param domain - The Twilio (Twilio.Monitor) domain */ constructor(domain: MonitorBase); /** alerts - { Twilio.Monitor.V1.AlertListInstance } resource */ protected _alerts?: AlertListInstance; /** events - { Twilio.Monitor.V1.EventListInstance } resource */ protected _events?: EventListInstance; /** Getter for alerts resource */ get alerts(): AlertListInstance; /** Getter for events resource */ get events(): EventListInstance; } rest/monitor/v1/alert.js000064400000017426151677225100011223 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Monitor * 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.AlertPage = exports.AlertListInstance = exports.AlertInstance = exports.AlertContextImpl = void 0; 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 AlertContextImpl { 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 = `/Alerts/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AlertInstance(operationVersion, payload, 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.AlertContextImpl = AlertContextImpl; class AlertInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.alertText = payload.alert_text; this.apiVersion = payload.api_version; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateGenerated = deserialize.iso8601DateTime(payload.date_generated); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.errorCode = payload.error_code; this.logLevel = payload.log_level; this.moreInfo = payload.more_info; this.requestMethod = payload.request_method; this.requestUrl = payload.request_url; this.requestVariables = payload.request_variables; this.resourceSid = payload.resource_sid; this.responseBody = payload.response_body; this.responseHeaders = payload.response_headers; this.sid = payload.sid; this.url = payload.url; this.requestHeaders = payload.request_headers; this.serviceSid = payload.service_sid; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AlertContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a AlertInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AlertInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, alertText: this.alertText, apiVersion: this.apiVersion, dateCreated: this.dateCreated, dateGenerated: this.dateGenerated, dateUpdated: this.dateUpdated, errorCode: this.errorCode, logLevel: this.logLevel, moreInfo: this.moreInfo, requestMethod: this.requestMethod, requestUrl: this.requestUrl, requestVariables: this.requestVariables, resourceSid: this.resourceSid, responseBody: this.responseBody, responseHeaders: this.responseHeaders, sid: this.sid, url: this.url, requestHeaders: this.requestHeaders, serviceSid: this.serviceSid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AlertInstance = AlertInstance; function AlertListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AlertContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Alerts`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["logLevel"] !== undefined) data["LogLevel"] = params["logLevel"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AlertPage(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 AlertPage(instance._version, payload, 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; } exports.AlertListInstance = AlertListInstance; class AlertPage extends Page_1.default { /** * Initialize the AlertPage * * @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 AlertInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AlertInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AlertPage = AlertPage; rest/monitor/v1/alert.d.ts000064400000031563151677225100011455 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface AlertListInstanceEachOptions { /** Only show alerts for this log-level. Can be: `error`, `warning`, `notice`, or `debug`. */ logLevel?: string; /** Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. */ startDate?: Date; /** Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. */ endDate?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AlertInstance, 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 AlertListInstanceOptions { /** Only show alerts for this log-level. Can be: `error`, `warning`, `notice`, or `debug`. */ logLevel?: string; /** Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. */ startDate?: Date; /** Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. */ endDate?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AlertListInstancePageOptions { /** Only show alerts for this log-level. Can be: `error`, `warning`, `notice`, or `debug`. */ logLevel?: string; /** Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. */ startDate?: Date; /** Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. */ endDate?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AlertContext { /** * Fetch a AlertInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AlertInstance */ fetch(callback?: (error: Error | null, item?: AlertInstance) => any): Promise<AlertInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AlertContextSolution { sid: string; } export declare class AlertContextImpl implements AlertContext { protected _version: V1; protected _solution: AlertContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: AlertInstance) => any): Promise<AlertInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AlertContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AlertPayload extends TwilioResponsePayload { alerts: AlertResource[]; } interface AlertResource { account_sid: string; alert_text: string; api_version: string; date_created: Date; date_generated: Date; date_updated: Date; error_code: string; log_level: string; more_info: string; request_method: string; request_url: string; request_variables: string; resource_sid: string; response_body: string; response_headers: string; sid: string; url: string; request_headers: string; service_sid: string; } export declare class AlertInstance { protected _version: V1; protected _solution: AlertContextSolution; protected _context?: AlertContext; constructor(_version: V1, payload: AlertResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource. */ accountSid: string; /** * The text of the alert. */ alertText: string; /** * The API version used when the alert was generated. Can be empty for events that don\'t have a specific API version. */ apiVersion: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. Due to buffering, this can be different than `date_created`. */ dateGenerated: 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 error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error. */ errorCode: string; /** * The log level. Can be: `error`, `warning`, `notice`, or `debug`. */ logLevel: string; /** * The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition. */ moreInfo: string; /** * The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used. */ requestMethod: string; /** * The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested. */ requestUrl: string; /** * The variables passed in the request that generated the alert. This value is only returned when a single Alert resource is fetched. */ requestVariables: string; /** * The SID of the resource for which the alert was generated. For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server. This value is empty if the alert was not generated for a particular resource. */ resourceSid: string; /** * The response body of the request that generated the alert. This value is only returned when a single Alert resource is fetched. */ responseBody: string; /** * The response headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. */ responseHeaders: string; /** * The unique string that we created to identify the Alert resource. */ sid: string; /** * The absolute URL of the Alert resource. */ url: string; /** * The request headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. */ requestHeaders: string; /** * The SID of the service or resource that generated the alert. Can be `null`. */ serviceSid: string; private get _proxy(); /** * Fetch a AlertInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AlertInstance */ fetch(callback?: (error: Error | null, item?: AlertInstance) => any): Promise<AlertInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; alertText: string; apiVersion: string; dateCreated: Date; dateGenerated: Date; dateUpdated: Date; errorCode: string; logLevel: string; moreInfo: string; requestMethod: string; requestUrl: string; requestVariables: string; resourceSid: string; responseBody: string; responseHeaders: string; sid: string; url: string; requestHeaders: string; serviceSid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AlertSolution { } export interface AlertListInstance { _version: V1; _solution: AlertSolution; _uri: string; (sid: string): AlertContext; get(sid: string): AlertContext; /** * Streams AlertInstance 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 { AlertListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AlertInstance, done: (err?: Error) => void) => void): void; each(params: AlertListInstanceEachOptions, callback?: (item: AlertInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AlertInstance 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: AlertPage) => any): Promise<AlertPage>; /** * Lists AlertInstance 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 { AlertListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AlertInstance[]) => any): Promise<AlertInstance[]>; list(params: AlertListInstanceOptions, callback?: (error: Error | null, items: AlertInstance[]) => any): Promise<AlertInstance[]>; /** * Retrieve a single page of AlertInstance 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 { AlertListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AlertPage) => any): Promise<AlertPage>; page(params: AlertListInstancePageOptions, callback?: (error: Error | null, items: AlertPage) => any): Promise<AlertPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AlertListInstance(version: V1): AlertListInstance; export declare class AlertPage extends Page<V1, AlertPayload, AlertResource, AlertInstance> { /** * Initialize the AlertPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AlertSolution); /** * Build an instance of AlertInstance * * @param payload - Payload response from the API */ getInstance(payload: AlertResource): AlertInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/monitor/v1/event.js000064400000016776151677225100011244 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Monitor * 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.EventPage = exports.EventListInstance = exports.EventInstance = exports.EventContextImpl = void 0; 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 EventContextImpl { 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 = `/Events/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EventInstance(operationVersion, payload, 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.EventContextImpl = EventContextImpl; class EventInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.actorSid = payload.actor_sid; this.actorType = payload.actor_type; this.description = payload.description; this.eventData = payload.event_data; this.eventDate = deserialize.iso8601DateTime(payload.event_date); this.eventType = payload.event_type; this.resourceSid = payload.resource_sid; this.resourceType = payload.resource_type; this.sid = payload.sid; this.source = payload.source; this.sourceIpAddress = payload.source_ip_address; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new EventContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a EventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EventInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, actorSid: this.actorSid, actorType: this.actorType, description: this.description, eventData: this.eventData, eventDate: this.eventDate, eventType: this.eventType, resourceSid: this.resourceSid, resourceType: this.resourceType, sid: this.sid, source: this.source, sourceIpAddress: this.sourceIpAddress, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventInstance = EventInstance; function EventListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EventContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Events`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["actorSid"] !== undefined) data["ActorSid"] = params["actorSid"]; if (params["eventType"] !== undefined) data["EventType"] = params["eventType"]; if (params["resourceSid"] !== undefined) data["ResourceSid"] = params["resourceSid"]; if (params["sourceIpAddress"] !== undefined) data["SourceIpAddress"] = params["sourceIpAddress"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EventPage(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 EventPage(instance._version, payload, 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; } exports.EventListInstance = EventListInstance; class EventPage extends Page_1.default { /** * Initialize the EventPage * * @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 EventInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EventInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventPage = EventPage; rest/monitor/v1/event.d.ts000064400000031514151677225100011463 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface EventListInstanceEachOptions { /** Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials. */ actorSid?: string; /** Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types). */ eventType?: string; /** Only include events that refer to this resource. Useful for discovering the history of a specific resource. */ resourceSid?: string; /** Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console. */ sourceIpAddress?: string; /** Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ endDate?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: EventInstance, 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 EventListInstanceOptions { /** Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials. */ actorSid?: string; /** Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types). */ eventType?: string; /** Only include events that refer to this resource. Useful for discovering the history of a specific resource. */ resourceSid?: string; /** Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console. */ sourceIpAddress?: string; /** Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ endDate?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface EventListInstancePageOptions { /** Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials. */ actorSid?: string; /** Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types). */ eventType?: string; /** Only include events that refer to this resource. Useful for discovering the history of a specific resource. */ resourceSid?: string; /** Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console. */ sourceIpAddress?: string; /** Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ endDate?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface EventContext { /** * Fetch a EventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EventInstance */ fetch(callback?: (error: Error | null, item?: EventInstance) => any): Promise<EventInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EventContextSolution { sid: string; } export declare class EventContextImpl implements EventContext { protected _version: V1; protected _solution: EventContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: EventInstance) => any): Promise<EventInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EventContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EventPayload extends TwilioResponsePayload { events: EventResource[]; } interface EventResource { account_sid: string; actor_sid: string; actor_type: string; description: string; event_data: any; event_date: Date; event_type: string; resource_sid: string; resource_type: string; sid: string; source: string; source_ip_address: string; url: string; links: Record<string, string>; } export declare class EventInstance { protected _version: V1; protected _solution: EventContextSolution; protected _context?: EventContext; constructor(_version: V1, payload: EventResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. */ accountSid: string; /** * The SID of the actor that caused the event, if available. Can be `null`. */ actorSid: string; /** * The type of actor that caused the event. Can be: `user` for a change made by a logged-in user in the Twilio Console, `account` for an event caused by an API request by an authenticating Account, `twilio-admin` for an event caused by a Twilio employee, and so on. */ actorType: string; /** * A description of the event. Can be `null`. */ description: string; /** * An object with additional data about the event. The contents depend on `event_type`. For example, event-types of the form `RESOURCE.updated`, this value contains a `resource_properties` dictionary that describes the previous and updated properties of the resource. */ eventData: any; /** * The date and time in GMT when the event was recorded specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ eventDate: Date; /** * The event\'s type. Event-types are typically in the form: `RESOURCE_TYPE.ACTION`, where `RESOURCE_TYPE` is the type of resource that was affected and `ACTION` is what happened to it. For example, `phone-number.created`. For a full list of all event-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). */ eventType: string; /** * The SID of the resource that was affected. */ resourceSid: string; /** * The type of resource that was affected. For a full list of all resource-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). */ resourceType: string; /** * The unique string that we created to identify the Event resource. */ sid: string; /** * The originating system or interface that caused the event. Can be: `web` for events caused by user action in the Twilio Console, `api` for events caused by a request to our API, or `twilio` for events caused by an automated or internal Twilio system. */ source: string; /** * The IP address of the source, if the source is outside the Twilio cloud. This value is `null` for events with `source` of `twilio` */ sourceIpAddress: string; /** * The absolute URL of the resource that was affected. Can be `null`. */ url: string; /** * The absolute URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a EventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EventInstance */ fetch(callback?: (error: Error | null, item?: EventInstance) => any): Promise<EventInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; actorSid: string; actorType: string; description: string; eventData: any; eventDate: Date; eventType: string; resourceSid: string; resourceType: string; sid: string; source: string; sourceIpAddress: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EventSolution { } export interface EventListInstance { _version: V1; _solution: EventSolution; _uri: string; (sid: string): EventContext; get(sid: string): EventContext; /** * Streams EventInstance 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 { EventListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EventInstance, done: (err?: Error) => void) => void): void; each(params: EventListInstanceEachOptions, callback?: (item: EventInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EventInstance 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: EventPage) => any): Promise<EventPage>; /** * Lists EventInstance 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 { EventListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>; list(params: EventListInstanceOptions, callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>; /** * Retrieve a single page of EventInstance 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 { EventListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>; page(params: EventListInstancePageOptions, callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EventListInstance(version: V1): EventListInstance; export declare class EventPage extends Page<V1, EventPayload, EventResource, EventInstance> { /** * Initialize the EventPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: EventSolution); /** * Build an instance of EventInstance * * @param payload - Payload response from the API */ getInstance(payload: EventResource): EventInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/monitor/V1.js000064400000002637151677225100010052 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Monitor * 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 alert_1 = require("./v1/alert"); const event_1 = require("./v1/event"); class V1 extends Version_1.default { /** * Initialize the V1 version of Monitor * * @param domain - The Twilio (Twilio.Monitor) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for alerts resource */ get alerts() { this._alerts = this._alerts || (0, alert_1.AlertListInstance)(this); return this._alerts; } /** Getter for events resource */ get events() { this._events = this._events || (0, event_1.EventListInstance)(this); return this._events; } } exports.default = V1; rest/Bulkexports.js000064400000001360151677225100010407 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const BulkexportsBase_1 = __importDefault(require("./BulkexportsBase")); class Bulkexports extends BulkexportsBase_1.default { /** * @deprecated - Use v1.exports instead */ get exports() { console.warn("exports is deprecated. Use v1.exports instead."); return this.v1.exports; } /** * @deprecated - Use v1.exportConfiguration instead */ get exportConfiguration() { console.warn("exportConfiguration is deprecated. Use v1.exportConfiguration instead."); return this.v1.exportConfiguration; } } module.exports = Bulkexports; rest/VoiceBase.js000064400000002033151677225100007723 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./voice/V1")); class VoiceBase extends Domain_1.default { /** * Initialize voice domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://voice.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = VoiceBase; rest/ContentBase.js000064400000002301151677225100010266 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./content/V1")); const V2_1 = __importDefault(require("./content/V2")); class ContentBase extends Domain_1.default { /** * Initialize content domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://content.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = ContentBase; rest/Chat.js000064400000001555151677225100006752 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const ChatBase_1 = __importDefault(require("./ChatBase")); class Chat extends ChatBase_1.default { /** * @deprecated - Use v2.credentials instead */ get credentials() { console.warn("credentials is deprecated. Use v2.credentials instead."); return this.v2.credentials; } /** * @deprecated - Use v2.services instead */ get services() { console.warn("services is deprecated. Use v2.services instead."); return this.v2.services; } /** * @deprecated - Use v3.channels instead */ get channels() { console.warn("channels is deprecated. Use v3.channels instead."); return this.v3.channels; } } module.exports = Chat; rest/Intelligence.js000064400000000475151677225100010475 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const IntelligenceBase_1 = __importDefault(require("./IntelligenceBase")); class Intelligence extends IntelligenceBase_1.default { } module.exports = Intelligence; rest/IpMessaging.js000064400000001315151677225100010273 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const IpMessagingBase_1 = __importDefault(require("./IpMessagingBase")); class IpMessaging extends IpMessagingBase_1.default { /** * @deprecated - Use v2.credentials instead */ get credentials() { console.warn("credentials is deprecated. Use v2.credentials instead."); return this.v2.credentials; } /** * @deprecated - Use v2.services instead */ get services() { console.warn("services is deprecated. Use v2.services instead."); return this.v2.services; } } module.exports = IpMessaging; rest/oauth/V1.d.ts000064400000001407151677225100007731 0ustar00import OauthBase from "../OauthBase"; import Version from "../../base/Version"; import { AuthorizeListInstance } from "./v1/authorize"; import { TokenListInstance } from "./v1/token"; export default class V1 extends Version { /** * Initialize the V1 version of Oauth * * @param domain - The Twilio (Twilio.Oauth) domain */ constructor(domain: OauthBase); /** authorize - { Twilio.Oauth.V1.AuthorizeListInstance } resource */ protected _authorize?: AuthorizeListInstance; /** token - { Twilio.Oauth.V1.TokenListInstance } resource */ protected _token?: TokenListInstance; /** Getter for authorize resource */ get authorize(): AuthorizeListInstance; /** Getter for token resource */ get token(): TokenListInstance; } rest/oauth/v1/authorize.d.ts000064400000004064151677225100012005 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to fetch a AuthorizeInstance */ export interface AuthorizeListInstanceFetchOptions { /** Response Type */ responseType?: string; /** The Client Identifier */ clientId?: string; /** The url to which response will be redirected to */ redirectUri?: string; /** The scope of the access request */ scope?: string; /** An opaque value which can be used to maintain state between the request and callback */ state?: string; } export interface AuthorizeSolution { } export interface AuthorizeListInstance { _version: V1; _solution: AuthorizeSolution; _uri: string; /** * Fetch a AuthorizeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizeInstance */ fetch(callback?: (error: Error | null, item?: AuthorizeInstance) => any): Promise<AuthorizeInstance>; /** * Fetch a AuthorizeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AuthorizeInstance */ fetch(params: AuthorizeListInstanceFetchOptions, callback?: (error: Error | null, item?: AuthorizeInstance) => any): Promise<AuthorizeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AuthorizeListInstance(version: V1): AuthorizeListInstance; interface AuthorizeResource { redirect_to: string; } export declare class AuthorizeInstance { protected _version: V1; constructor(_version: V1, payload: AuthorizeResource); /** * The callback URL */ redirectTo: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { redirectTo: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/oauth/v1/authorize.js000064400000005620151677225100011550 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Oauth * 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.AuthorizeInstance = exports.AuthorizeListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function AuthorizeListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/authorize`; instance.fetch = function fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["responseType"] !== undefined) data["ResponseType"] = params["responseType"]; if (params["clientId"] !== undefined) data["ClientId"] = params["clientId"]; if (params["redirectUri"] !== undefined) data["RedirectUri"] = params["redirectUri"]; if (params["scope"] !== undefined) data["Scope"] = params["scope"]; if (params["state"] !== undefined) data["State"] = params["state"]; const headers = {}; let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AuthorizeInstance(operationVersion, payload)); 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; } exports.AuthorizeListInstance = AuthorizeListInstance; class AuthorizeInstance { constructor(_version, payload) { this._version = _version; this.redirectTo = payload.redirect_to; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { redirectTo: this.redirectTo, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AuthorizeInstance = AuthorizeInstance; rest/oauth/v1/token.d.ts000064400000005120151677225100011105 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a TokenInstance */ export interface TokenListInstanceCreateOptions { /** Grant type is a credential representing resource owner\\\'s authorization which can be used by client to obtain access token. */ grantType: string; /** A 34 character string that uniquely identifies this OAuth App. */ clientId: string; /** The credential for confidential OAuth App. */ clientSecret?: string; /** JWT token related to the authorization code grant type. */ code?: string; /** The redirect uri */ redirectUri?: string; /** The targeted audience uri */ audience?: string; /** JWT token related to refresh access token. */ refreshToken?: string; /** The scope of token */ scope?: string; } export interface TokenSolution { } export interface TokenListInstance { _version: V1; _solution: TokenSolution; _uri: string; /** * Create a TokenInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TokenInstance */ create(params: TokenListInstanceCreateOptions, callback?: (error: Error | null, item?: TokenInstance) => any): Promise<TokenInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TokenListInstance(version: V1): TokenListInstance; interface TokenResource { access_token: string; refresh_token: string; id_token: string; token_type: string; expires_in: number; } export declare class TokenInstance { protected _version: V1; constructor(_version: V1, payload: TokenResource); /** * Token which carries the necessary information to access a Twilio resource directly. */ accessToken: string; /** * Token which carries the information necessary to get a new access token. */ refreshToken: string; /** * Token which carries the information necessary of user profile. */ idToken: string; /** * Token type */ tokenType: string; expiresIn: number; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accessToken: string; refreshToken: string; idToken: string; tokenType: string; expiresIn: number; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/oauth/v1/token.js000064400000007406151677225100010662 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Oauth * 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.TokenInstance = exports.TokenListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function TokenListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/token`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["grantType"] === null || params["grantType"] === undefined) { throw new Error("Required parameter \"params['grantType']\" missing."); } if (params["clientId"] === null || params["clientId"] === undefined) { throw new Error("Required parameter \"params['clientId']\" missing."); } let data = {}; data["GrantType"] = params["grantType"]; data["ClientId"] = params["clientId"]; if (params["clientSecret"] !== undefined) data["ClientSecret"] = params["clientSecret"]; if (params["code"] !== undefined) data["Code"] = params["code"]; if (params["redirectUri"] !== undefined) data["RedirectUri"] = params["redirectUri"]; if (params["audience"] !== undefined) data["Audience"] = params["audience"]; if (params["refreshToken"] !== undefined) data["RefreshToken"] = params["refreshToken"]; if (params["scope"] !== undefined) data["Scope"] = params["scope"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TokenInstance(operationVersion, payload)); 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; } exports.TokenListInstance = TokenListInstance; class TokenInstance { constructor(_version, payload) { this._version = _version; this.accessToken = payload.access_token; this.refreshToken = payload.refresh_token; this.idToken = payload.id_token; this.tokenType = payload.token_type; this.expiresIn = payload.expires_in; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accessToken: this.accessToken, refreshToken: this.refreshToken, idToken: this.idToken, tokenType: this.tokenType, expiresIn: this.expiresIn, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TokenInstance = TokenInstance; rest/oauth/V1.js000064400000002663151677225100007502 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Oauth * 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 authorize_1 = require("./v1/authorize"); const token_1 = require("./v1/token"); class V1 extends Version_1.default { /** * Initialize the V1 version of Oauth * * @param domain - The Twilio (Twilio.Oauth) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for authorize resource */ get authorize() { this._authorize = this._authorize || (0, authorize_1.AuthorizeListInstance)(this); return this._authorize; } /** Getter for token resource */ get token() { this._token = this._token || (0, token_1.TokenListInstance)(this); return this._token; } } exports.default = V1; rest/AccountsBase.js000064400000002052151677225100010436 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./accounts/V1")); class AccountsBase extends Domain_1.default { /** * Initialize accounts domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://accounts.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = AccountsBase; rest/StudioBase.d.ts000064400000000540151677225100010362 0ustar00import Domain from "../base/Domain"; import V1 from "./studio/V1"; import V2 from "./studio/V2"; declare class StudioBase extends Domain { _v1?: V1; _v2?: V2; /** * Initialize studio domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; get v2(): V2; } export = StudioBase; rest/FrontlineApiBase.js000064400000002077151677225100011260 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./frontlineApi/V1")); class FrontlineApiBase extends Domain_1.default { /** * Initialize frontlineApi domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://frontline-api.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = FrontlineApiBase; rest/VerifyBase.d.ts000064400000000442151677225100010360 0ustar00import Domain from "../base/Domain"; import V2 from "./verify/V2"; declare class VerifyBase extends Domain { _v2?: V2; /** * Initialize verify domain * * @param twilio - The twilio client */ constructor(twilio: any); get v2(): V2; } export = VerifyBase; rest/Studio.d.ts000064400000000656151677225100007577 0ustar00import { FlowListInstance } from "./studio/v2/flow"; import { FlowValidateListInstance } from "./studio/v2/flowValidate"; import StudioBase from "./StudioBase"; declare class Studio extends StudioBase { /** * @deprecated - Use v2.flows instead */ get flows(): FlowListInstance; /** * @deprecated - Use v2.flowValidate instead */ get flowValidate(): FlowValidateListInstance; } export = Studio; rest/PreviewBase.d.ts000064400000001434151677225100010537 0ustar00import Domain from "../base/Domain"; import DeployedDevices from "./preview/DeployedDevices"; import HostedNumbers from "./preview/HostedNumbers"; import Sync from "./preview/Sync"; import Marketplace from "./preview/Marketplace"; import Wireless from "./preview/Wireless"; declare class PreviewBase extends Domain { _deployed_devices?: DeployedDevices; _hosted_numbers?: HostedNumbers; _sync?: Sync; _marketplace?: Marketplace; _wireless?: Wireless; /** * Initialize preview domain * * @param twilio - The twilio client */ constructor(twilio: any); get deployed_devices(): DeployedDevices; get hosted_numbers(): HostedNumbers; get sync(): Sync; get marketplace(): Marketplace; get wireless(): Wireless; } export = PreviewBase; rest/FlexApiBase.d.ts000064400000000545151677225100010450 0ustar00import Domain from "../base/Domain"; import V1 from "./flexApi/V1"; import V2 from "./flexApi/V2"; declare class FlexApiBase extends Domain { _v1?: V1; _v2?: V2; /** * Initialize flexApi domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; get v2(): V2; } export = FlexApiBase; rest/Bulkexports.d.ts000064400000000776151677225100010655 0ustar00import { ExportListInstance } from "./bulkexports/v1/export"; import { ExportConfigurationListInstance } from "./bulkexports/v1/exportConfiguration"; import BulkexportsBase from "./BulkexportsBase"; declare class Bulkexports extends BulkexportsBase { /** * @deprecated - Use v1.exports instead */ get exports(): ExportListInstance; /** * @deprecated - Use v1.exportConfiguration instead */ get exportConfiguration(): ExportConfigurationListInstance; } export = Bulkexports; rest/flexApi/V2.d.ts000064400000001502151677225100010176 0ustar00import FlexApiBase from "../FlexApiBase"; import Version from "../../base/Version"; import { FlexUserListInstance } from "./v2/flexUser"; import { WebChannelsListInstance } from "./v2/webChannels"; export default class V2 extends Version { /** * Initialize the V2 version of FlexApi * * @param domain - The Twilio (Twilio.FlexApi) domain */ constructor(domain: FlexApiBase); /** flexUser - { Twilio.FlexApi.V2.FlexUserListInstance } resource */ protected _flexUser?: FlexUserListInstance; /** webChannels - { Twilio.FlexApi.V2.WebChannelsListInstance } resource */ protected _webChannels?: WebChannelsListInstance; /** Getter for flexUser resource */ get flexUser(): FlexUserListInstance; /** Getter for webChannels resource */ get webChannels(): WebChannelsListInstance; } rest/flexApi/V1.d.ts000064400000017776151677225100010221 0ustar00import FlexApiBase from "../FlexApiBase"; import Version from "../../base/Version"; import { AssessmentsListInstance } from "./v1/assessments"; import { ChannelListInstance } from "./v1/channel"; import { ConfigurationListInstance } from "./v1/configuration"; import { FlexFlowListInstance } from "./v1/flexFlow"; import { InsightsAssessmentsCommentListInstance } from "./v1/insightsAssessmentsComment"; import { InsightsConversationsListInstance } from "./v1/insightsConversations"; import { InsightsQuestionnairesListInstance } from "./v1/insightsQuestionnaires"; import { InsightsQuestionnairesCategoryListInstance } from "./v1/insightsQuestionnairesCategory"; import { InsightsQuestionnairesQuestionListInstance } from "./v1/insightsQuestionnairesQuestion"; import { InsightsSegmentsListInstance } from "./v1/insightsSegments"; import { InsightsSessionListInstance } from "./v1/insightsSession"; import { InsightsSettingsAnswerSetsListInstance } from "./v1/insightsSettingsAnswerSets"; import { InsightsSettingsCommentListInstance } from "./v1/insightsSettingsComment"; import { InsightsUserRolesListInstance } from "./v1/insightsUserRoles"; import { InteractionListInstance } from "./v1/interaction"; import { PluginListInstance } from "./v1/plugin"; import { PluginArchiveListInstance } from "./v1/pluginArchive"; import { PluginConfigurationListInstance } from "./v1/pluginConfiguration"; import { PluginConfigurationArchiveListInstance } from "./v1/pluginConfigurationArchive"; import { PluginReleaseListInstance } from "./v1/pluginRelease"; import { PluginVersionArchiveListInstance } from "./v1/pluginVersionArchive"; import { ProvisioningStatusListInstance } from "./v1/provisioningStatus"; import { WebChannelListInstance } from "./v1/webChannel"; export default class V1 extends Version { /** * Initialize the V1 version of FlexApi * * @param domain - The Twilio (Twilio.FlexApi) domain */ constructor(domain: FlexApiBase); /** assessments - { Twilio.FlexApi.V1.AssessmentsListInstance } resource */ protected _assessments?: AssessmentsListInstance; /** channel - { Twilio.FlexApi.V1.ChannelListInstance } resource */ protected _channel?: ChannelListInstance; /** configuration - { Twilio.FlexApi.V1.ConfigurationListInstance } resource */ protected _configuration?: ConfigurationListInstance; /** flexFlow - { Twilio.FlexApi.V1.FlexFlowListInstance } resource */ protected _flexFlow?: FlexFlowListInstance; /** insightsAssessmentsComment - { Twilio.FlexApi.V1.InsightsAssessmentsCommentListInstance } resource */ protected _insightsAssessmentsComment?: InsightsAssessmentsCommentListInstance; /** insightsConversations - { Twilio.FlexApi.V1.InsightsConversationsListInstance } resource */ protected _insightsConversations?: InsightsConversationsListInstance; /** insightsQuestionnaires - { Twilio.FlexApi.V1.InsightsQuestionnairesListInstance } resource */ protected _insightsQuestionnaires?: InsightsQuestionnairesListInstance; /** insightsQuestionnairesCategory - { Twilio.FlexApi.V1.InsightsQuestionnairesCategoryListInstance } resource */ protected _insightsQuestionnairesCategory?: InsightsQuestionnairesCategoryListInstance; /** insightsQuestionnairesQuestion - { Twilio.FlexApi.V1.InsightsQuestionnairesQuestionListInstance } resource */ protected _insightsQuestionnairesQuestion?: InsightsQuestionnairesQuestionListInstance; /** insightsSegments - { Twilio.FlexApi.V1.InsightsSegmentsListInstance } resource */ protected _insightsSegments?: InsightsSegmentsListInstance; /** insightsSession - { Twilio.FlexApi.V1.InsightsSessionListInstance } resource */ protected _insightsSession?: InsightsSessionListInstance; /** insightsSettingsAnswerSets - { Twilio.FlexApi.V1.InsightsSettingsAnswerSetsListInstance } resource */ protected _insightsSettingsAnswerSets?: InsightsSettingsAnswerSetsListInstance; /** insightsSettingsComment - { Twilio.FlexApi.V1.InsightsSettingsCommentListInstance } resource */ protected _insightsSettingsComment?: InsightsSettingsCommentListInstance; /** insightsUserRoles - { Twilio.FlexApi.V1.InsightsUserRolesListInstance } resource */ protected _insightsUserRoles?: InsightsUserRolesListInstance; /** interaction - { Twilio.FlexApi.V1.InteractionListInstance } resource */ protected _interaction?: InteractionListInstance; /** plugins - { Twilio.FlexApi.V1.PluginListInstance } resource */ protected _plugins?: PluginListInstance; /** pluginArchive - { Twilio.FlexApi.V1.PluginArchiveListInstance } resource */ protected _pluginArchive?: PluginArchiveListInstance; /** pluginConfigurations - { Twilio.FlexApi.V1.PluginConfigurationListInstance } resource */ protected _pluginConfigurations?: PluginConfigurationListInstance; /** pluginConfigurationArchive - { Twilio.FlexApi.V1.PluginConfigurationArchiveListInstance } resource */ protected _pluginConfigurationArchive?: PluginConfigurationArchiveListInstance; /** pluginReleases - { Twilio.FlexApi.V1.PluginReleaseListInstance } resource */ protected _pluginReleases?: PluginReleaseListInstance; /** pluginVersionArchive - { Twilio.FlexApi.V1.PluginVersionArchiveListInstance } resource */ protected _pluginVersionArchive?: PluginVersionArchiveListInstance; /** provisioningStatus - { Twilio.FlexApi.V1.ProvisioningStatusListInstance } resource */ protected _provisioningStatus?: ProvisioningStatusListInstance; /** webChannel - { Twilio.FlexApi.V1.WebChannelListInstance } resource */ protected _webChannel?: WebChannelListInstance; /** Getter for assessments resource */ get assessments(): AssessmentsListInstance; /** Getter for channel resource */ get channel(): ChannelListInstance; /** Getter for configuration resource */ get configuration(): ConfigurationListInstance; /** Getter for flexFlow resource */ get flexFlow(): FlexFlowListInstance; /** Getter for insightsAssessmentsComment resource */ get insightsAssessmentsComment(): InsightsAssessmentsCommentListInstance; /** Getter for insightsConversations resource */ get insightsConversations(): InsightsConversationsListInstance; /** Getter for insightsQuestionnaires resource */ get insightsQuestionnaires(): InsightsQuestionnairesListInstance; /** Getter for insightsQuestionnairesCategory resource */ get insightsQuestionnairesCategory(): InsightsQuestionnairesCategoryListInstance; /** Getter for insightsQuestionnairesQuestion resource */ get insightsQuestionnairesQuestion(): InsightsQuestionnairesQuestionListInstance; /** Getter for insightsSegments resource */ get insightsSegments(): InsightsSegmentsListInstance; /** Getter for insightsSession resource */ get insightsSession(): InsightsSessionListInstance; /** Getter for insightsSettingsAnswerSets resource */ get insightsSettingsAnswerSets(): InsightsSettingsAnswerSetsListInstance; /** Getter for insightsSettingsComment resource */ get insightsSettingsComment(): InsightsSettingsCommentListInstance; /** Getter for insightsUserRoles resource */ get insightsUserRoles(): InsightsUserRolesListInstance; /** Getter for interaction resource */ get interaction(): InteractionListInstance; /** Getter for plugins resource */ get plugins(): PluginListInstance; /** Getter for pluginArchive resource */ get pluginArchive(): PluginArchiveListInstance; /** Getter for pluginConfigurations resource */ get pluginConfigurations(): PluginConfigurationListInstance; /** Getter for pluginConfigurationArchive resource */ get pluginConfigurationArchive(): PluginConfigurationArchiveListInstance; /** Getter for pluginReleases resource */ get pluginReleases(): PluginReleaseListInstance; /** Getter for pluginVersionArchive resource */ get pluginVersionArchive(): PluginVersionArchiveListInstance; /** Getter for provisioningStatus resource */ get provisioningStatus(): ProvisioningStatusListInstance; /** Getter for webChannel resource */ get webChannel(): WebChannelListInstance; } rest/flexApi/V2.js000064400000002743151677225100007752 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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 flexUser_1 = require("./v2/flexUser"); const webChannels_1 = require("./v2/webChannels"); class V2 extends Version_1.default { /** * Initialize the V2 version of FlexApi * * @param domain - The Twilio (Twilio.FlexApi) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for flexUser resource */ get flexUser() { this._flexUser = this._flexUser || (0, flexUser_1.FlexUserListInstance)(this); return this._flexUser; } /** Getter for webChannels resource */ get webChannels() { this._webChannels = this._webChannels || (0, webChannels_1.WebChannelsListInstance)(this); return this._webChannels; } } exports.default = V2; rest/flexApi/v2/webChannels.d.ts000064400000005466151677225100012504 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; /** * Options to pass to create a WebChannelsInstance */ export interface WebChannelsListInstanceCreateOptions { /** The SID of the Conversations Address. See [Address Configuration Resource](https://www.twilio.com/docs/conversations/api/address-configuration-resource) for configuration details. When a conversation is created on the Flex backend, the callback URL will be set to the corresponding Studio Flow SID or webhook URL in your address configuration. */ addressSid: string; /** The Ui-Version HTTP request header */ uiVersion?: string; /** The Conversation\\\'s friendly name. See the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) for an example. */ chatFriendlyName?: string; /** The Conversation participant\\\'s friendly name. See the [Conversation Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) for an example. */ customerFriendlyName?: string; /** The pre-engagement data. */ preEngagementData?: string; } export interface WebChannelsSolution { } export interface WebChannelsListInstance { _version: V2; _solution: WebChannelsSolution; _uri: string; /** * Create a WebChannelsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebChannelsInstance */ create(params: WebChannelsListInstanceCreateOptions, callback?: (error: Error | null, item?: WebChannelsInstance) => any): Promise<WebChannelsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WebChannelsListInstance(version: V2): WebChannelsListInstance; interface WebChannelsResource { conversation_sid: string; identity: string; } export declare class WebChannelsInstance { protected _version: V2; constructor(_version: V2, payload: WebChannelsResource); /** * The unique string representing the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) created. */ conversationSid: string; /** * The unique string representing the User created and should be authorized to participate in the Conversation. For more details, see [User Identity & Access Tokens](https://www.twilio.com/docs/conversations/identity). */ identity: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { conversationSid: string; identity: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v2/flexUser.d.ts000064400000011064151677225100012037 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; export interface FlexUserContext { /** * Fetch a FlexUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexUserInstance */ fetch(callback?: (error: Error | null, item?: FlexUserInstance) => any): Promise<FlexUserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FlexUserContextSolution { instanceSid: string; flexUserSid: string; } export declare class FlexUserContextImpl implements FlexUserContext { protected _version: V2; protected _solution: FlexUserContextSolution; protected _uri: string; constructor(_version: V2, instanceSid: string, flexUserSid: string); fetch(callback?: (error: Error | null, item?: FlexUserInstance) => any): Promise<FlexUserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FlexUserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FlexUserResource { account_sid: string; instance_sid: string; user_sid: string; flex_user_sid: string; worker_sid: string; workspace_sid: string; flex_team_sid: string; first_name: string; last_name: string; username: string; email: string; friendly_name: string; created_date: Date; updated_date: Date; version: number; url: string; } export declare class FlexUserInstance { protected _version: V2; protected _solution: FlexUserContextSolution; protected _context?: FlexUserContext; constructor(_version: V2, payload: FlexUserResource, instanceSid?: string, flexUserSid?: string); /** * The unique SID of the account that created the resource. */ accountSid: string; /** * The unique ID created by Twilio to identify a Flex instance. */ instanceSid: string; /** * The unique SID identifier of the Twilio Unified User. */ userSid: string; /** * The unique SID identifier of the Flex User. */ flexUserSid: string; /** * The unique SID identifier of the worker. */ workerSid: string; /** * The unique SID identifier of the workspace. */ workspaceSid: string; /** * The unique SID identifier of the Flex Team. */ flexTeamSid: string; /** * First name of the User. */ firstName: string; /** * Last name of the User. */ lastName: string; /** * Username of the User. */ username: string; /** * Email of the User. */ email: string; /** * Friendly name of the User. */ friendlyName: string; /** * The date that this user was created, given in ISO 8601 format. */ createdDate: Date; /** * The date that this user was updated, given in ISO 8601 format. */ updatedDate: Date; /** * The current version of the user. */ version: number; url: string; private get _proxy(); /** * Fetch a FlexUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexUserInstance */ fetch(callback?: (error: Error | null, item?: FlexUserInstance) => any): Promise<FlexUserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; instanceSid: string; userSid: string; flexUserSid: string; workerSid: string; workspaceSid: string; flexTeamSid: string; firstName: string; lastName: string; username: string; email: string; friendlyName: string; createdDate: Date; updatedDate: Date; version: number; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FlexUserSolution { } export interface FlexUserListInstance { _version: V2; _solution: FlexUserSolution; _uri: string; (instanceSid: string, flexUserSid: string): FlexUserContext; get(instanceSid: string, flexUserSid: string): FlexUserContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FlexUserListInstance(version: V2): FlexUserListInstance; export {}; rest/flexApi/v2/flexUser.js000064400000012376151677225100011612 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.FlexUserListInstance = exports.FlexUserInstance = exports.FlexUserContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class FlexUserContextImpl { constructor(_version, instanceSid, flexUserSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(instanceSid)) { throw new Error("Parameter 'instanceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(flexUserSid)) { throw new Error("Parameter 'flexUserSid' is not valid."); } this._solution = { instanceSid, flexUserSid }; this._uri = `/Instances/${instanceSid}/Users/${flexUserSid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FlexUserInstance(operationVersion, payload, instance._solution.instanceSid, instance._solution.flexUserSid)); 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.FlexUserContextImpl = FlexUserContextImpl; class FlexUserInstance { constructor(_version, payload, instanceSid, flexUserSid) { this._version = _version; this.accountSid = payload.account_sid; this.instanceSid = payload.instance_sid; this.userSid = payload.user_sid; this.flexUserSid = payload.flex_user_sid; this.workerSid = payload.worker_sid; this.workspaceSid = payload.workspace_sid; this.flexTeamSid = payload.flex_team_sid; this.firstName = payload.first_name; this.lastName = payload.last_name; this.username = payload.username; this.email = payload.email; this.friendlyName = payload.friendly_name; this.createdDate = deserialize.iso8601DateTime(payload.created_date); this.updatedDate = deserialize.iso8601DateTime(payload.updated_date); this.version = deserialize.integer(payload.version); this.url = payload.url; this._solution = { instanceSid: instanceSid || this.instanceSid, flexUserSid: flexUserSid || this.flexUserSid, }; } get _proxy() { this._context = this._context || new FlexUserContextImpl(this._version, this._solution.instanceSid, this._solution.flexUserSid); return this._context; } /** * Fetch a FlexUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexUserInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, instanceSid: this.instanceSid, userSid: this.userSid, flexUserSid: this.flexUserSid, workerSid: this.workerSid, workspaceSid: this.workspaceSid, flexTeamSid: this.flexTeamSid, firstName: this.firstName, lastName: this.lastName, username: this.username, email: this.email, friendlyName: this.friendlyName, createdDate: this.createdDate, updatedDate: this.updatedDate, version: this.version, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlexUserInstance = FlexUserInstance; function FlexUserListInstance(version) { const instance = ((instanceSid, flexUserSid) => instance.get(instanceSid, flexUserSid)); instance.get = function get(instanceSid, flexUserSid) { return new FlexUserContextImpl(version, instanceSid, flexUserSid); }; 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; } exports.FlexUserListInstance = FlexUserListInstance; rest/flexApi/v2/webChannels.js000064400000006403151677225100012240 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.WebChannelsInstance = exports.WebChannelsListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function WebChannelsListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/WebChats`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["addressSid"] === null || params["addressSid"] === undefined) { throw new Error("Required parameter \"params['addressSid']\" missing."); } let data = {}; data["AddressSid"] = params["addressSid"]; if (params["chatFriendlyName"] !== undefined) data["ChatFriendlyName"] = params["chatFriendlyName"]; if (params["customerFriendlyName"] !== undefined) data["CustomerFriendlyName"] = params["customerFriendlyName"]; if (params["preEngagementData"] !== undefined) data["PreEngagementData"] = params["preEngagementData"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["uiVersion"] !== undefined) headers["Ui-Version"] = params["uiVersion"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebChannelsInstance(operationVersion, payload)); 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; } exports.WebChannelsListInstance = WebChannelsListInstance; class WebChannelsInstance { constructor(_version, payload) { this._version = _version; this.conversationSid = payload.conversation_sid; this.identity = payload.identity; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { conversationSid: this.conversationSid, identity: this.identity, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebChannelsInstance = WebChannelsInstance; rest/flexApi/v1/webChannel.d.ts000064400000026537151677225100012322 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type WebChannelChatStatus = "inactive"; /** * Options to pass to update a WebChannelInstance */ export interface WebChannelContextUpdateOptions { /** */ chatStatus?: WebChannelChatStatus; /** The post-engagement data. */ postEngagementData?: string; } /** * Options to pass to create a WebChannelInstance */ export interface WebChannelListInstanceCreateOptions { /** The SID of the Flex Flow. */ flexFlowSid: string; /** The chat identity. */ identity: string; /** The chat participant\\\'s friendly name. */ customerFriendlyName: string; /** The chat channel\\\'s friendly name. */ chatFriendlyName: string; /** The chat channel\\\'s unique name. */ chatUniqueName?: string; /** The pre-engagement data. */ preEngagementData?: string; } /** * Options to pass to each */ export interface WebChannelListInstanceEachOptions { /** 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: WebChannelInstance, 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 WebChannelListInstanceOptions { /** 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 WebChannelListInstancePageOptions { /** 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 WebChannelContext { /** * Remove a WebChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebChannelInstance */ fetch(callback?: (error: Error | null, item?: WebChannelInstance) => any): Promise<WebChannelInstance>; /** * Update a WebChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebChannelInstance */ update(callback?: (error: Error | null, item?: WebChannelInstance) => any): Promise<WebChannelInstance>; /** * Update a WebChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebChannelInstance */ update(params: WebChannelContextUpdateOptions, callback?: (error: Error | null, item?: WebChannelInstance) => any): Promise<WebChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WebChannelContextSolution { sid: string; } export declare class WebChannelContextImpl implements WebChannelContext { protected _version: V1; protected _solution: WebChannelContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: WebChannelInstance) => any): Promise<WebChannelInstance>; update(params?: WebChannelContextUpdateOptions | ((error: Error | null, item?: WebChannelInstance) => any), callback?: (error: Error | null, item?: WebChannelInstance) => any): Promise<WebChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WebChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WebChannelPayload extends TwilioResponsePayload { flex_chat_channels: WebChannelResource[]; } interface WebChannelResource { account_sid: string; flex_flow_sid: string; sid: string; url: string; date_created: Date; date_updated: Date; } export declare class WebChannelInstance { protected _version: V1; protected _solution: WebChannelContextSolution; protected _context?: WebChannelContext; constructor(_version: V1, payload: WebChannelResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WebChannel resource and owns this Workflow. */ accountSid: string; /** * The SID of the Flex Flow. */ flexFlowSid: string; /** * The unique string that we created to identify the WebChannel resource. */ sid: string; /** * The absolute URL of the WebChannel resource. */ url: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; private get _proxy(); /** * Remove a WebChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebChannelInstance */ fetch(callback?: (error: Error | null, item?: WebChannelInstance) => any): Promise<WebChannelInstance>; /** * Update a WebChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebChannelInstance */ update(callback?: (error: Error | null, item?: WebChannelInstance) => any): Promise<WebChannelInstance>; /** * Update a WebChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebChannelInstance */ update(params: WebChannelContextUpdateOptions, callback?: (error: Error | null, item?: WebChannelInstance) => any): Promise<WebChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; flexFlowSid: string; sid: string; url: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WebChannelSolution { } export interface WebChannelListInstance { _version: V1; _solution: WebChannelSolution; _uri: string; (sid: string): WebChannelContext; get(sid: string): WebChannelContext; /** * Create a WebChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebChannelInstance */ create(params: WebChannelListInstanceCreateOptions, callback?: (error: Error | null, item?: WebChannelInstance) => any): Promise<WebChannelInstance>; /** * Streams WebChannelInstance 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 { WebChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WebChannelInstance, done: (err?: Error) => void) => void): void; each(params: WebChannelListInstanceEachOptions, callback?: (item: WebChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WebChannelInstance 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: WebChannelPage) => any): Promise<WebChannelPage>; /** * Lists WebChannelInstance 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 { WebChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WebChannelInstance[]) => any): Promise<WebChannelInstance[]>; list(params: WebChannelListInstanceOptions, callback?: (error: Error | null, items: WebChannelInstance[]) => any): Promise<WebChannelInstance[]>; /** * Retrieve a single page of WebChannelInstance 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 { WebChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WebChannelPage) => any): Promise<WebChannelPage>; page(params: WebChannelListInstancePageOptions, callback?: (error: Error | null, items: WebChannelPage) => any): Promise<WebChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WebChannelListInstance(version: V1): WebChannelListInstance; export declare class WebChannelPage extends Page<V1, WebChannelPayload, WebChannelResource, WebChannelInstance> { /** * Initialize the WebChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: WebChannelSolution); /** * Build an instance of WebChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: WebChannelResource): WebChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/interaction.d.ts000064400000012114151677225100012555 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; import { InteractionChannelListInstance } from "./interaction/interactionChannel"; /** * Options to pass to create a InteractionInstance */ export interface InteractionListInstanceCreateOptions { /** The Interaction\\\'s channel. */ channel: any; /** The Interaction\\\'s routing logic. */ routing?: any; /** The Interaction context sid is used for adding a context lookup sid */ interactionContextSid?: string; } export interface InteractionContext { channels: InteractionChannelListInstance; /** * Fetch a InteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionInstance */ fetch(callback?: (error: Error | null, item?: InteractionInstance) => any): Promise<InteractionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InteractionContextSolution { sid: string; } export declare class InteractionContextImpl implements InteractionContext { protected _version: V1; protected _solution: InteractionContextSolution; protected _uri: string; protected _channels?: InteractionChannelListInstance; constructor(_version: V1, sid: string); get channels(): InteractionChannelListInstance; fetch(callback?: (error: Error | null, item?: InteractionInstance) => any): Promise<InteractionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InteractionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InteractionResource { sid: string; channel: any; routing: any; url: string; links: Record<string, string>; interaction_context_sid: string; } export declare class InteractionInstance { protected _version: V1; protected _solution: InteractionContextSolution; protected _context?: InteractionContext; constructor(_version: V1, payload: InteractionResource, sid?: string); /** * The unique string created by Twilio to identify an Interaction resource, prefixed with KD. */ sid: string; /** * A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the [Outbound SMS](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) and [inbound (API-initiated)](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#api-initiated-contact) Channel object examples. */ channel: any; /** * A JSON Object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). */ routing: any; url: string; links: Record<string, string>; interactionContextSid: string; private get _proxy(); /** * Fetch a InteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionInstance */ fetch(callback?: (error: Error | null, item?: InteractionInstance) => any): Promise<InteractionInstance>; /** * Access the channels. */ channels(): InteractionChannelListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; channel: any; routing: any; url: string; links: Record<string, string>; interactionContextSid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InteractionSolution { } export interface InteractionListInstance { _version: V1; _solution: InteractionSolution; _uri: string; (sid: string): InteractionContext; get(sid: string): InteractionContext; /** * Create a InteractionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionInstance */ create(params: InteractionListInstanceCreateOptions, callback?: (error: Error | null, item?: InteractionInstance) => any): Promise<InteractionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InteractionListInstance(version: V1): InteractionListInstance; export {}; rest/flexApi/v1/insightsSession.js000064400000007461151677225100013207 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsSessionListInstance = exports.InsightsSessionInstance = exports.InsightsSessionContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class InsightsSessionContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/Insights/Session`; } create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsSessionInstance(operationVersion, payload)); 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.InsightsSessionContextImpl = InsightsSessionContextImpl; class InsightsSessionInstance { constructor(_version, payload) { this._version = _version; this.workspaceId = payload.workspace_id; this.sessionExpiry = payload.session_expiry; this.sessionId = payload.session_id; this.baseUrl = payload.base_url; this.url = payload.url; this._solution = {}; } get _proxy() { this._context = this._context || new InsightsSessionContextImpl(this._version); return this._context; } create(params, callback) { return this._proxy.create(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { workspaceId: this.workspaceId, sessionExpiry: this.sessionExpiry, sessionId: this.sessionId, baseUrl: this.baseUrl, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsSessionInstance = InsightsSessionInstance; function InsightsSessionListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new InsightsSessionContextImpl(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; } exports.InsightsSessionListInstance = InsightsSessionListInstance; rest/flexApi/v1/interaction.js000064400000012752151677225100012331 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InteractionListInstance = exports.InteractionInstance = exports.InteractionContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const interactionChannel_1 = require("./interaction/interactionChannel"); class InteractionContextImpl { 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 = `/Interactions/${sid}`; } get channels() { this._channels = this._channels || (0, interactionChannel_1.InteractionChannelListInstance)(this._version, this._solution.sid); return this._channels; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InteractionInstance(operationVersion, payload, 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.InteractionContextImpl = InteractionContextImpl; class InteractionInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.channel = payload.channel; this.routing = payload.routing; this.url = payload.url; this.links = payload.links; this.interactionContextSid = payload.interaction_context_sid; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InteractionContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a InteractionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the channels. */ channels() { return this._proxy.channels; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, channel: this.channel, routing: this.routing, url: this.url, links: this.links, interactionContextSid: this.interactionContextSid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InteractionInstance = InteractionInstance; function InteractionListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InteractionContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Interactions`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["channel"] === null || params["channel"] === undefined) { throw new Error("Required parameter \"params['channel']\" missing."); } let data = {}; data["Channel"] = serialize.object(params["channel"]); if (params["routing"] !== undefined) data["Routing"] = serialize.object(params["routing"]); if (params["interactionContextSid"] !== undefined) data["InteractionContextSid"] = params["interactionContextSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InteractionInstance(operationVersion, payload)); 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; } exports.InteractionListInstance = InteractionListInstance; rest/flexApi/v1/pluginArchive.js000064400000010714151677225100012606 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.PluginArchiveListInstance = exports.PluginArchiveInstance = exports.PluginArchiveContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PluginArchiveContextImpl { 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 = `/PluginService/Plugins/${sid}/Archive`; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PluginArchiveInstance(operationVersion, payload, 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.PluginArchiveContextImpl = PluginArchiveContextImpl; class PluginArchiveInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.uniqueName = payload.unique_name; this.friendlyName = payload.friendly_name; this.description = payload.description; this.archived = payload.archived; 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 PluginArchiveContextImpl(this._version, this._solution.sid); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, uniqueName: this.uniqueName, friendlyName: this.friendlyName, description: this.description, archived: this.archived, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginArchiveInstance = PluginArchiveInstance; function PluginArchiveListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PluginArchiveContextImpl(version, sid); }; 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; } exports.PluginArchiveListInstance = PluginArchiveListInstance; rest/flexApi/v1/pluginVersionArchive.js000064400000011652151677225100014156 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.PluginVersionArchiveListInstance = exports.PluginVersionArchiveInstance = exports.PluginVersionArchiveContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PluginVersionArchiveContextImpl { constructor(_version, pluginSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(pluginSid)) { throw new Error("Parameter 'pluginSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { pluginSid, sid }; this._uri = `/PluginService/Plugins/${pluginSid}/Versions/${sid}/Archive`; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PluginVersionArchiveInstance(operationVersion, payload, instance._solution.pluginSid, 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.PluginVersionArchiveContextImpl = PluginVersionArchiveContextImpl; class PluginVersionArchiveInstance { constructor(_version, payload, pluginSid, sid) { this._version = _version; this.sid = payload.sid; this.pluginSid = payload.plugin_sid; this.accountSid = payload.account_sid; this.version = payload.version; this.pluginUrl = payload.plugin_url; this.changelog = payload.changelog; this._private = payload.private; this.archived = payload.archived; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { pluginSid: pluginSid || this.pluginSid, sid: sid || this.sid, }; } get _proxy() { this._context = this._context || new PluginVersionArchiveContextImpl(this._version, this._solution.pluginSid, this._solution.sid); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, pluginSid: this.pluginSid, accountSid: this.accountSid, version: this.version, pluginUrl: this.pluginUrl, changelog: this.changelog, _private: this._private, archived: this.archived, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginVersionArchiveInstance = PluginVersionArchiveInstance; function PluginVersionArchiveListInstance(version) { const instance = ((pluginSid, sid) => instance.get(pluginSid, sid)); instance.get = function get(pluginSid, sid) { return new PluginVersionArchiveContextImpl(version, pluginSid, sid); }; 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; } exports.PluginVersionArchiveListInstance = PluginVersionArchiveListInstance; rest/flexApi/v1/pluginRelease.js000064400000017467151677225100012621 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.PluginReleasePage = exports.PluginReleaseListInstance = exports.PluginReleaseInstance = exports.PluginReleaseContextImpl = void 0; 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 PluginReleaseContextImpl { 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 = `/PluginService/Releases/${sid}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PluginReleaseInstance(operationVersion, payload, 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.PluginReleaseContextImpl = PluginReleaseContextImpl; class PluginReleaseInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.configurationSid = payload.configuration_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PluginReleaseContextImpl(this._version, this._solution.sid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, configurationSid: this.configurationSid, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginReleaseInstance = PluginReleaseInstance; function PluginReleaseListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PluginReleaseContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/PluginService/Releases`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["configurationId"] === null || params["configurationId"] === undefined) { throw new Error("Required parameter \"params['configurationId']\" missing."); } let data = {}; data["ConfigurationId"] = params["configurationId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PluginReleaseInstance(operationVersion, payload)); 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 = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PluginReleasePage(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 PluginReleasePage(instance._version, payload, 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; } exports.PluginReleaseListInstance = PluginReleaseListInstance; class PluginReleasePage extends Page_1.default { /** * Initialize the PluginReleasePage * * @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 PluginReleaseInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PluginReleaseInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginReleasePage = PluginReleasePage; rest/flexApi/v1/insightsUserRoles.d.ts000064400000007446151677225100013746 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to fetch a InsightsUserRolesInstance */ export interface InsightsUserRolesContextFetchOptions { /** The Authorization HTTP request header */ authorization?: string; } export interface InsightsUserRolesContext { /** * Fetch a InsightsUserRolesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsUserRolesInstance */ fetch(callback?: (error: Error | null, item?: InsightsUserRolesInstance) => any): Promise<InsightsUserRolesInstance>; /** * Fetch a InsightsUserRolesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsUserRolesInstance */ fetch(params: InsightsUserRolesContextFetchOptions, callback?: (error: Error | null, item?: InsightsUserRolesInstance) => any): Promise<InsightsUserRolesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InsightsUserRolesContextSolution { } export declare class InsightsUserRolesContextImpl implements InsightsUserRolesContext { protected _version: V1; protected _solution: InsightsUserRolesContextSolution; protected _uri: string; constructor(_version: V1); fetch(params?: InsightsUserRolesContextFetchOptions | ((error: Error | null, item?: InsightsUserRolesInstance) => any), callback?: (error: Error | null, item?: InsightsUserRolesInstance) => any): Promise<InsightsUserRolesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InsightsUserRolesContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InsightsUserRolesResource { roles: Array<string>; url: string; } export declare class InsightsUserRolesInstance { protected _version: V1; protected _solution: InsightsUserRolesContextSolution; protected _context?: InsightsUserRolesContext; constructor(_version: V1, payload: InsightsUserRolesResource); /** * Flex Insights roles for the user */ roles: Array<string>; url: string; private get _proxy(); /** * Fetch a InsightsUserRolesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsUserRolesInstance */ fetch(callback?: (error: Error | null, item?: InsightsUserRolesInstance) => any): Promise<InsightsUserRolesInstance>; /** * Fetch a InsightsUserRolesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsUserRolesInstance */ fetch(params: InsightsUserRolesContextFetchOptions, callback?: (error: Error | null, item?: InsightsUserRolesInstance) => any): Promise<InsightsUserRolesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { roles: string[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InsightsUserRolesSolution { } export interface InsightsUserRolesListInstance { _version: V1; _solution: InsightsUserRolesSolution; _uri: string; (): InsightsUserRolesContext; get(): InsightsUserRolesContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsUserRolesListInstance(version: V1): InsightsUserRolesListInstance; export {}; rest/flexApi/v1/insightsSettingsAnswerSets.js000064400000006114151677225100015375 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsSettingsAnswerSetsInstance = exports.InsightsSettingsAnswerSetsListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function InsightsSettingsAnswerSetsListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Insights/QualityManagement/Settings/AnswerSets`; instance.fetch = function fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsSettingsAnswerSetsInstance(operationVersion, payload)); 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; } exports.InsightsSettingsAnswerSetsListInstance = InsightsSettingsAnswerSetsListInstance; class InsightsSettingsAnswerSetsInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.answerSets = payload.answer_sets; this.answerSetCategories = payload.answer_set_categories; this.notApplicable = payload.not_applicable; this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, answerSets: this.answerSets, answerSetCategories: this.answerSetCategories, notApplicable: this.notApplicable, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsSettingsAnswerSetsInstance = InsightsSettingsAnswerSetsInstance; rest/flexApi/v1/insightsQuestionnairesQuestion.d.ts000064400000033225151677225100016556 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to remove a InsightsQuestionnairesQuestionInstance */ export interface InsightsQuestionnairesQuestionContextRemoveOptions { /** The Authorization HTTP request header */ authorization?: string; } /** * Options to pass to update a InsightsQuestionnairesQuestionInstance */ export interface InsightsQuestionnairesQuestionContextUpdateOptions { /** The flag to enable for disable NA for answer. */ allowNa: boolean; /** The Authorization HTTP request header */ authorization?: string; /** The SID of the category */ categorySid?: string; /** The question. */ question?: string; /** The description for the question. */ description?: string; /** The answer_set for the question. */ answerSetId?: string; } /** * Options to pass to create a InsightsQuestionnairesQuestionInstance */ export interface InsightsQuestionnairesQuestionListInstanceCreateOptions { /** The SID of the category */ categorySid: string; /** The question. */ question: string; /** The answer_set for the question. */ answerSetId: string; /** The flag to enable for disable NA for answer. */ allowNa: boolean; /** The Authorization HTTP request header */ authorization?: string; /** The description for the question. */ description?: string; } /** * Options to pass to each */ export interface InsightsQuestionnairesQuestionListInstanceEachOptions { /** The Authorization HTTP request header */ authorization?: string; /** The list of category SIDs */ categorySid?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InsightsQuestionnairesQuestionInstance, 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 InsightsQuestionnairesQuestionListInstanceOptions { /** The Authorization HTTP request header */ authorization?: string; /** The list of category SIDs */ categorySid?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InsightsQuestionnairesQuestionListInstancePageOptions { /** The Authorization HTTP request header */ authorization?: string; /** The list of category SIDs */ categorySid?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InsightsQuestionnairesQuestionContext { /** * Remove a InsightsQuestionnairesQuestionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a InsightsQuestionnairesQuestionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesQuestionInstance */ remove(params: InsightsQuestionnairesQuestionContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Update a InsightsQuestionnairesQuestionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesQuestionInstance */ update(params: InsightsQuestionnairesQuestionContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesQuestionInstance) => any): Promise<InsightsQuestionnairesQuestionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InsightsQuestionnairesQuestionContextSolution { questionSid: string; } export declare class InsightsQuestionnairesQuestionContextImpl implements InsightsQuestionnairesQuestionContext { protected _version: V1; protected _solution: InsightsQuestionnairesQuestionContextSolution; protected _uri: string; constructor(_version: V1, questionSid: string); remove(params?: InsightsQuestionnairesQuestionContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; update(params: InsightsQuestionnairesQuestionContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesQuestionInstance) => any): Promise<InsightsQuestionnairesQuestionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InsightsQuestionnairesQuestionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InsightsQuestionnairesQuestionPayload extends TwilioResponsePayload { questions: InsightsQuestionnairesQuestionResource[]; } interface InsightsQuestionnairesQuestionResource { account_sid: string; question_sid: string; question: string; description: string; category: any; answer_set_id: string; allow_na: boolean; usage: number; answer_set: any; url: string; } export declare class InsightsQuestionnairesQuestionInstance { protected _version: V1; protected _solution: InsightsQuestionnairesQuestionContextSolution; protected _context?: InsightsQuestionnairesQuestionContext; constructor(_version: V1, payload: InsightsQuestionnairesQuestionResource, questionSid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. */ accountSid: string; /** * The SID of the question */ questionSid: string; /** * The question. */ question: string; /** * The description for the question. */ description: string; /** * The Category for the question. */ category: any; /** * The answer_set for the question. */ answerSetId: string; /** * The flag to enable for disable NA for answer. */ allowNa: boolean; /** * Integer value that tells a particular question is used by how many questionnaires */ usage: number; /** * Set of answers for the question */ answerSet: any; url: string; private get _proxy(); /** * Remove a InsightsQuestionnairesQuestionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a InsightsQuestionnairesQuestionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesQuestionInstance */ remove(params: InsightsQuestionnairesQuestionContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Update a InsightsQuestionnairesQuestionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesQuestionInstance */ update(params: InsightsQuestionnairesQuestionContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesQuestionInstance) => any): Promise<InsightsQuestionnairesQuestionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; questionSid: string; question: string; description: string; category: any; answerSetId: string; allowNa: boolean; usage: number; answerSet: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InsightsQuestionnairesQuestionSolution { } export interface InsightsQuestionnairesQuestionListInstance { _version: V1; _solution: InsightsQuestionnairesQuestionSolution; _uri: string; (questionSid: string): InsightsQuestionnairesQuestionContext; get(questionSid: string): InsightsQuestionnairesQuestionContext; /** * Create a InsightsQuestionnairesQuestionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesQuestionInstance */ create(params: InsightsQuestionnairesQuestionListInstanceCreateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesQuestionInstance) => any): Promise<InsightsQuestionnairesQuestionInstance>; /** * Streams InsightsQuestionnairesQuestionInstance 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 { InsightsQuestionnairesQuestionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InsightsQuestionnairesQuestionInstance, done: (err?: Error) => void) => void): void; each(params: InsightsQuestionnairesQuestionListInstanceEachOptions, callback?: (item: InsightsQuestionnairesQuestionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InsightsQuestionnairesQuestionInstance 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: InsightsQuestionnairesQuestionPage) => any): Promise<InsightsQuestionnairesQuestionPage>; /** * Lists InsightsQuestionnairesQuestionInstance 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 { InsightsQuestionnairesQuestionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InsightsQuestionnairesQuestionInstance[]) => any): Promise<InsightsQuestionnairesQuestionInstance[]>; list(params: InsightsQuestionnairesQuestionListInstanceOptions, callback?: (error: Error | null, items: InsightsQuestionnairesQuestionInstance[]) => any): Promise<InsightsQuestionnairesQuestionInstance[]>; /** * Retrieve a single page of InsightsQuestionnairesQuestionInstance 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 { InsightsQuestionnairesQuestionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InsightsQuestionnairesQuestionPage) => any): Promise<InsightsQuestionnairesQuestionPage>; page(params: InsightsQuestionnairesQuestionListInstancePageOptions, callback?: (error: Error | null, items: InsightsQuestionnairesQuestionPage) => any): Promise<InsightsQuestionnairesQuestionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsQuestionnairesQuestionListInstance(version: V1): InsightsQuestionnairesQuestionListInstance; export declare class InsightsQuestionnairesQuestionPage extends Page<V1, InsightsQuestionnairesQuestionPayload, InsightsQuestionnairesQuestionResource, InsightsQuestionnairesQuestionInstance> { /** * Initialize the InsightsQuestionnairesQuestionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InsightsQuestionnairesQuestionSolution); /** * Build an instance of InsightsQuestionnairesQuestionInstance * * @param payload - Payload response from the API */ getInstance(payload: InsightsQuestionnairesQuestionResource): InsightsQuestionnairesQuestionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/webChannel.js000064400000024056151677225100012060 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.WebChannelPage = exports.WebChannelListInstance = exports.WebChannelInstance = exports.WebChannelContextImpl = void 0; 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 WebChannelContextImpl { 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 = `/WebChannels/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WebChannelInstance(operationVersion, payload, 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["chatStatus"] !== undefined) data["ChatStatus"] = params["chatStatus"]; if (params["postEngagementData"] !== undefined) data["PostEngagementData"] = params["postEngagementData"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebChannelInstance(operationVersion, payload, 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.WebChannelContextImpl = WebChannelContextImpl; class WebChannelInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.flexFlowSid = payload.flex_flow_sid; this.sid = payload.sid; this.url = payload.url; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WebChannelContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a WebChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a WebChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, flexFlowSid: this.flexFlowSid, sid: this.sid, url: this.url, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebChannelInstance = WebChannelInstance; function WebChannelListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WebChannelContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/WebChannels`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["flexFlowSid"] === null || params["flexFlowSid"] === undefined) { throw new Error("Required parameter \"params['flexFlowSid']\" missing."); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } if (params["customerFriendlyName"] === null || params["customerFriendlyName"] === undefined) { throw new Error("Required parameter \"params['customerFriendlyName']\" missing."); } if (params["chatFriendlyName"] === null || params["chatFriendlyName"] === undefined) { throw new Error("Required parameter \"params['chatFriendlyName']\" missing."); } let data = {}; data["FlexFlowSid"] = params["flexFlowSid"]; data["Identity"] = params["identity"]; data["CustomerFriendlyName"] = params["customerFriendlyName"]; data["ChatFriendlyName"] = params["chatFriendlyName"]; if (params["chatUniqueName"] !== undefined) data["ChatUniqueName"] = params["chatUniqueName"]; if (params["preEngagementData"] !== undefined) data["PreEngagementData"] = params["preEngagementData"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebChannelInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WebChannelPage(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 WebChannelPage(instance._version, payload, 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; } exports.WebChannelListInstance = WebChannelListInstance; class WebChannelPage extends Page_1.default { /** * Initialize the WebChannelPage * * @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 WebChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WebChannelInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebChannelPage = WebChannelPage; rest/flexApi/v1/pluginRelease.d.ts000064400000024066151677225100013046 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to fetch a PluginReleaseInstance */ export interface PluginReleaseContextFetchOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; } /** * Options to pass to create a PluginReleaseInstance */ export interface PluginReleaseListInstanceCreateOptions { /** The SID or the Version of the Flex Plugin Configuration to release. */ configurationId: string; /** The Flex-Metadata HTTP request header */ flexMetadata?: string; } /** * Options to pass to each */ export interface PluginReleaseListInstanceEachOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: PluginReleaseInstance, 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 PluginReleaseListInstanceOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface PluginReleaseListInstancePageOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface PluginReleaseContext { /** * Fetch a PluginReleaseInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginReleaseInstance */ fetch(callback?: (error: Error | null, item?: PluginReleaseInstance) => any): Promise<PluginReleaseInstance>; /** * Fetch a PluginReleaseInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginReleaseInstance */ fetch(params: PluginReleaseContextFetchOptions, callback?: (error: Error | null, item?: PluginReleaseInstance) => any): Promise<PluginReleaseInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PluginReleaseContextSolution { sid: string; } export declare class PluginReleaseContextImpl implements PluginReleaseContext { protected _version: V1; protected _solution: PluginReleaseContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(params?: PluginReleaseContextFetchOptions | ((error: Error | null, item?: PluginReleaseInstance) => any), callback?: (error: Error | null, item?: PluginReleaseInstance) => any): Promise<PluginReleaseInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PluginReleaseContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PluginReleasePayload extends TwilioResponsePayload { releases: PluginReleaseResource[]; } interface PluginReleaseResource { sid: string; account_sid: string; configuration_sid: string; date_created: Date; url: string; } export declare class PluginReleaseInstance { protected _version: V1; protected _solution: PluginReleaseContextSolution; protected _context?: PluginReleaseContext; constructor(_version: V1, payload: PluginReleaseResource, sid?: string); /** * The unique string that we created to identify the Plugin Release resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Plugin Release resource and owns this resource. */ accountSid: string; /** * The SID of the Plugin Configuration resource to release. */ configurationSid: string; /** * The date and time in GMT when the Flex Plugin Release was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Plugin Release resource. */ url: string; private get _proxy(); /** * Fetch a PluginReleaseInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginReleaseInstance */ fetch(callback?: (error: Error | null, item?: PluginReleaseInstance) => any): Promise<PluginReleaseInstance>; /** * Fetch a PluginReleaseInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginReleaseInstance */ fetch(params: PluginReleaseContextFetchOptions, callback?: (error: Error | null, item?: PluginReleaseInstance) => any): Promise<PluginReleaseInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; configurationSid: string; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PluginReleaseSolution { } export interface PluginReleaseListInstance { _version: V1; _solution: PluginReleaseSolution; _uri: string; (sid: string): PluginReleaseContext; get(sid: string): PluginReleaseContext; /** * Create a PluginReleaseInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginReleaseInstance */ create(params: PluginReleaseListInstanceCreateOptions, callback?: (error: Error | null, item?: PluginReleaseInstance) => any): Promise<PluginReleaseInstance>; /** * Streams PluginReleaseInstance 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 { PluginReleaseListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PluginReleaseInstance, done: (err?: Error) => void) => void): void; each(params: PluginReleaseListInstanceEachOptions, callback?: (item: PluginReleaseInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PluginReleaseInstance 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: PluginReleasePage) => any): Promise<PluginReleasePage>; /** * Lists PluginReleaseInstance 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 { PluginReleaseListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PluginReleaseInstance[]) => any): Promise<PluginReleaseInstance[]>; list(params: PluginReleaseListInstanceOptions, callback?: (error: Error | null, items: PluginReleaseInstance[]) => any): Promise<PluginReleaseInstance[]>; /** * Retrieve a single page of PluginReleaseInstance 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 { PluginReleaseListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PluginReleasePage) => any): Promise<PluginReleasePage>; page(params: PluginReleaseListInstancePageOptions, callback?: (error: Error | null, items: PluginReleasePage) => any): Promise<PluginReleasePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PluginReleaseListInstance(version: V1): PluginReleaseListInstance; export declare class PluginReleasePage extends Page<V1, PluginReleasePayload, PluginReleaseResource, PluginReleaseInstance> { /** * Initialize the PluginReleasePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: PluginReleaseSolution); /** * Build an instance of PluginReleaseInstance * * @param payload - Payload response from the API */ getInstance(payload: PluginReleaseResource): PluginReleaseInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/insightsSettingsAnswerSets.d.ts000064400000005225151677225100015633 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to fetch a InsightsSettingsAnswerSetsInstance */ export interface InsightsSettingsAnswerSetsListInstanceFetchOptions { /** The Authorization HTTP request header */ authorization?: string; } export interface InsightsSettingsAnswerSetsSolution { } export interface InsightsSettingsAnswerSetsListInstance { _version: V1; _solution: InsightsSettingsAnswerSetsSolution; _uri: string; /** * Fetch a InsightsSettingsAnswerSetsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsSettingsAnswerSetsInstance */ fetch(callback?: (error: Error | null, item?: InsightsSettingsAnswerSetsInstance) => any): Promise<InsightsSettingsAnswerSetsInstance>; /** * Fetch a InsightsSettingsAnswerSetsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsSettingsAnswerSetsInstance */ fetch(params: InsightsSettingsAnswerSetsListInstanceFetchOptions, callback?: (error: Error | null, item?: InsightsSettingsAnswerSetsInstance) => any): Promise<InsightsSettingsAnswerSetsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsSettingsAnswerSetsListInstance(version: V1): InsightsSettingsAnswerSetsListInstance; interface InsightsSettingsAnswerSetsResource { account_sid: string; answer_sets: any; answer_set_categories: any; not_applicable: any; url: string; } export declare class InsightsSettingsAnswerSetsInstance { protected _version: V1; constructor(_version: V1, payload: InsightsSettingsAnswerSetsResource); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. */ accountSid: string; /** * The lis of answer sets */ answerSets: any; /** * The list of answer set categories */ answerSetCategories: any; /** * The details for not applicable answer set */ notApplicable: any; url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; answerSets: any; answerSetCategories: any; notApplicable: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/plugin.d.ts000064400000031132151677225100011535 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { PluginVersionsListInstance } from "./plugin/pluginVersions"; /** * Options to pass to fetch a PluginInstance */ export interface PluginContextFetchOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; } /** * Options to pass to update a PluginInstance */ export interface PluginContextUpdateOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** The Flex Plugin\\\'s friendly name. */ friendlyName?: string; /** A descriptive string that you update to describe the plugin resource. It can be up to 500 characters long */ description?: string; } /** * Options to pass to create a PluginInstance */ export interface PluginListInstanceCreateOptions { /** The Flex Plugin\\\'s unique name. */ uniqueName: string; /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** The Flex Plugin\\\'s friendly name. */ friendlyName?: string; /** A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long */ description?: string; } /** * Options to pass to each */ export interface PluginListInstanceEachOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: PluginInstance, 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 PluginListInstanceOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface PluginListInstancePageOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface PluginContext { pluginVersions: PluginVersionsListInstance; /** * Fetch a PluginInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginInstance */ fetch(callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Fetch a PluginInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginInstance */ fetch(params: PluginContextFetchOptions, callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Update a PluginInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginInstance */ update(callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Update a PluginInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginInstance */ update(params: PluginContextUpdateOptions, callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PluginContextSolution { sid: string; } export declare class PluginContextImpl implements PluginContext { protected _version: V1; protected _solution: PluginContextSolution; protected _uri: string; protected _pluginVersions?: PluginVersionsListInstance; constructor(_version: V1, sid: string); get pluginVersions(): PluginVersionsListInstance; fetch(params?: PluginContextFetchOptions | ((error: Error | null, item?: PluginInstance) => any), callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; update(params?: PluginContextUpdateOptions | ((error: Error | null, item?: PluginInstance) => any), callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PluginContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PluginPayload extends TwilioResponsePayload { plugins: PluginResource[]; } interface PluginResource { sid: string; account_sid: string; unique_name: string; friendly_name: string; description: string; archived: boolean; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class PluginInstance { protected _version: V1; protected _solution: PluginContextSolution; protected _context?: PluginContext; constructor(_version: V1, payload: PluginResource, sid?: string); /** * The unique string that we created to identify the Flex Plugin resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin resource and owns this resource. */ accountSid: string; /** * The name that uniquely identifies this Flex Plugin resource. */ uniqueName: string; /** * The friendly name this Flex Plugin resource. */ friendlyName: string; /** * A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long */ description: string; /** * Whether the Flex Plugin is archived. The default value is false. */ archived: boolean; /** * The date and time in GMT-7 when the Flex Plugin was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT-7 when the Flex Plugin was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Flex Plugin resource. */ url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a PluginInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginInstance */ fetch(callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Fetch a PluginInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginInstance */ fetch(params: PluginContextFetchOptions, callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Update a PluginInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginInstance */ update(callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Update a PluginInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginInstance */ update(params: PluginContextUpdateOptions, callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Access the pluginVersions. */ pluginVersions(): PluginVersionsListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; uniqueName: string; friendlyName: string; description: string; archived: boolean; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PluginSolution { } export interface PluginListInstance { _version: V1; _solution: PluginSolution; _uri: string; (sid: string): PluginContext; get(sid: string): PluginContext; /** * Create a PluginInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginInstance */ create(params: PluginListInstanceCreateOptions, callback?: (error: Error | null, item?: PluginInstance) => any): Promise<PluginInstance>; /** * Streams PluginInstance 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 { PluginListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PluginInstance, done: (err?: Error) => void) => void): void; each(params: PluginListInstanceEachOptions, callback?: (item: PluginInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PluginInstance 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: PluginPage) => any): Promise<PluginPage>; /** * Lists PluginInstance 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 { PluginListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PluginInstance[]) => any): Promise<PluginInstance[]>; list(params: PluginListInstanceOptions, callback?: (error: Error | null, items: PluginInstance[]) => any): Promise<PluginInstance[]>; /** * Retrieve a single page of PluginInstance 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 { PluginListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PluginPage) => any): Promise<PluginPage>; page(params: PluginListInstancePageOptions, callback?: (error: Error | null, items: PluginPage) => any): Promise<PluginPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PluginListInstance(version: V1): PluginListInstance; export declare class PluginPage extends Page<V1, PluginPayload, PluginResource, PluginInstance> { /** * Initialize the PluginPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: PluginSolution); /** * Build an instance of PluginInstance * * @param payload - Payload response from the API */ getInstance(payload: PluginResource): PluginInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/pluginConfiguration.js000064400000021316151677225100014034 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.PluginConfigurationPage = exports.PluginConfigurationListInstance = exports.PluginConfigurationInstance = exports.PluginConfigurationContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const configuredPlugin_1 = require("./pluginConfiguration/configuredPlugin"); class PluginConfigurationContextImpl { 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 = `/PluginService/Configurations/${sid}`; } get plugins() { this._plugins = this._plugins || (0, configuredPlugin_1.ConfiguredPluginListInstance)(this._version, this._solution.sid); return this._plugins; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PluginConfigurationInstance(operationVersion, payload, 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.PluginConfigurationContextImpl = PluginConfigurationContextImpl; class PluginConfigurationInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.name = payload.name; this.description = payload.description; this.archived = payload.archived; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PluginConfigurationContextImpl(this._version, this._solution.sid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Access the plugins. */ plugins() { return this._proxy.plugins; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, name: this.name, description: this.description, archived: this.archived, dateCreated: this.dateCreated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginConfigurationInstance = PluginConfigurationInstance; function PluginConfigurationListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PluginConfigurationContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/PluginService/Configurations`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["name"] === null || params["name"] === undefined) { throw new Error("Required parameter \"params['name']\" missing."); } let data = {}; data["Name"] = params["name"]; if (params["plugins"] !== undefined) data["Plugins"] = serialize.map(params["plugins"], (e) => serialize.object(e)); if (params["description"] !== undefined) data["Description"] = params["description"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PluginConfigurationInstance(operationVersion, payload)); 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 = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PluginConfigurationPage(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 PluginConfigurationPage(instance._version, payload, 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; } exports.PluginConfigurationListInstance = PluginConfigurationListInstance; class PluginConfigurationPage extends Page_1.default { /** * Initialize the PluginConfigurationPage * * @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 PluginConfigurationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PluginConfigurationInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginConfigurationPage = PluginConfigurationPage; rest/flexApi/v1/configuration.d.ts000064400000032156151677225100013115 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export type ConfigurationStatus = "ok" | "inprogress" | "notstarted"; /** * Options to pass to fetch a ConfigurationInstance */ export interface ConfigurationContextFetchOptions { /** The Pinned UI version of the Configuration resource to fetch. */ uiVersion?: string; } /** * Options to pass to update a ConfigurationInstance */ export interface ConfigurationContextUpdateOptions { /** */ body?: object; } export interface ConfigurationContext { /** * Fetch a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Fetch a ConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(params: ConfigurationContextFetchOptions, callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(params: object, callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConfigurationContextSolution { } export declare class ConfigurationContextImpl implements ConfigurationContext { protected _version: V1; protected _solution: ConfigurationContextSolution; protected _uri: string; constructor(_version: V1); fetch(params?: ConfigurationContextFetchOptions | ((error: Error | null, item?: ConfigurationInstance) => any), callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; update(params?: object | ((error: Error | null, item?: ConfigurationInstance) => any), callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConfigurationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConfigurationResource { account_sid: string; date_created: Date; date_updated: Date; attributes: any; status: ConfigurationStatus; taskrouter_workspace_sid: string; taskrouter_target_workflow_sid: string; taskrouter_target_taskqueue_sid: string; taskrouter_taskqueues: Array<any>; taskrouter_skills: Array<any>; taskrouter_worker_channels: any; taskrouter_worker_attributes: any; taskrouter_offline_activity_sid: string; runtime_domain: string; messaging_service_instance_sid: string; chat_service_instance_sid: string; flex_service_instance_sid: string; flex_instance_sid: string; ui_language: string; ui_attributes: any; ui_dependencies: any; ui_version: string; service_version: string; call_recording_enabled: boolean; call_recording_webhook_url: string; crm_enabled: boolean; crm_type: string; crm_callback_url: string; crm_fallback_url: string; crm_attributes: any; public_attributes: any; plugin_service_enabled: boolean; plugin_service_attributes: any; integrations: Array<any>; outbound_call_flows: any; serverless_service_sids: Array<string>; queue_stats_configuration: any; notifications: any; markdown: any; url: string; flex_insights_hr: any; flex_insights_drilldown: boolean; flex_url: string; channel_configs: Array<any>; debugger_integration: any; flex_ui_status_report: any; agent_conv_end_methods: any; citrix_voice_vdi: any; offline_config: any; } export declare class ConfigurationInstance { protected _version: V1; protected _solution: ConfigurationContextSolution; protected _context?: ConfigurationContext; constructor(_version: V1, payload: ConfigurationResource); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Configuration resource. */ accountSid: string; /** * The date and time in GMT when the Configuration 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 Configuration resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * An object that contains application-specific data. */ attributes: any; status: ConfigurationStatus; /** * The SID of the TaskRouter Workspace. */ taskrouterWorkspaceSid: string; /** * The SID of the TaskRouter target Workflow. */ taskrouterTargetWorkflowSid: string; /** * The SID of the TaskRouter Target TaskQueue. */ taskrouterTargetTaskqueueSid: string; /** * The list of TaskRouter TaskQueues. */ taskrouterTaskqueues: Array<any>; /** * The Skill description for TaskRouter workers. */ taskrouterSkills: Array<any>; /** * The TaskRouter default channel capacities and availability for workers. */ taskrouterWorkerChannels: any; /** * The TaskRouter Worker attributes. */ taskrouterWorkerAttributes: any; /** * The TaskRouter SID of the offline activity. */ taskrouterOfflineActivitySid: string; /** * The URL where the Flex instance is hosted. */ runtimeDomain: string; /** * The SID of the Messaging service instance. */ messagingServiceInstanceSid: string; /** * The SID of the chat service this user belongs to. */ chatServiceInstanceSid: string; /** * The SID of the Flex service instance. */ flexServiceInstanceSid: string; /** * The SID of the Flex instance. */ flexInstanceSid: string; /** * The primary language of the Flex UI. */ uiLanguage: string; /** * The object that describes Flex UI characteristics and settings. */ uiAttributes: any; /** * The object that defines the NPM packages and versions to be used in Hosted Flex. */ uiDependencies: any; /** * The Pinned UI version. */ uiVersion: string; /** * The Flex Service version. */ serviceVersion: string; /** * Whether call recording is enabled. */ callRecordingEnabled: boolean; /** * The call recording webhook URL. */ callRecordingWebhookUrl: string; /** * Whether CRM is present for Flex. */ crmEnabled: boolean; /** * The CRM type. */ crmType: string; /** * The CRM Callback URL. */ crmCallbackUrl: string; /** * The CRM Fallback URL. */ crmFallbackUrl: string; /** * An object that contains the CRM attributes. */ crmAttributes: any; /** * The list of public attributes, which are visible to unauthenticated clients. */ publicAttributes: any; /** * Whether the plugin service enabled. */ pluginServiceEnabled: boolean; /** * The plugin service attributes. */ pluginServiceAttributes: any; /** * A list of objects that contain the configurations for the Integrations supported in this configuration. */ integrations: Array<any>; /** * The list of outbound call flows. */ outboundCallFlows: any; /** * The list of serverless service SIDs. */ serverlessServiceSids: Array<string>; /** * Configurable parameters for Queues Statistics. */ queueStatsConfiguration: any; /** * Configurable parameters for Notifications. */ notifications: any; /** * Configurable parameters for Markdown. */ markdown: any; /** * The absolute URL of the Configuration resource. */ url: string; /** * Object with enabled/disabled flag with list of workspaces. */ flexInsightsHr: any; /** * Setting this to true will redirect Flex UI to the URL set in flex_url */ flexInsightsDrilldown: boolean; /** * URL to redirect to in case drilldown is enabled. */ flexUrl: string; /** * Settings for different limits for Flex Conversations channels attachments. */ channelConfigs: Array<any>; /** * Configurable parameters for Debugger Integration. */ debuggerIntegration: any; /** * Configurable parameters for Flex UI Status report. */ flexUiStatusReport: any; /** * Agent conversation end methods. */ agentConvEndMethods: any; /** * Citrix voice vdi configuration and settings. */ citrixVoiceVdi: any; /** * Presence and presence ttl configuration */ offlineConfig: any; private get _proxy(); /** * Fetch a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Fetch a ConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ fetch(params: ConfigurationContextFetchOptions, callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Update a ConfigurationInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfigurationInstance */ update(params: object, callback?: (error: Error | null, item?: ConfigurationInstance) => any): Promise<ConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; attributes: any; status: ConfigurationStatus; taskrouterWorkspaceSid: string; taskrouterTargetWorkflowSid: string; taskrouterTargetTaskqueueSid: string; taskrouterTaskqueues: any[]; taskrouterSkills: any[]; taskrouterWorkerChannels: any; taskrouterWorkerAttributes: any; taskrouterOfflineActivitySid: string; runtimeDomain: string; messagingServiceInstanceSid: string; chatServiceInstanceSid: string; flexServiceInstanceSid: string; flexInstanceSid: string; uiLanguage: string; uiAttributes: any; uiDependencies: any; uiVersion: string; serviceVersion: string; callRecordingEnabled: boolean; callRecordingWebhookUrl: string; crmEnabled: boolean; crmType: string; crmCallbackUrl: string; crmFallbackUrl: string; crmAttributes: any; publicAttributes: any; pluginServiceEnabled: boolean; pluginServiceAttributes: any; integrations: any[]; outboundCallFlows: any; serverlessServiceSids: string[]; queueStatsConfiguration: any; notifications: any; markdown: any; url: string; flexInsightsHr: any; flexInsightsDrilldown: boolean; flexUrl: string; channelConfigs: any[]; debuggerIntegration: any; flexUiStatusReport: any; agentConvEndMethods: any; citrixVoiceVdi: any; offlineConfig: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConfigurationSolution { } export interface ConfigurationListInstance { _version: V1; _solution: ConfigurationSolution; _uri: string; (): ConfigurationContext; get(): ConfigurationContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConfigurationListInstance(version: V1): ConfigurationListInstance; export {}; rest/flexApi/v1/insightsSegments.js000064400000015136151677225100013347 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsSegmentsPage = exports.InsightsSegmentsInstance = exports.InsightsSegmentsListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function InsightsSegmentsListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Insights/Segments`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["segmentId"] !== undefined) data["SegmentId"] = params["segmentId"]; if (params["reservationId"] !== undefined) data["ReservationId"] = serialize.map(params["reservationId"], (e) => e); 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 = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsSegmentsPage(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 InsightsSegmentsPage(instance._version, payload, 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; } exports.InsightsSegmentsListInstance = InsightsSegmentsListInstance; class InsightsSegmentsInstance { constructor(_version, payload) { this._version = _version; this.segmentId = payload.segment_id; this.externalId = payload.external_id; this.queue = payload.queue; this.externalContact = payload.external_contact; this.externalSegmentLinkId = payload.external_segment_link_id; this.date = payload.date; this.accountId = payload.account_id; this.externalSegmentLink = payload.external_segment_link; this.agentId = payload.agent_id; this.agentPhone = payload.agent_phone; this.agentName = payload.agent_name; this.agentTeamName = payload.agent_team_name; this.agentTeamNameInHierarchy = payload.agent_team_name_in_hierarchy; this.agentLink = payload.agent_link; this.customerPhone = payload.customer_phone; this.customerName = payload.customer_name; this.customerLink = payload.customer_link; this.segmentRecordingOffset = payload.segment_recording_offset; this.media = payload.media; this.assessmentType = payload.assessment_type; this.assessmentPercentage = payload.assessment_percentage; this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { segmentId: this.segmentId, externalId: this.externalId, queue: this.queue, externalContact: this.externalContact, externalSegmentLinkId: this.externalSegmentLinkId, date: this.date, accountId: this.accountId, externalSegmentLink: this.externalSegmentLink, agentId: this.agentId, agentPhone: this.agentPhone, agentName: this.agentName, agentTeamName: this.agentTeamName, agentTeamNameInHierarchy: this.agentTeamNameInHierarchy, agentLink: this.agentLink, customerPhone: this.customerPhone, customerName: this.customerName, customerLink: this.customerLink, segmentRecordingOffset: this.segmentRecordingOffset, media: this.media, assessmentType: this.assessmentType, assessmentPercentage: this.assessmentPercentage, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsSegmentsInstance = InsightsSegmentsInstance; class InsightsSegmentsPage extends Page_1.default { /** * Initialize the InsightsSegmentsPage * * @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 InsightsSegmentsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InsightsSegmentsInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsSegmentsPage = InsightsSegmentsPage; rest/flexApi/v1/flexFlow.d.ts000064400000042657151677225100012043 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type FlexFlowChannelType = "web" | "sms" | "facebook" | "whatsapp" | "line" | "custom"; export type FlexFlowIntegrationType = "studio" | "external" | "task"; /** * Options to pass to update a FlexFlowInstance */ export interface FlexFlowContextUpdateOptions { /** A descriptive string that you create to describe the Flex Flow resource. */ friendlyName?: string; /** The SID of the chat service. */ chatServiceSid?: string; /** */ channelType?: FlexFlowChannelType; /** The channel contact\\\'s Identity. */ contactIdentity?: string; /** Whether the new Flex Flow is enabled. */ enabled?: boolean; /** */ integrationType?: FlexFlowIntegrationType; /** The SID of the Studio Flow. Required when `integrationType` is `studio`. */ "integration.flowSid"?: string; /** The URL of the external webhook. Required when `integrationType` is `external`. */ "integration.url"?: string; /** The Workspace SID for a new Task. Required when `integrationType` is `task`. */ "integration.workspaceSid"?: string; /** The Workflow SID for a new Task. Required when `integrationType` is `task`. */ "integration.workflowSid"?: string; /** The Task Channel SID (TCXXXX) or unique name (e.g., `sms`) to use for the Task that will be created. Applicable and required when `integrationType` is `task`. The default value is `default`. */ "integration.channel"?: string; /** The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. */ "integration.timeout"?: number; /** The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. */ "integration.priority"?: number; /** In the context of outbound messaging, defines whether to create a Task immediately (and therefore reserve the conversation to current agent), or delay Task creation until the customer sends the first response. Set to false to create immediately, true to delay Task creation. This setting is only applicable for outbound messaging. */ "integration.creationOnMessage"?: boolean; /** When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to `false`. */ longLived?: boolean; /** When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to `false`. */ janitorEnabled?: boolean; /** The number of times to retry the Studio Flow or webhook in case of failure. Takes integer values from 0 to 3 with the default being 3. Optional when `integrationType` is `studio` or `external`, not applicable otherwise. */ "integration.retryCount"?: number; } /** * Options to pass to create a FlexFlowInstance */ export interface FlexFlowListInstanceCreateOptions { /** A descriptive string that you create to describe the Flex Flow resource. */ friendlyName: string; /** The SID of the chat service. */ chatServiceSid: string; /** */ channelType: FlexFlowChannelType; /** The channel contact\\\'s Identity. */ contactIdentity?: string; /** Whether the new Flex Flow is enabled. */ enabled?: boolean; /** */ integrationType?: FlexFlowIntegrationType; /** The SID of the Studio Flow. Required when `integrationType` is `studio`. */ "integration.flowSid"?: string; /** The URL of the external webhook. Required when `integrationType` is `external`. */ "integration.url"?: string; /** The Workspace SID for a new Task. Required when `integrationType` is `task`. */ "integration.workspaceSid"?: string; /** The Workflow SID for a new Task. Required when `integrationType` is `task`. */ "integration.workflowSid"?: string; /** The Task Channel SID (TCXXXX) or unique name (e.g., `sms`) to use for the Task that will be created. Applicable and required when `integrationType` is `task`. The default value is `default`. */ "integration.channel"?: string; /** The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. */ "integration.timeout"?: number; /** The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. */ "integration.priority"?: number; /** In the context of outbound messaging, defines whether to create a Task immediately (and therefore reserve the conversation to current agent), or delay Task creation until the customer sends the first response. Set to false to create immediately, true to delay Task creation. This setting is only applicable for outbound messaging. */ "integration.creationOnMessage"?: boolean; /** When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to `false`. */ longLived?: boolean; /** When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to `false`. */ janitorEnabled?: boolean; /** The number of times to retry the Studio Flow or webhook in case of failure. Takes integer values from 0 to 3 with the default being 3. Optional when `integrationType` is `studio` or `external`, not applicable otherwise. */ "integration.retryCount"?: number; } /** * Options to pass to each */ export interface FlexFlowListInstanceEachOptions { /** The `friendly_name` of the Flex Flow resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: FlexFlowInstance, 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 FlexFlowListInstanceOptions { /** The `friendly_name` of the Flex Flow resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface FlexFlowListInstancePageOptions { /** The `friendly_name` of the Flex Flow resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface FlexFlowContext { /** * Remove a FlexFlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FlexFlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexFlowInstance */ fetch(callback?: (error: Error | null, item?: FlexFlowInstance) => any): Promise<FlexFlowInstance>; /** * Update a FlexFlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexFlowInstance */ update(callback?: (error: Error | null, item?: FlexFlowInstance) => any): Promise<FlexFlowInstance>; /** * Update a FlexFlowInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexFlowInstance */ update(params: FlexFlowContextUpdateOptions, callback?: (error: Error | null, item?: FlexFlowInstance) => any): Promise<FlexFlowInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FlexFlowContextSolution { sid: string; } export declare class FlexFlowContextImpl implements FlexFlowContext { protected _version: V1; protected _solution: FlexFlowContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: FlexFlowInstance) => any): Promise<FlexFlowInstance>; update(params?: FlexFlowContextUpdateOptions | ((error: Error | null, item?: FlexFlowInstance) => any), callback?: (error: Error | null, item?: FlexFlowInstance) => any): Promise<FlexFlowInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FlexFlowContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FlexFlowPayload extends TwilioResponsePayload { flex_flows: FlexFlowResource[]; } interface FlexFlowResource { account_sid: string; date_created: Date; date_updated: Date; sid: string; friendly_name: string; chat_service_sid: string; channel_type: FlexFlowChannelType; contact_identity: string; enabled: boolean; integration_type: FlexFlowIntegrationType; integration: any; long_lived: boolean; janitor_enabled: boolean; url: string; } export declare class FlexFlowInstance { protected _version: V1; protected _solution: FlexFlowContextSolution; protected _context?: FlexFlowContext; constructor(_version: V1, payload: FlexFlowResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Flow resource and owns this Workflow. */ accountSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The unique string that we created to identify the Flex Flow resource. */ sid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The SID of the chat service. */ chatServiceSid: string; channelType: FlexFlowChannelType; /** * The channel contact\'s Identity. */ contactIdentity: string; /** * Whether the Flex Flow is enabled. */ enabled: boolean; integrationType: FlexFlowIntegrationType; /** * An object that contains specific parameters for the integration. */ integration: any; /** * When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to `false`. */ longLived: boolean; /** * When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to `false`. */ janitorEnabled: boolean; /** * The absolute URL of the Flex Flow resource. */ url: string; private get _proxy(); /** * Remove a FlexFlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FlexFlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexFlowInstance */ fetch(callback?: (error: Error | null, item?: FlexFlowInstance) => any): Promise<FlexFlowInstance>; /** * Update a FlexFlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexFlowInstance */ update(callback?: (error: Error | null, item?: FlexFlowInstance) => any): Promise<FlexFlowInstance>; /** * Update a FlexFlowInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexFlowInstance */ update(params: FlexFlowContextUpdateOptions, callback?: (error: Error | null, item?: FlexFlowInstance) => any): Promise<FlexFlowInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; sid: string; friendlyName: string; chatServiceSid: string; channelType: FlexFlowChannelType; contactIdentity: string; enabled: boolean; integrationType: FlexFlowIntegrationType; integration: any; longLived: boolean; janitorEnabled: boolean; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FlexFlowSolution { } export interface FlexFlowListInstance { _version: V1; _solution: FlexFlowSolution; _uri: string; (sid: string): FlexFlowContext; get(sid: string): FlexFlowContext; /** * Create a FlexFlowInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexFlowInstance */ create(params: FlexFlowListInstanceCreateOptions, callback?: (error: Error | null, item?: FlexFlowInstance) => any): Promise<FlexFlowInstance>; /** * Streams FlexFlowInstance 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 { FlexFlowListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: FlexFlowInstance, done: (err?: Error) => void) => void): void; each(params: FlexFlowListInstanceEachOptions, callback?: (item: FlexFlowInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of FlexFlowInstance 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: FlexFlowPage) => any): Promise<FlexFlowPage>; /** * Lists FlexFlowInstance 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 { FlexFlowListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: FlexFlowInstance[]) => any): Promise<FlexFlowInstance[]>; list(params: FlexFlowListInstanceOptions, callback?: (error: Error | null, items: FlexFlowInstance[]) => any): Promise<FlexFlowInstance[]>; /** * Retrieve a single page of FlexFlowInstance 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 { FlexFlowListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: FlexFlowPage) => any): Promise<FlexFlowPage>; page(params: FlexFlowListInstancePageOptions, callback?: (error: Error | null, items: FlexFlowPage) => any): Promise<FlexFlowPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FlexFlowListInstance(version: V1): FlexFlowListInstance; export declare class FlexFlowPage extends Page<V1, FlexFlowPayload, FlexFlowResource, FlexFlowInstance> { /** * Initialize the FlexFlowPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: FlexFlowSolution); /** * Build an instance of FlexFlowInstance * * @param payload - Payload response from the API */ getInstance(payload: FlexFlowResource): FlexFlowInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/channel.d.ts000064400000024264151677225100011657 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to create a ChannelInstance */ export interface ChannelListInstanceCreateOptions { /** The SID of the Flex Flow. */ flexFlowSid: string; /** The `identity` value that uniquely identifies the new resource\\\'s chat User. */ identity: string; /** The chat participant\\\'s friendly name. */ chatUserFriendlyName: string; /** The chat channel\\\'s friendly name. */ chatFriendlyName: string; /** The Target Contact Identity, for example the phone number of an SMS. */ target?: string; /** The chat channel\\\'s unique name. */ chatUniqueName?: string; /** The pre-engagement data. */ preEngagementData?: string; /** The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external` */ taskSid?: string; /** The Task attributes to be added for the TaskRouter Task. */ taskAttributes?: string; /** Whether to create the channel as long-lived. */ longLived?: boolean; } /** * Options to pass to each */ export interface ChannelListInstanceEachOptions { /** 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: ChannelInstance, 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 ChannelListInstanceOptions { /** 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 ChannelListInstancePageOptions { /** 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 ChannelContext { /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ChannelContextSolution { sid: string; } export declare class ChannelContextImpl implements ChannelContext { protected _version: V1; protected _solution: ChannelContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ChannelPayload extends TwilioResponsePayload { flex_chat_channels: ChannelResource[]; } interface ChannelResource { account_sid: string; flex_flow_sid: string; sid: string; user_sid: string; task_sid: string; url: string; date_created: Date; date_updated: Date; } export declare class ChannelInstance { protected _version: V1; protected _solution: ChannelContextSolution; protected _context?: ChannelContext; constructor(_version: V1, payload: ChannelResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource and owns this Workflow. */ accountSid: string; /** * The SID of the Flex Flow. */ flexFlowSid: string; /** * The unique string that we created to identify the Channel resource. */ sid: string; /** * The SID of the chat user. */ userSid: string; /** * The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external` */ taskSid: string; /** * The absolute URL of the Flex chat channel resource. */ url: string; /** * The date and time in GMT when the Flex chat channel was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the Flex chat channel was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; private get _proxy(); /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; flexFlowSid: string; sid: string; userSid: string; taskSid: string; url: string; dateCreated: Date; dateUpdated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ChannelSolution { } export interface ChannelListInstance { _version: V1; _solution: ChannelSolution; _uri: string; (sid: string): ChannelContext; get(sid: string): ChannelContext; /** * Create a ChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ create(params: ChannelListInstanceCreateOptions, callback?: (error: Error | null, item?: ChannelInstance) => any): Promise<ChannelInstance>; /** * Streams ChannelInstance 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 { ChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; each(params: ChannelListInstanceEachOptions, callback?: (item: ChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ChannelInstance 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: ChannelPage) => any): Promise<ChannelPage>; /** * Lists ChannelInstance 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 { ChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; list(params: ChannelListInstanceOptions, callback?: (error: Error | null, items: ChannelInstance[]) => any): Promise<ChannelInstance[]>; /** * Retrieve a single page of ChannelInstance 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 { ChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; page(params: ChannelListInstancePageOptions, callback?: (error: Error | null, items: ChannelPage) => any): Promise<ChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ChannelListInstance(version: V1): ChannelListInstance; export declare class ChannelPage extends Page<V1, ChannelPayload, ChannelResource, ChannelInstance> { /** * Initialize the ChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ChannelSolution); /** * Build an instance of ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: ChannelResource): ChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/assessments.js000064400000026564151677225100012370 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.AssessmentsPage = exports.AssessmentsListInstance = exports.AssessmentsInstance = exports.AssessmentsContextImpl = void 0; 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 AssessmentsContextImpl { constructor(_version, assessmentSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(assessmentSid)) { throw new Error("Parameter 'assessmentSid' is not valid."); } this._solution = { assessmentSid }; this._uri = `/Insights/QualityManagement/Assessments/${assessmentSid}`; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["offset"] === null || params["offset"] === undefined) { throw new Error("Required parameter \"params['offset']\" missing."); } if (params["answerText"] === null || params["answerText"] === undefined) { throw new Error("Required parameter \"params['answerText']\" missing."); } if (params["answerId"] === null || params["answerId"] === undefined) { throw new Error("Required parameter \"params['answerId']\" missing."); } let data = {}; data["Offset"] = params["offset"]; data["AnswerText"] = params["answerText"]; data["AnswerId"] = params["answerId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AssessmentsInstance(operationVersion, payload, instance._solution.assessmentSid)); 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.AssessmentsContextImpl = AssessmentsContextImpl; class AssessmentsInstance { constructor(_version, payload, assessmentSid) { this._version = _version; this.accountSid = payload.account_sid; this.assessmentSid = payload.assessment_sid; this.offset = payload.offset; this.report = payload.report; this.weight = payload.weight; this.agentId = payload.agent_id; this.segmentId = payload.segment_id; this.userName = payload.user_name; this.userEmail = payload.user_email; this.answerText = payload.answer_text; this.answerId = payload.answer_id; this.assessment = payload.assessment; this.timestamp = payload.timestamp; this.url = payload.url; this._solution = { assessmentSid: assessmentSid || this.assessmentSid }; } get _proxy() { this._context = this._context || new AssessmentsContextImpl(this._version, this._solution.assessmentSid); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, assessmentSid: this.assessmentSid, offset: this.offset, report: this.report, weight: this.weight, agentId: this.agentId, segmentId: this.segmentId, userName: this.userName, userEmail: this.userEmail, answerText: this.answerText, answerId: this.answerId, assessment: this.assessment, timestamp: this.timestamp, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssessmentsInstance = AssessmentsInstance; function AssessmentsListInstance(version) { const instance = ((assessmentSid) => instance.get(assessmentSid)); instance.get = function get(assessmentSid) { return new AssessmentsContextImpl(version, assessmentSid); }; instance._version = version; instance._solution = {}; instance._uri = `/Insights/QualityManagement/Assessments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["categorySid"] === null || params["categorySid"] === undefined) { throw new Error("Required parameter \"params['categorySid']\" missing."); } if (params["categoryName"] === null || params["categoryName"] === undefined) { throw new Error("Required parameter \"params['categoryName']\" missing."); } if (params["segmentId"] === null || params["segmentId"] === undefined) { throw new Error("Required parameter \"params['segmentId']\" missing."); } if (params["agentId"] === null || params["agentId"] === undefined) { throw new Error("Required parameter \"params['agentId']\" missing."); } if (params["offset"] === null || params["offset"] === undefined) { throw new Error("Required parameter \"params['offset']\" missing."); } if (params["metricId"] === null || params["metricId"] === undefined) { throw new Error("Required parameter \"params['metricId']\" missing."); } if (params["metricName"] === null || params["metricName"] === undefined) { throw new Error("Required parameter \"params['metricName']\" missing."); } if (params["answerText"] === null || params["answerText"] === undefined) { throw new Error("Required parameter \"params['answerText']\" missing."); } if (params["answerId"] === null || params["answerId"] === undefined) { throw new Error("Required parameter \"params['answerId']\" missing."); } if (params["questionnaireSid"] === null || params["questionnaireSid"] === undefined) { throw new Error("Required parameter \"params['questionnaireSid']\" missing."); } let data = {}; data["CategorySid"] = params["categorySid"]; data["CategoryName"] = params["categoryName"]; data["SegmentId"] = params["segmentId"]; data["AgentId"] = params["agentId"]; data["Offset"] = params["offset"]; data["MetricId"] = params["metricId"]; data["MetricName"] = params["metricName"]; data["AnswerText"] = params["answerText"]; data["AnswerId"] = params["answerId"]; data["QuestionnaireSid"] = params["questionnaireSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AssessmentsInstance(operationVersion, payload)); 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["segmentId"] !== undefined) data["SegmentId"] = params["segmentId"]; 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 = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AssessmentsPage(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 AssessmentsPage(instance._version, payload, 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; } exports.AssessmentsListInstance = AssessmentsListInstance; class AssessmentsPage extends Page_1.default { /** * Initialize the AssessmentsPage * * @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 AssessmentsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AssessmentsInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssessmentsPage = AssessmentsPage; rest/flexApi/v1/insightsSettingsComment.js000064400000005510151677225100014700 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsSettingsCommentInstance = exports.InsightsSettingsCommentListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function InsightsSettingsCommentListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Insights/QualityManagement/Settings/CommentTags`; instance.fetch = function fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsSettingsCommentInstance(operationVersion, payload)); 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; } exports.InsightsSettingsCommentListInstance = InsightsSettingsCommentListInstance; class InsightsSettingsCommentInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.comments = payload.comments; this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, comments: this.comments, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsSettingsCommentInstance = InsightsSettingsCommentInstance; rest/flexApi/v1/configuration.js000064400000023331151677225100012654 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.ConfigurationListInstance = exports.ConfigurationInstance = exports.ConfigurationContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class ConfigurationContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/Configuration`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uiVersion"] !== undefined) data["UiVersion"] = params["uiVersion"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConfigurationInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ConfigurationInstance(operationVersion, payload)); 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.ConfigurationContextImpl = ConfigurationContextImpl; class ConfigurationInstance { 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.attributes = payload.attributes; this.status = payload.status; this.taskrouterWorkspaceSid = payload.taskrouter_workspace_sid; this.taskrouterTargetWorkflowSid = payload.taskrouter_target_workflow_sid; this.taskrouterTargetTaskqueueSid = payload.taskrouter_target_taskqueue_sid; this.taskrouterTaskqueues = payload.taskrouter_taskqueues; this.taskrouterSkills = payload.taskrouter_skills; this.taskrouterWorkerChannels = payload.taskrouter_worker_channels; this.taskrouterWorkerAttributes = payload.taskrouter_worker_attributes; this.taskrouterOfflineActivitySid = payload.taskrouter_offline_activity_sid; this.runtimeDomain = payload.runtime_domain; this.messagingServiceInstanceSid = payload.messaging_service_instance_sid; this.chatServiceInstanceSid = payload.chat_service_instance_sid; this.flexServiceInstanceSid = payload.flex_service_instance_sid; this.flexInstanceSid = payload.flex_instance_sid; this.uiLanguage = payload.ui_language; this.uiAttributes = payload.ui_attributes; this.uiDependencies = payload.ui_dependencies; this.uiVersion = payload.ui_version; this.serviceVersion = payload.service_version; this.callRecordingEnabled = payload.call_recording_enabled; this.callRecordingWebhookUrl = payload.call_recording_webhook_url; this.crmEnabled = payload.crm_enabled; this.crmType = payload.crm_type; this.crmCallbackUrl = payload.crm_callback_url; this.crmFallbackUrl = payload.crm_fallback_url; this.crmAttributes = payload.crm_attributes; this.publicAttributes = payload.public_attributes; this.pluginServiceEnabled = payload.plugin_service_enabled; this.pluginServiceAttributes = payload.plugin_service_attributes; this.integrations = payload.integrations; this.outboundCallFlows = payload.outbound_call_flows; this.serverlessServiceSids = payload.serverless_service_sids; this.queueStatsConfiguration = payload.queue_stats_configuration; this.notifications = payload.notifications; this.markdown = payload.markdown; this.url = payload.url; this.flexInsightsHr = payload.flex_insights_hr; this.flexInsightsDrilldown = payload.flex_insights_drilldown; this.flexUrl = payload.flex_url; this.channelConfigs = payload.channel_configs; this.debuggerIntegration = payload.debugger_integration; this.flexUiStatusReport = payload.flex_ui_status_report; this.agentConvEndMethods = payload.agent_conv_end_methods; this.citrixVoiceVdi = payload.citrix_voice_vdi; this.offlineConfig = payload.offline_config; this._solution = {}; } get _proxy() { this._context = this._context || new ConfigurationContextImpl(this._version); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, attributes: this.attributes, status: this.status, taskrouterWorkspaceSid: this.taskrouterWorkspaceSid, taskrouterTargetWorkflowSid: this.taskrouterTargetWorkflowSid, taskrouterTargetTaskqueueSid: this.taskrouterTargetTaskqueueSid, taskrouterTaskqueues: this.taskrouterTaskqueues, taskrouterSkills: this.taskrouterSkills, taskrouterWorkerChannels: this.taskrouterWorkerChannels, taskrouterWorkerAttributes: this.taskrouterWorkerAttributes, taskrouterOfflineActivitySid: this.taskrouterOfflineActivitySid, runtimeDomain: this.runtimeDomain, messagingServiceInstanceSid: this.messagingServiceInstanceSid, chatServiceInstanceSid: this.chatServiceInstanceSid, flexServiceInstanceSid: this.flexServiceInstanceSid, flexInstanceSid: this.flexInstanceSid, uiLanguage: this.uiLanguage, uiAttributes: this.uiAttributes, uiDependencies: this.uiDependencies, uiVersion: this.uiVersion, serviceVersion: this.serviceVersion, callRecordingEnabled: this.callRecordingEnabled, callRecordingWebhookUrl: this.callRecordingWebhookUrl, crmEnabled: this.crmEnabled, crmType: this.crmType, crmCallbackUrl: this.crmCallbackUrl, crmFallbackUrl: this.crmFallbackUrl, crmAttributes: this.crmAttributes, publicAttributes: this.publicAttributes, pluginServiceEnabled: this.pluginServiceEnabled, pluginServiceAttributes: this.pluginServiceAttributes, integrations: this.integrations, outboundCallFlows: this.outboundCallFlows, serverlessServiceSids: this.serverlessServiceSids, queueStatsConfiguration: this.queueStatsConfiguration, notifications: this.notifications, markdown: this.markdown, url: this.url, flexInsightsHr: this.flexInsightsHr, flexInsightsDrilldown: this.flexInsightsDrilldown, flexUrl: this.flexUrl, channelConfigs: this.channelConfigs, debuggerIntegration: this.debuggerIntegration, flexUiStatusReport: this.flexUiStatusReport, agentConvEndMethods: this.agentConvEndMethods, citrixVoiceVdi: this.citrixVoiceVdi, offlineConfig: this.offlineConfig, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConfigurationInstance = ConfigurationInstance; function ConfigurationListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new ConfigurationContextImpl(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; } exports.ConfigurationListInstance = ConfigurationListInstance; rest/flexApi/v1/assessments.d.ts000064400000025726151677225100012623 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to update a AssessmentsInstance */ export interface AssessmentsContextUpdateOptions { /** The offset of the conversation */ offset: number; /** The answer text selected by user */ answerText: string; /** The id of the answer selected by user */ answerId: string; /** The Authorization HTTP request header */ authorization?: string; } /** * Options to pass to create a AssessmentsInstance */ export interface AssessmentsListInstanceCreateOptions { /** The SID of the category */ categorySid: string; /** The name of the category */ categoryName: string; /** Segment Id of the conversation */ segmentId: string; /** The id of the Agent */ agentId: string; /** The offset of the conversation. */ offset: number; /** The question SID selected for assessment */ metricId: string; /** The question name of the assessment */ metricName: string; /** The answer text selected by user */ answerText: string; /** The id of the answer selected by user */ answerId: string; /** Questionnaire SID of the associated question */ questionnaireSid: string; /** The Authorization HTTP request header */ authorization?: string; } /** * Options to pass to each */ export interface AssessmentsListInstanceEachOptions { /** The Authorization HTTP request header */ authorization?: string; /** The id of the segment. */ segmentId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: AssessmentsInstance, 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 AssessmentsListInstanceOptions { /** The Authorization HTTP request header */ authorization?: string; /** The id of the segment. */ segmentId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface AssessmentsListInstancePageOptions { /** The Authorization HTTP request header */ authorization?: string; /** The id of the segment. */ segmentId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface AssessmentsContext { /** * Update a AssessmentsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssessmentsInstance */ update(params: AssessmentsContextUpdateOptions, callback?: (error: Error | null, item?: AssessmentsInstance) => any): Promise<AssessmentsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AssessmentsContextSolution { assessmentSid: string; } export declare class AssessmentsContextImpl implements AssessmentsContext { protected _version: V1; protected _solution: AssessmentsContextSolution; protected _uri: string; constructor(_version: V1, assessmentSid: string); update(params: AssessmentsContextUpdateOptions, callback?: (error: Error | null, item?: AssessmentsInstance) => any): Promise<AssessmentsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AssessmentsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AssessmentsPayload extends TwilioResponsePayload { assessments: AssessmentsResource[]; } interface AssessmentsResource { account_sid: string; assessment_sid: string; offset: number; report: boolean; weight: number; agent_id: string; segment_id: string; user_name: string; user_email: string; answer_text: string; answer_id: string; assessment: any; timestamp: number; url: string; } export declare class AssessmentsInstance { protected _version: V1; protected _solution: AssessmentsContextSolution; protected _context?: AssessmentsContext; constructor(_version: V1, payload: AssessmentsResource, assessmentSid?: string); /** * The unique SID identifier of the Account. */ accountSid: string; /** * The SID of the assessment */ assessmentSid: string; /** * Offset of the conversation */ offset: number; /** * The flag indicating if this assessment is part of report */ report: boolean; /** * The weightage given to this comment */ weight: number; /** * The id of the Agent */ agentId: string; /** * Segment Id of conversation */ segmentId: string; /** * The name of the user. */ userName: string; /** * The email id of the user. */ userEmail: string; /** * The answer text selected by user */ answerText: string; /** * The id of the answer selected by user */ answerId: string; /** * Assessment Details associated with an assessment */ assessment: any; timestamp: number; url: string; private get _proxy(); /** * Update a AssessmentsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssessmentsInstance */ update(params: AssessmentsContextUpdateOptions, callback?: (error: Error | null, item?: AssessmentsInstance) => any): Promise<AssessmentsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; assessmentSid: string; offset: number; report: boolean; weight: number; agentId: string; segmentId: string; userName: string; userEmail: string; answerText: string; answerId: string; assessment: any; timestamp: number; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AssessmentsSolution { } export interface AssessmentsListInstance { _version: V1; _solution: AssessmentsSolution; _uri: string; (assessmentSid: string): AssessmentsContext; get(assessmentSid: string): AssessmentsContext; /** * Create a AssessmentsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssessmentsInstance */ create(params: AssessmentsListInstanceCreateOptions, callback?: (error: Error | null, item?: AssessmentsInstance) => any): Promise<AssessmentsInstance>; /** * Streams AssessmentsInstance 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 { AssessmentsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AssessmentsInstance, done: (err?: Error) => void) => void): void; each(params: AssessmentsListInstanceEachOptions, callback?: (item: AssessmentsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AssessmentsInstance 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: AssessmentsPage) => any): Promise<AssessmentsPage>; /** * Lists AssessmentsInstance 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 { AssessmentsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AssessmentsInstance[]) => any): Promise<AssessmentsInstance[]>; list(params: AssessmentsListInstanceOptions, callback?: (error: Error | null, items: AssessmentsInstance[]) => any): Promise<AssessmentsInstance[]>; /** * Retrieve a single page of AssessmentsInstance 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 { AssessmentsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AssessmentsPage) => any): Promise<AssessmentsPage>; page(params: AssessmentsListInstancePageOptions, callback?: (error: Error | null, items: AssessmentsPage) => any): Promise<AssessmentsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AssessmentsListInstance(version: V1): AssessmentsListInstance; export declare class AssessmentsPage extends Page<V1, AssessmentsPayload, AssessmentsResource, AssessmentsInstance> { /** * Initialize the AssessmentsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AssessmentsSolution); /** * Build an instance of AssessmentsInstance * * @param payload - Payload response from the API */ getInstance(payload: AssessmentsResource): AssessmentsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/insightsAssessmentsComment.d.ts000064400000022277151677225100015655 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to create a InsightsAssessmentsCommentInstance */ export interface InsightsAssessmentsCommentListInstanceCreateOptions { /** The ID of the category */ categoryId: string; /** The name of the category */ categoryName: string; /** The Assessment comment. */ comment: string; /** The id of the segment. */ segmentId: string; /** The id of the agent. */ agentId: string; /** The offset */ offset: number; /** The Authorization HTTP request header */ authorization?: string; } /** * Options to pass to each */ export interface InsightsAssessmentsCommentListInstanceEachOptions { /** The Authorization HTTP request header */ authorization?: string; /** The id of the segment. */ segmentId?: string; /** The id of the agent. */ agentId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InsightsAssessmentsCommentInstance, 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 InsightsAssessmentsCommentListInstanceOptions { /** The Authorization HTTP request header */ authorization?: string; /** The id of the segment. */ segmentId?: string; /** The id of the agent. */ agentId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InsightsAssessmentsCommentListInstancePageOptions { /** The Authorization HTTP request header */ authorization?: string; /** The id of the segment. */ segmentId?: string; /** The id of the agent. */ agentId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InsightsAssessmentsCommentSolution { } export interface InsightsAssessmentsCommentListInstance { _version: V1; _solution: InsightsAssessmentsCommentSolution; _uri: string; /** * Create a InsightsAssessmentsCommentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsAssessmentsCommentInstance */ create(params: InsightsAssessmentsCommentListInstanceCreateOptions, callback?: (error: Error | null, item?: InsightsAssessmentsCommentInstance) => any): Promise<InsightsAssessmentsCommentInstance>; /** * Streams InsightsAssessmentsCommentInstance 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 { InsightsAssessmentsCommentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InsightsAssessmentsCommentInstance, done: (err?: Error) => void) => void): void; each(params: InsightsAssessmentsCommentListInstanceEachOptions, callback?: (item: InsightsAssessmentsCommentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InsightsAssessmentsCommentInstance 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: InsightsAssessmentsCommentPage) => any): Promise<InsightsAssessmentsCommentPage>; /** * Lists InsightsAssessmentsCommentInstance 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 { InsightsAssessmentsCommentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InsightsAssessmentsCommentInstance[]) => any): Promise<InsightsAssessmentsCommentInstance[]>; list(params: InsightsAssessmentsCommentListInstanceOptions, callback?: (error: Error | null, items: InsightsAssessmentsCommentInstance[]) => any): Promise<InsightsAssessmentsCommentInstance[]>; /** * Retrieve a single page of InsightsAssessmentsCommentInstance 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 { InsightsAssessmentsCommentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InsightsAssessmentsCommentPage) => any): Promise<InsightsAssessmentsCommentPage>; page(params: InsightsAssessmentsCommentListInstancePageOptions, callback?: (error: Error | null, items: InsightsAssessmentsCommentPage) => any): Promise<InsightsAssessmentsCommentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsAssessmentsCommentListInstance(version: V1): InsightsAssessmentsCommentListInstance; interface InsightsAssessmentsCommentPayload extends TwilioResponsePayload { comments: InsightsAssessmentsCommentResource[]; } interface InsightsAssessmentsCommentResource { account_sid: string; assessment_sid: string; comment: any; offset: number; report: boolean; weight: number; agent_id: string; segment_id: string; user_name: string; user_email: string; timestamp: number; url: string; } export declare class InsightsAssessmentsCommentInstance { protected _version: V1; constructor(_version: V1, payload: InsightsAssessmentsCommentResource); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. */ accountSid: string; /** * The SID of the assessment. */ assessmentSid: string; /** * The comment added for assessment. */ comment: any; /** * The offset */ offset: number; /** * The flag indicating if this assessment is part of report */ report: boolean; /** * The weightage given to this comment */ weight: number; /** * The id of the agent. */ agentId: string; /** * The id of the segment. */ segmentId: string; /** * The name of the user. */ userName: string; /** * The email id of the user. */ userEmail: string; /** * The timestamp when the record is inserted */ timestamp: number; url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; assessmentSid: string; comment: any; offset: number; report: boolean; weight: number; agentId: string; segmentId: string; userName: string; userEmail: string; timestamp: number; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class InsightsAssessmentsCommentPage extends Page<V1, InsightsAssessmentsCommentPayload, InsightsAssessmentsCommentResource, InsightsAssessmentsCommentInstance> { /** * Initialize the InsightsAssessmentsCommentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InsightsAssessmentsCommentSolution); /** * Build an instance of InsightsAssessmentsCommentInstance * * @param payload - Payload response from the API */ getInstance(payload: InsightsAssessmentsCommentResource): InsightsAssessmentsCommentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/pluginArchive.d.ts000064400000012177151677225100013047 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to update a PluginArchiveInstance */ export interface PluginArchiveContextUpdateOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; } export interface PluginArchiveContext { /** * Update a PluginArchiveInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginArchiveInstance */ update(callback?: (error: Error | null, item?: PluginArchiveInstance) => any): Promise<PluginArchiveInstance>; /** * Update a PluginArchiveInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginArchiveInstance */ update(params: PluginArchiveContextUpdateOptions, callback?: (error: Error | null, item?: PluginArchiveInstance) => any): Promise<PluginArchiveInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PluginArchiveContextSolution { sid: string; } export declare class PluginArchiveContextImpl implements PluginArchiveContext { protected _version: V1; protected _solution: PluginArchiveContextSolution; protected _uri: string; constructor(_version: V1, sid: string); update(params?: PluginArchiveContextUpdateOptions | ((error: Error | null, item?: PluginArchiveInstance) => any), callback?: (error: Error | null, item?: PluginArchiveInstance) => any): Promise<PluginArchiveInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PluginArchiveContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PluginArchiveResource { sid: string; account_sid: string; unique_name: string; friendly_name: string; description: string; archived: boolean; date_created: Date; date_updated: Date; url: string; } export declare class PluginArchiveInstance { protected _version: V1; protected _solution: PluginArchiveContextSolution; protected _context?: PluginArchiveContext; constructor(_version: V1, payload: PluginArchiveResource, sid?: string); /** * The unique string that we created to identify the Flex Plugin resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin resource and owns this resource. */ accountSid: string; /** * The name that uniquely identifies this Flex Plugin resource. */ uniqueName: string; /** * The friendly name this Flex Plugin resource. */ friendlyName: string; /** * A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long */ description: string; /** * Whether the Flex Plugin is archived. The default value is false. */ archived: boolean; /** * The date and time in GMT when the Flex Plugin was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the Flex Plugin was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Flex Plugin resource. */ url: string; private get _proxy(); /** * Update a PluginArchiveInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginArchiveInstance */ update(callback?: (error: Error | null, item?: PluginArchiveInstance) => any): Promise<PluginArchiveInstance>; /** * Update a PluginArchiveInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginArchiveInstance */ update(params: PluginArchiveContextUpdateOptions, callback?: (error: Error | null, item?: PluginArchiveInstance) => any): Promise<PluginArchiveInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; uniqueName: string; friendlyName: string; description: string; archived: boolean; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PluginArchiveSolution { } export interface PluginArchiveListInstance { _version: V1; _solution: PluginArchiveSolution; _uri: string; (sid: string): PluginArchiveContext; get(sid: string): PluginArchiveContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PluginArchiveListInstance(version: V1): PluginArchiveListInstance; export {}; rest/flexApi/v1/insightsQuestionnairesQuestion.js000064400000026141151677225100016321 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsQuestionnairesQuestionPage = exports.InsightsQuestionnairesQuestionListInstance = exports.InsightsQuestionnairesQuestionInstance = exports.InsightsQuestionnairesQuestionContextImpl = void 0; 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 InsightsQuestionnairesQuestionContextImpl { constructor(_version, questionSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(questionSid)) { throw new Error("Parameter 'questionSid' is not valid."); } this._solution = { questionSid }; this._uri = `/Insights/QualityManagement/Questions/${questionSid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["allowNa"] === null || params["allowNa"] === undefined) { throw new Error("Required parameter \"params['allowNa']\" missing."); } let data = {}; data["AllowNa"] = serialize.bool(params["allowNa"]); if (params["categorySid"] !== undefined) data["CategorySid"] = params["categorySid"]; if (params["question"] !== undefined) data["Question"] = params["question"]; if (params["description"] !== undefined) data["Description"] = params["description"]; if (params["answerSetId"] !== undefined) data["AnswerSetId"] = params["answerSetId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesQuestionInstance(operationVersion, payload, instance._solution.questionSid)); 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.InsightsQuestionnairesQuestionContextImpl = InsightsQuestionnairesQuestionContextImpl; class InsightsQuestionnairesQuestionInstance { constructor(_version, payload, questionSid) { this._version = _version; this.accountSid = payload.account_sid; this.questionSid = payload.question_sid; this.question = payload.question; this.description = payload.description; this.category = payload.category; this.answerSetId = payload.answer_set_id; this.allowNa = payload.allow_na; this.usage = deserialize.integer(payload.usage); this.answerSet = payload.answer_set; this.url = payload.url; this._solution = { questionSid: questionSid || this.questionSid }; } get _proxy() { this._context = this._context || new InsightsQuestionnairesQuestionContextImpl(this._version, this._solution.questionSid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, questionSid: this.questionSid, question: this.question, description: this.description, category: this.category, answerSetId: this.answerSetId, allowNa: this.allowNa, usage: this.usage, answerSet: this.answerSet, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsQuestionnairesQuestionInstance = InsightsQuestionnairesQuestionInstance; function InsightsQuestionnairesQuestionListInstance(version) { const instance = ((questionSid) => instance.get(questionSid)); instance.get = function get(questionSid) { return new InsightsQuestionnairesQuestionContextImpl(version, questionSid); }; instance._version = version; instance._solution = {}; instance._uri = `/Insights/QualityManagement/Questions`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["categorySid"] === null || params["categorySid"] === undefined) { throw new Error("Required parameter \"params['categorySid']\" missing."); } if (params["question"] === null || params["question"] === undefined) { throw new Error("Required parameter \"params['question']\" missing."); } if (params["answerSetId"] === null || params["answerSetId"] === undefined) { throw new Error("Required parameter \"params['answerSetId']\" missing."); } if (params["allowNa"] === null || params["allowNa"] === undefined) { throw new Error("Required parameter \"params['allowNa']\" missing."); } let data = {}; data["CategorySid"] = params["categorySid"]; data["Question"] = params["question"]; data["AnswerSetId"] = params["answerSetId"]; data["AllowNa"] = serialize.bool(params["allowNa"]); if (params["description"] !== undefined) data["Description"] = params["description"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesQuestionInstance(operationVersion, payload)); 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["categorySid"] !== undefined) data["CategorySid"] = serialize.map(params["categorySid"], (e) => e); 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 = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesQuestionPage(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 InsightsQuestionnairesQuestionPage(instance._version, payload, 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; } exports.InsightsQuestionnairesQuestionListInstance = InsightsQuestionnairesQuestionListInstance; class InsightsQuestionnairesQuestionPage extends Page_1.default { /** * Initialize the InsightsQuestionnairesQuestionPage * * @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 InsightsQuestionnairesQuestionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InsightsQuestionnairesQuestionInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsQuestionnairesQuestionPage = InsightsQuestionnairesQuestionPage; rest/flexApi/v1/pluginConfigurationArchive.d.ts000064400000012425151677225100015573 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to update a PluginConfigurationArchiveInstance */ export interface PluginConfigurationArchiveContextUpdateOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; } export interface PluginConfigurationArchiveContext { /** * Update a PluginConfigurationArchiveInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginConfigurationArchiveInstance */ update(callback?: (error: Error | null, item?: PluginConfigurationArchiveInstance) => any): Promise<PluginConfigurationArchiveInstance>; /** * Update a PluginConfigurationArchiveInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginConfigurationArchiveInstance */ update(params: PluginConfigurationArchiveContextUpdateOptions, callback?: (error: Error | null, item?: PluginConfigurationArchiveInstance) => any): Promise<PluginConfigurationArchiveInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PluginConfigurationArchiveContextSolution { sid: string; } export declare class PluginConfigurationArchiveContextImpl implements PluginConfigurationArchiveContext { protected _version: V1; protected _solution: PluginConfigurationArchiveContextSolution; protected _uri: string; constructor(_version: V1, sid: string); update(params?: PluginConfigurationArchiveContextUpdateOptions | ((error: Error | null, item?: PluginConfigurationArchiveInstance) => any), callback?: (error: Error | null, item?: PluginConfigurationArchiveInstance) => any): Promise<PluginConfigurationArchiveInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PluginConfigurationArchiveContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PluginConfigurationArchiveResource { sid: string; account_sid: string; name: string; description: string; archived: boolean; date_created: Date; url: string; } export declare class PluginConfigurationArchiveInstance { protected _version: V1; protected _solution: PluginConfigurationArchiveContextSolution; protected _context?: PluginConfigurationArchiveContext; constructor(_version: V1, payload: PluginConfigurationArchiveResource, sid?: string); /** * The unique string that we created to identify the Flex Plugin Configuration resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Configuration resource and owns this resource. */ accountSid: string; /** * The name of this Flex Plugin Configuration. */ name: string; /** * The description of the Flex Plugin Configuration resource. */ description: string; /** * Whether the Flex Plugin Configuration is archived. The default value is false. */ archived: boolean; /** * The date and time in GMT when the Flex Plugin Configuration was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Flex Plugin Configuration resource. */ url: string; private get _proxy(); /** * Update a PluginConfigurationArchiveInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginConfigurationArchiveInstance */ update(callback?: (error: Error | null, item?: PluginConfigurationArchiveInstance) => any): Promise<PluginConfigurationArchiveInstance>; /** * Update a PluginConfigurationArchiveInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginConfigurationArchiveInstance */ update(params: PluginConfigurationArchiveContextUpdateOptions, callback?: (error: Error | null, item?: PluginConfigurationArchiveInstance) => any): Promise<PluginConfigurationArchiveInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; name: string; description: string; archived: boolean; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PluginConfigurationArchiveSolution { } export interface PluginConfigurationArchiveListInstance { _version: V1; _solution: PluginConfigurationArchiveSolution; _uri: string; (sid: string): PluginConfigurationArchiveContext; get(sid: string): PluginConfigurationArchiveContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PluginConfigurationArchiveListInstance(version: V1): PluginConfigurationArchiveListInstance; export {}; rest/flexApi/v1/flexFlow.js000064400000034037151677225100011600 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.FlexFlowPage = exports.FlexFlowListInstance = exports.FlexFlowInstance = exports.FlexFlowContextImpl = void 0; 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 FlexFlowContextImpl { 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 = `/FlexFlows/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FlexFlowInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["chatServiceSid"] !== undefined) data["ChatServiceSid"] = params["chatServiceSid"]; if (params["channelType"] !== undefined) data["ChannelType"] = params["channelType"]; if (params["contactIdentity"] !== undefined) data["ContactIdentity"] = params["contactIdentity"]; if (params["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); if (params["integrationType"] !== undefined) data["IntegrationType"] = params["integrationType"]; if (params["integration.flowSid"] !== undefined) data["Integration.FlowSid"] = params["integration.flowSid"]; if (params["integration.url"] !== undefined) data["Integration.Url"] = params["integration.url"]; if (params["integration.workspaceSid"] !== undefined) data["Integration.WorkspaceSid"] = params["integration.workspaceSid"]; if (params["integration.workflowSid"] !== undefined) data["Integration.WorkflowSid"] = params["integration.workflowSid"]; if (params["integration.channel"] !== undefined) data["Integration.Channel"] = params["integration.channel"]; if (params["integration.timeout"] !== undefined) data["Integration.Timeout"] = params["integration.timeout"]; if (params["integration.priority"] !== undefined) data["Integration.Priority"] = params["integration.priority"]; if (params["integration.creationOnMessage"] !== undefined) data["Integration.CreationOnMessage"] = serialize.bool(params["integration.creationOnMessage"]); if (params["longLived"] !== undefined) data["LongLived"] = serialize.bool(params["longLived"]); if (params["janitorEnabled"] !== undefined) data["JanitorEnabled"] = serialize.bool(params["janitorEnabled"]); if (params["integration.retryCount"] !== undefined) data["Integration.RetryCount"] = params["integration.retryCount"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FlexFlowInstance(operationVersion, payload, 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.FlexFlowContextImpl = FlexFlowContextImpl; class FlexFlowInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.chatServiceSid = payload.chat_service_sid; this.channelType = payload.channel_type; this.contactIdentity = payload.contact_identity; this.enabled = payload.enabled; this.integrationType = payload.integration_type; this.integration = payload.integration; this.longLived = payload.long_lived; this.janitorEnabled = payload.janitor_enabled; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new FlexFlowContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a FlexFlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a FlexFlowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FlexFlowInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sid: this.sid, friendlyName: this.friendlyName, chatServiceSid: this.chatServiceSid, channelType: this.channelType, contactIdentity: this.contactIdentity, enabled: this.enabled, integrationType: this.integrationType, integration: this.integration, longLived: this.longLived, janitorEnabled: this.janitorEnabled, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlexFlowInstance = FlexFlowInstance; function FlexFlowListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new FlexFlowContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/FlexFlows`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["chatServiceSid"] === null || params["chatServiceSid"] === undefined) { throw new Error("Required parameter \"params['chatServiceSid']\" missing."); } if (params["channelType"] === null || params["channelType"] === undefined) { throw new Error("Required parameter \"params['channelType']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["ChatServiceSid"] = params["chatServiceSid"]; data["ChannelType"] = params["channelType"]; if (params["contactIdentity"] !== undefined) data["ContactIdentity"] = params["contactIdentity"]; if (params["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); if (params["integrationType"] !== undefined) data["IntegrationType"] = params["integrationType"]; if (params["integration.flowSid"] !== undefined) data["Integration.FlowSid"] = params["integration.flowSid"]; if (params["integration.url"] !== undefined) data["Integration.Url"] = params["integration.url"]; if (params["integration.workspaceSid"] !== undefined) data["Integration.WorkspaceSid"] = params["integration.workspaceSid"]; if (params["integration.workflowSid"] !== undefined) data["Integration.WorkflowSid"] = params["integration.workflowSid"]; if (params["integration.channel"] !== undefined) data["Integration.Channel"] = params["integration.channel"]; if (params["integration.timeout"] !== undefined) data["Integration.Timeout"] = params["integration.timeout"]; if (params["integration.priority"] !== undefined) data["Integration.Priority"] = params["integration.priority"]; if (params["integration.creationOnMessage"] !== undefined) data["Integration.CreationOnMessage"] = serialize.bool(params["integration.creationOnMessage"]); if (params["longLived"] !== undefined) data["LongLived"] = serialize.bool(params["longLived"]); if (params["janitorEnabled"] !== undefined) data["JanitorEnabled"] = serialize.bool(params["janitorEnabled"]); if (params["integration.retryCount"] !== undefined) data["Integration.RetryCount"] = params["integration.retryCount"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FlexFlowInstance(operationVersion, payload)); 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["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new FlexFlowPage(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 FlexFlowPage(instance._version, payload, 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; } exports.FlexFlowListInstance = FlexFlowListInstance; class FlexFlowPage extends Page_1.default { /** * Initialize the FlexFlowPage * * @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 FlexFlowInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new FlexFlowInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FlexFlowPage = FlexFlowPage; rest/flexApi/v1/insightsAssessmentsComment.js000064400000017426151677225100015421 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsAssessmentsCommentPage = exports.InsightsAssessmentsCommentInstance = exports.InsightsAssessmentsCommentListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function InsightsAssessmentsCommentListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Insights/QualityManagement/Assessments/Comments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["categoryId"] === null || params["categoryId"] === undefined) { throw new Error("Required parameter \"params['categoryId']\" missing."); } if (params["categoryName"] === null || params["categoryName"] === undefined) { throw new Error("Required parameter \"params['categoryName']\" missing."); } if (params["comment"] === null || params["comment"] === undefined) { throw new Error("Required parameter \"params['comment']\" missing."); } if (params["segmentId"] === null || params["segmentId"] === undefined) { throw new Error("Required parameter \"params['segmentId']\" missing."); } if (params["agentId"] === null || params["agentId"] === undefined) { throw new Error("Required parameter \"params['agentId']\" missing."); } if (params["offset"] === null || params["offset"] === undefined) { throw new Error("Required parameter \"params['offset']\" missing."); } let data = {}; data["CategoryId"] = params["categoryId"]; data["CategoryName"] = params["categoryName"]; data["Comment"] = params["comment"]; data["SegmentId"] = params["segmentId"]; data["AgentId"] = params["agentId"]; data["Offset"] = params["offset"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsAssessmentsCommentInstance(operationVersion, payload)); 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["segmentId"] !== undefined) data["SegmentId"] = params["segmentId"]; if (params["agentId"] !== undefined) data["AgentId"] = params["agentId"]; 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 = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsAssessmentsCommentPage(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 InsightsAssessmentsCommentPage(instance._version, payload, 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; } exports.InsightsAssessmentsCommentListInstance = InsightsAssessmentsCommentListInstance; class InsightsAssessmentsCommentInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.assessmentSid = payload.assessment_sid; this.comment = payload.comment; this.offset = payload.offset; this.report = payload.report; this.weight = payload.weight; this.agentId = payload.agent_id; this.segmentId = payload.segment_id; this.userName = payload.user_name; this.userEmail = payload.user_email; this.timestamp = payload.timestamp; this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, assessmentSid: this.assessmentSid, comment: this.comment, offset: this.offset, report: this.report, weight: this.weight, agentId: this.agentId, segmentId: this.segmentId, userName: this.userName, userEmail: this.userEmail, timestamp: this.timestamp, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsAssessmentsCommentInstance = InsightsAssessmentsCommentInstance; class InsightsAssessmentsCommentPage extends Page_1.default { /** * Initialize the InsightsAssessmentsCommentPage * * @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 InsightsAssessmentsCommentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InsightsAssessmentsCommentInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsAssessmentsCommentPage = InsightsAssessmentsCommentPage; rest/flexApi/v1/insightsSettingsComment.d.ts000064400000004400151677225100015131 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to fetch a InsightsSettingsCommentInstance */ export interface InsightsSettingsCommentListInstanceFetchOptions { /** The Authorization HTTP request header */ authorization?: string; } export interface InsightsSettingsCommentSolution { } export interface InsightsSettingsCommentListInstance { _version: V1; _solution: InsightsSettingsCommentSolution; _uri: string; /** * Fetch a InsightsSettingsCommentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsSettingsCommentInstance */ fetch(callback?: (error: Error | null, item?: InsightsSettingsCommentInstance) => any): Promise<InsightsSettingsCommentInstance>; /** * Fetch a InsightsSettingsCommentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsSettingsCommentInstance */ fetch(params: InsightsSettingsCommentListInstanceFetchOptions, callback?: (error: Error | null, item?: InsightsSettingsCommentInstance) => any): Promise<InsightsSettingsCommentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsSettingsCommentListInstance(version: V1): InsightsSettingsCommentListInstance; interface InsightsSettingsCommentResource { account_sid: string; comments: any; url: string; } export declare class InsightsSettingsCommentInstance { protected _version: V1; constructor(_version: V1, payload: InsightsSettingsCommentResource); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. */ accountSid: string; comments: any; url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; comments: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/insightsQuestionnairesCategory.js000064400000022333151677225100016266 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsQuestionnairesCategoryPage = exports.InsightsQuestionnairesCategoryListInstance = exports.InsightsQuestionnairesCategoryInstance = exports.InsightsQuestionnairesCategoryContextImpl = void 0; 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 InsightsQuestionnairesCategoryContextImpl { constructor(_version, categorySid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(categorySid)) { throw new Error("Parameter 'categorySid' is not valid."); } this._solution = { categorySid }; this._uri = `/Insights/QualityManagement/Categories/${categorySid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["name"] === null || params["name"] === undefined) { throw new Error("Required parameter \"params['name']\" missing."); } let data = {}; data["Name"] = params["name"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesCategoryInstance(operationVersion, payload, instance._solution.categorySid)); 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.InsightsQuestionnairesCategoryContextImpl = InsightsQuestionnairesCategoryContextImpl; class InsightsQuestionnairesCategoryInstance { constructor(_version, payload, categorySid) { this._version = _version; this.accountSid = payload.account_sid; this.categorySid = payload.category_sid; this.name = payload.name; this.url = payload.url; this._solution = { categorySid: categorySid || this.categorySid }; } get _proxy() { this._context = this._context || new InsightsQuestionnairesCategoryContextImpl(this._version, this._solution.categorySid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, categorySid: this.categorySid, name: this.name, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsQuestionnairesCategoryInstance = InsightsQuestionnairesCategoryInstance; function InsightsQuestionnairesCategoryListInstance(version) { const instance = ((categorySid) => instance.get(categorySid)); instance.get = function get(categorySid) { return new InsightsQuestionnairesCategoryContextImpl(version, categorySid); }; instance._version = version; instance._solution = {}; instance._uri = `/Insights/QualityManagement/Categories`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["name"] === null || params["name"] === undefined) { throw new Error("Required parameter \"params['name']\" missing."); } let data = {}; data["Name"] = params["name"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesCategoryInstance(operationVersion, payload)); 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 = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesCategoryPage(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 InsightsQuestionnairesCategoryPage(instance._version, payload, 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; } exports.InsightsQuestionnairesCategoryListInstance = InsightsQuestionnairesCategoryListInstance; class InsightsQuestionnairesCategoryPage extends Page_1.default { /** * Initialize the InsightsQuestionnairesCategoryPage * * @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 InsightsQuestionnairesCategoryInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InsightsQuestionnairesCategoryInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsQuestionnairesCategoryPage = InsightsQuestionnairesCategoryPage; rest/flexApi/v1/pluginVersionArchive.d.ts000064400000013205151677225100014406 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to update a PluginVersionArchiveInstance */ export interface PluginVersionArchiveContextUpdateOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; } export interface PluginVersionArchiveContext { /** * Update a PluginVersionArchiveInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginVersionArchiveInstance */ update(callback?: (error: Error | null, item?: PluginVersionArchiveInstance) => any): Promise<PluginVersionArchiveInstance>; /** * Update a PluginVersionArchiveInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginVersionArchiveInstance */ update(params: PluginVersionArchiveContextUpdateOptions, callback?: (error: Error | null, item?: PluginVersionArchiveInstance) => any): Promise<PluginVersionArchiveInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PluginVersionArchiveContextSolution { pluginSid: string; sid: string; } export declare class PluginVersionArchiveContextImpl implements PluginVersionArchiveContext { protected _version: V1; protected _solution: PluginVersionArchiveContextSolution; protected _uri: string; constructor(_version: V1, pluginSid: string, sid: string); update(params?: PluginVersionArchiveContextUpdateOptions | ((error: Error | null, item?: PluginVersionArchiveInstance) => any), callback?: (error: Error | null, item?: PluginVersionArchiveInstance) => any): Promise<PluginVersionArchiveInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PluginVersionArchiveContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PluginVersionArchiveResource { sid: string; plugin_sid: string; account_sid: string; version: string; plugin_url: string; changelog: string; private: boolean; archived: boolean; date_created: Date; url: string; } export declare class PluginVersionArchiveInstance { protected _version: V1; protected _solution: PluginVersionArchiveContextSolution; protected _context?: PluginVersionArchiveContext; constructor(_version: V1, payload: PluginVersionArchiveResource, pluginSid?: string, sid?: string); /** * The unique string that we created to identify the Flex Plugin Version resource. */ sid: string; /** * The SID of the Flex Plugin resource this Flex Plugin Version belongs to. */ pluginSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Version resource and owns this resource. */ accountSid: string; /** * The unique version of this Flex Plugin Version. */ version: string; /** * The URL of where the Flex Plugin Version JavaScript bundle is hosted on. */ pluginUrl: string; /** * A changelog that describes the changes this Flex Plugin Version brings. */ changelog: string; /** * Whether to inject credentials while accessing this Plugin Version. The default value is false. */ _private: boolean; /** * Whether the Flex Plugin Version is archived. The default value is false. */ archived: boolean; /** * The date and time in GMT when the Flex Plugin Version was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Flex Plugin Version resource. */ url: string; private get _proxy(); /** * Update a PluginVersionArchiveInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginVersionArchiveInstance */ update(callback?: (error: Error | null, item?: PluginVersionArchiveInstance) => any): Promise<PluginVersionArchiveInstance>; /** * Update a PluginVersionArchiveInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginVersionArchiveInstance */ update(params: PluginVersionArchiveContextUpdateOptions, callback?: (error: Error | null, item?: PluginVersionArchiveInstance) => any): Promise<PluginVersionArchiveInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; pluginSid: string; accountSid: string; version: string; pluginUrl: string; changelog: string; _private: boolean; archived: boolean; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PluginVersionArchiveSolution { } export interface PluginVersionArchiveListInstance { _version: V1; _solution: PluginVersionArchiveSolution; _uri: string; (pluginSid: string, sid: string): PluginVersionArchiveContext; get(pluginSid: string, sid: string): PluginVersionArchiveContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PluginVersionArchiveListInstance(version: V1): PluginVersionArchiveListInstance; export {}; rest/flexApi/v1/insightsUserRoles.js000064400000007067151677225100013511 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsUserRolesListInstance = exports.InsightsUserRolesInstance = exports.InsightsUserRolesContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class InsightsUserRolesContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/Insights/UserRoles`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsUserRolesInstance(operationVersion, payload)); 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.InsightsUserRolesContextImpl = InsightsUserRolesContextImpl; class InsightsUserRolesInstance { constructor(_version, payload) { this._version = _version; this.roles = payload.roles; this.url = payload.url; this._solution = {}; } get _proxy() { this._context = this._context || new InsightsUserRolesContextImpl(this._version); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { roles: this.roles, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsUserRolesInstance = InsightsUserRolesInstance; function InsightsUserRolesListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new InsightsUserRolesContextImpl(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; } exports.InsightsUserRolesListInstance = InsightsUserRolesListInstance; rest/flexApi/v1/insightsConversations.js000064400000011547151677225100014421 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsConversationsPage = exports.InsightsConversationsInstance = exports.InsightsConversationsListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function InsightsConversationsListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Insights/Conversations`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["segmentId"] !== undefined) data["SegmentId"] = params["segmentId"]; 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 = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsConversationsPage(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 InsightsConversationsPage(instance._version, payload, 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; } exports.InsightsConversationsListInstance = InsightsConversationsListInstance; class InsightsConversationsInstance { constructor(_version, payload) { this._version = _version; this.accountId = payload.account_id; this.conversationId = payload.conversation_id; this.segmentCount = deserialize.integer(payload.segment_count); this.segments = payload.segments; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountId: this.accountId, conversationId: this.conversationId, segmentCount: this.segmentCount, segments: this.segments, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsConversationsInstance = InsightsConversationsInstance; class InsightsConversationsPage extends Page_1.default { /** * Initialize the InsightsConversationsPage * * @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 InsightsConversationsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InsightsConversationsInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsConversationsPage = InsightsConversationsPage; rest/flexApi/v1/insightsQuestionnairesCategory.d.ts000064400000030167151677225100016526 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to remove a InsightsQuestionnairesCategoryInstance */ export interface InsightsQuestionnairesCategoryContextRemoveOptions { /** The Authorization HTTP request header */ authorization?: string; } /** * Options to pass to update a InsightsQuestionnairesCategoryInstance */ export interface InsightsQuestionnairesCategoryContextUpdateOptions { /** The name of this category. */ name: string; /** The Authorization HTTP request header */ authorization?: string; } /** * Options to pass to create a InsightsQuestionnairesCategoryInstance */ export interface InsightsQuestionnairesCategoryListInstanceCreateOptions { /** The name of this category. */ name: string; /** The Authorization HTTP request header */ authorization?: string; } /** * Options to pass to each */ export interface InsightsQuestionnairesCategoryListInstanceEachOptions { /** The Authorization HTTP request header */ authorization?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InsightsQuestionnairesCategoryInstance, 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 InsightsQuestionnairesCategoryListInstanceOptions { /** The Authorization HTTP request header */ authorization?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InsightsQuestionnairesCategoryListInstancePageOptions { /** The Authorization HTTP request header */ authorization?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InsightsQuestionnairesCategoryContext { /** * Remove a InsightsQuestionnairesCategoryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a InsightsQuestionnairesCategoryInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesCategoryInstance */ remove(params: InsightsQuestionnairesCategoryContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Update a InsightsQuestionnairesCategoryInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesCategoryInstance */ update(params: InsightsQuestionnairesCategoryContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesCategoryInstance) => any): Promise<InsightsQuestionnairesCategoryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InsightsQuestionnairesCategoryContextSolution { categorySid: string; } export declare class InsightsQuestionnairesCategoryContextImpl implements InsightsQuestionnairesCategoryContext { protected _version: V1; protected _solution: InsightsQuestionnairesCategoryContextSolution; protected _uri: string; constructor(_version: V1, categorySid: string); remove(params?: InsightsQuestionnairesCategoryContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; update(params: InsightsQuestionnairesCategoryContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesCategoryInstance) => any): Promise<InsightsQuestionnairesCategoryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InsightsQuestionnairesCategoryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InsightsQuestionnairesCategoryPayload extends TwilioResponsePayload { categories: InsightsQuestionnairesCategoryResource[]; } interface InsightsQuestionnairesCategoryResource { account_sid: string; category_sid: string; name: string; url: string; } export declare class InsightsQuestionnairesCategoryInstance { protected _version: V1; protected _solution: InsightsQuestionnairesCategoryContextSolution; protected _context?: InsightsQuestionnairesCategoryContext; constructor(_version: V1, payload: InsightsQuestionnairesCategoryResource, categorySid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. */ accountSid: string; /** * The SID of the category */ categorySid: string; /** * The name of this category. */ name: string; url: string; private get _proxy(); /** * Remove a InsightsQuestionnairesCategoryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a InsightsQuestionnairesCategoryInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesCategoryInstance */ remove(params: InsightsQuestionnairesCategoryContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Update a InsightsQuestionnairesCategoryInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesCategoryInstance */ update(params: InsightsQuestionnairesCategoryContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesCategoryInstance) => any): Promise<InsightsQuestionnairesCategoryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; categorySid: string; name: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InsightsQuestionnairesCategorySolution { } export interface InsightsQuestionnairesCategoryListInstance { _version: V1; _solution: InsightsQuestionnairesCategorySolution; _uri: string; (categorySid: string): InsightsQuestionnairesCategoryContext; get(categorySid: string): InsightsQuestionnairesCategoryContext; /** * Create a InsightsQuestionnairesCategoryInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesCategoryInstance */ create(params: InsightsQuestionnairesCategoryListInstanceCreateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesCategoryInstance) => any): Promise<InsightsQuestionnairesCategoryInstance>; /** * Streams InsightsQuestionnairesCategoryInstance 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 { InsightsQuestionnairesCategoryListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InsightsQuestionnairesCategoryInstance, done: (err?: Error) => void) => void): void; each(params: InsightsQuestionnairesCategoryListInstanceEachOptions, callback?: (item: InsightsQuestionnairesCategoryInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InsightsQuestionnairesCategoryInstance 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: InsightsQuestionnairesCategoryPage) => any): Promise<InsightsQuestionnairesCategoryPage>; /** * Lists InsightsQuestionnairesCategoryInstance 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 { InsightsQuestionnairesCategoryListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InsightsQuestionnairesCategoryInstance[]) => any): Promise<InsightsQuestionnairesCategoryInstance[]>; list(params: InsightsQuestionnairesCategoryListInstanceOptions, callback?: (error: Error | null, items: InsightsQuestionnairesCategoryInstance[]) => any): Promise<InsightsQuestionnairesCategoryInstance[]>; /** * Retrieve a single page of InsightsQuestionnairesCategoryInstance 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 { InsightsQuestionnairesCategoryListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InsightsQuestionnairesCategoryPage) => any): Promise<InsightsQuestionnairesCategoryPage>; page(params: InsightsQuestionnairesCategoryListInstancePageOptions, callback?: (error: Error | null, items: InsightsQuestionnairesCategoryPage) => any): Promise<InsightsQuestionnairesCategoryPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsQuestionnairesCategoryListInstance(version: V1): InsightsQuestionnairesCategoryListInstance; export declare class InsightsQuestionnairesCategoryPage extends Page<V1, InsightsQuestionnairesCategoryPayload, InsightsQuestionnairesCategoryResource, InsightsQuestionnairesCategoryInstance> { /** * Initialize the InsightsQuestionnairesCategoryPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InsightsQuestionnairesCategorySolution); /** * Build an instance of InsightsQuestionnairesCategoryInstance * * @param payload - Payload response from the API */ getInstance(payload: InsightsQuestionnairesCategoryResource): InsightsQuestionnairesCategoryInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/insightsQuestionnaires.d.ts000064400000035253151677225100015031 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to remove a InsightsQuestionnairesInstance */ export interface InsightsQuestionnairesContextRemoveOptions { /** The Authorization HTTP request header */ authorization?: string; } /** * Options to pass to fetch a InsightsQuestionnairesInstance */ export interface InsightsQuestionnairesContextFetchOptions { /** The Authorization HTTP request header */ authorization?: string; } /** * Options to pass to update a InsightsQuestionnairesInstance */ export interface InsightsQuestionnairesContextUpdateOptions { /** The flag to enable or disable questionnaire */ active: boolean; /** The Authorization HTTP request header */ authorization?: string; /** The name of this questionnaire */ name?: string; /** The description of this questionnaire */ description?: string; /** The list of questions sids under a questionnaire */ questionSids?: Array<string>; } /** * Options to pass to create a InsightsQuestionnairesInstance */ export interface InsightsQuestionnairesListInstanceCreateOptions { /** The name of this questionnaire */ name: string; /** The Authorization HTTP request header */ authorization?: string; /** The description of this questionnaire */ description?: string; /** The flag to enable or disable questionnaire */ active?: boolean; /** The list of questions sids under a questionnaire */ questionSids?: Array<string>; } /** * Options to pass to each */ export interface InsightsQuestionnairesListInstanceEachOptions { /** The Authorization HTTP request header */ authorization?: string; /** Flag indicating whether to include inactive questionnaires or not */ includeInactive?: boolean; /** 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: InsightsQuestionnairesInstance, 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 InsightsQuestionnairesListInstanceOptions { /** The Authorization HTTP request header */ authorization?: string; /** Flag indicating whether to include inactive questionnaires or not */ includeInactive?: boolean; /** 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 InsightsQuestionnairesListInstancePageOptions { /** The Authorization HTTP request header */ authorization?: string; /** Flag indicating whether to include inactive questionnaires or not */ includeInactive?: boolean; /** 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 InsightsQuestionnairesContext { /** * Remove a InsightsQuestionnairesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a InsightsQuestionnairesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesInstance */ remove(params: InsightsQuestionnairesContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InsightsQuestionnairesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesInstance */ fetch(callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>; /** * Fetch a InsightsQuestionnairesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesInstance */ fetch(params: InsightsQuestionnairesContextFetchOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>; /** * Update a InsightsQuestionnairesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesInstance */ update(params: InsightsQuestionnairesContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InsightsQuestionnairesContextSolution { questionnaireSid: string; } export declare class InsightsQuestionnairesContextImpl implements InsightsQuestionnairesContext { protected _version: V1; protected _solution: InsightsQuestionnairesContextSolution; protected _uri: string; constructor(_version: V1, questionnaireSid: string); remove(params?: InsightsQuestionnairesContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(params?: InsightsQuestionnairesContextFetchOptions | ((error: Error | null, item?: InsightsQuestionnairesInstance) => any), callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>; update(params: InsightsQuestionnairesContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InsightsQuestionnairesContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InsightsQuestionnairesPayload extends TwilioResponsePayload { questionnaires: InsightsQuestionnairesResource[]; } interface InsightsQuestionnairesResource { account_sid: string; questionnaire_sid: string; name: string; description: string; active: boolean; questions: Array<any>; url: string; } export declare class InsightsQuestionnairesInstance { protected _version: V1; protected _solution: InsightsQuestionnairesContextSolution; protected _context?: InsightsQuestionnairesContext; constructor(_version: V1, payload: InsightsQuestionnairesResource, questionnaireSid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. */ accountSid: string; /** * The sid of this questionnaire */ questionnaireSid: string; /** * The name of this category. */ name: string; /** * The description of this questionnaire */ description: string; /** * The flag to enable or disable questionnaire */ active: boolean; /** * The list of questions with category for a questionnaire */ questions: Array<any>; url: string; private get _proxy(); /** * Remove a InsightsQuestionnairesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a InsightsQuestionnairesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesInstance */ remove(params: InsightsQuestionnairesContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a InsightsQuestionnairesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesInstance */ fetch(callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>; /** * Fetch a InsightsQuestionnairesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesInstance */ fetch(params: InsightsQuestionnairesContextFetchOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>; /** * Update a InsightsQuestionnairesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesInstance */ update(params: InsightsQuestionnairesContextUpdateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; questionnaireSid: string; name: string; description: string; active: boolean; questions: any[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InsightsQuestionnairesSolution { } export interface InsightsQuestionnairesListInstance { _version: V1; _solution: InsightsQuestionnairesSolution; _uri: string; (questionnaireSid: string): InsightsQuestionnairesContext; get(questionnaireSid: string): InsightsQuestionnairesContext; /** * Create a InsightsQuestionnairesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsQuestionnairesInstance */ create(params: InsightsQuestionnairesListInstanceCreateOptions, callback?: (error: Error | null, item?: InsightsQuestionnairesInstance) => any): Promise<InsightsQuestionnairesInstance>; /** * Streams InsightsQuestionnairesInstance 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 { InsightsQuestionnairesListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InsightsQuestionnairesInstance, done: (err?: Error) => void) => void): void; each(params: InsightsQuestionnairesListInstanceEachOptions, callback?: (item: InsightsQuestionnairesInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InsightsQuestionnairesInstance 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: InsightsQuestionnairesPage) => any): Promise<InsightsQuestionnairesPage>; /** * Lists InsightsQuestionnairesInstance 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 { InsightsQuestionnairesListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InsightsQuestionnairesInstance[]) => any): Promise<InsightsQuestionnairesInstance[]>; list(params: InsightsQuestionnairesListInstanceOptions, callback?: (error: Error | null, items: InsightsQuestionnairesInstance[]) => any): Promise<InsightsQuestionnairesInstance[]>; /** * Retrieve a single page of InsightsQuestionnairesInstance 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 { InsightsQuestionnairesListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InsightsQuestionnairesPage) => any): Promise<InsightsQuestionnairesPage>; page(params: InsightsQuestionnairesListInstancePageOptions, callback?: (error: Error | null, items: InsightsQuestionnairesPage) => any): Promise<InsightsQuestionnairesPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsQuestionnairesListInstance(version: V1): InsightsQuestionnairesListInstance; export declare class InsightsQuestionnairesPage extends Page<V1, InsightsQuestionnairesPayload, InsightsQuestionnairesResource, InsightsQuestionnairesInstance> { /** * Initialize the InsightsQuestionnairesPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InsightsQuestionnairesSolution); /** * Build an instance of InsightsQuestionnairesInstance * * @param payload - Payload response from the API */ getInstance(payload: InsightsQuestionnairesResource): InsightsQuestionnairesInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.d.ts000064400000025421151677225100024401 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type InteractionChannelParticipantStatus = "closed" | "wrapup"; export type InteractionChannelParticipantType = "supervisor" | "customer" | "external" | "agent" | "unknown"; /** * Options to pass to update a InteractionChannelParticipantInstance */ export interface InteractionChannelParticipantContextUpdateOptions { /** */ status: InteractionChannelParticipantStatus; } /** * Options to pass to create a InteractionChannelParticipantInstance */ export interface InteractionChannelParticipantListInstanceCreateOptions { /** */ type: InteractionChannelParticipantType; /** JSON representing the Media Properties for the new Participant. */ mediaProperties: any; /** Object representing the Routing Properties for the new Participant. */ routingProperties?: any; } /** * Options to pass to each */ export interface InteractionChannelParticipantListInstanceEachOptions { /** 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: InteractionChannelParticipantInstance, 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 InteractionChannelParticipantListInstanceOptions { /** 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 InteractionChannelParticipantListInstancePageOptions { /** 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 InteractionChannelParticipantContext { /** * Update a InteractionChannelParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionChannelParticipantInstance */ update(params: InteractionChannelParticipantContextUpdateOptions, callback?: (error: Error | null, item?: InteractionChannelParticipantInstance) => any): Promise<InteractionChannelParticipantInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InteractionChannelParticipantContextSolution { interactionSid: string; channelSid: string; sid: string; } export declare class InteractionChannelParticipantContextImpl implements InteractionChannelParticipantContext { protected _version: V1; protected _solution: InteractionChannelParticipantContextSolution; protected _uri: string; constructor(_version: V1, interactionSid: string, channelSid: string, sid: string); update(params: InteractionChannelParticipantContextUpdateOptions, callback?: (error: Error | null, item?: InteractionChannelParticipantInstance) => any): Promise<InteractionChannelParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InteractionChannelParticipantContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InteractionChannelParticipantPayload extends TwilioResponsePayload { participants: InteractionChannelParticipantResource[]; } interface InteractionChannelParticipantResource { sid: string; type: InteractionChannelParticipantType; interaction_sid: string; channel_sid: string; url: string; routing_properties: any; } export declare class InteractionChannelParticipantInstance { protected _version: V1; protected _solution: InteractionChannelParticipantContextSolution; protected _context?: InteractionChannelParticipantContext; constructor(_version: V1, payload: InteractionChannelParticipantResource, interactionSid: string, channelSid: string, sid?: string); /** * The unique string created by Twilio to identify an Interaction Channel Participant resource. */ sid: string; type: InteractionChannelParticipantType; /** * The Interaction Sid for this channel. */ interactionSid: string; /** * The Channel Sid for this Participant. */ channelSid: string; url: string; /** * The Participant\'s routing properties. */ routingProperties: any; private get _proxy(); /** * Update a InteractionChannelParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionChannelParticipantInstance */ update(params: InteractionChannelParticipantContextUpdateOptions, callback?: (error: Error | null, item?: InteractionChannelParticipantInstance) => any): Promise<InteractionChannelParticipantInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; type: InteractionChannelParticipantType; interactionSid: string; channelSid: string; url: string; routingProperties: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InteractionChannelParticipantSolution { interactionSid: string; channelSid: string; } export interface InteractionChannelParticipantListInstance { _version: V1; _solution: InteractionChannelParticipantSolution; _uri: string; (sid: string): InteractionChannelParticipantContext; get(sid: string): InteractionChannelParticipantContext; /** * Create a InteractionChannelParticipantInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionChannelParticipantInstance */ create(params: InteractionChannelParticipantListInstanceCreateOptions, callback?: (error: Error | null, item?: InteractionChannelParticipantInstance) => any): Promise<InteractionChannelParticipantInstance>; /** * Streams InteractionChannelParticipantInstance 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 { InteractionChannelParticipantListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InteractionChannelParticipantInstance, done: (err?: Error) => void) => void): void; each(params: InteractionChannelParticipantListInstanceEachOptions, callback?: (item: InteractionChannelParticipantInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InteractionChannelParticipantInstance 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: InteractionChannelParticipantPage) => any): Promise<InteractionChannelParticipantPage>; /** * Lists InteractionChannelParticipantInstance 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 { InteractionChannelParticipantListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InteractionChannelParticipantInstance[]) => any): Promise<InteractionChannelParticipantInstance[]>; list(params: InteractionChannelParticipantListInstanceOptions, callback?: (error: Error | null, items: InteractionChannelParticipantInstance[]) => any): Promise<InteractionChannelParticipantInstance[]>; /** * Retrieve a single page of InteractionChannelParticipantInstance 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 { InteractionChannelParticipantListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InteractionChannelParticipantPage) => any): Promise<InteractionChannelParticipantPage>; page(params: InteractionChannelParticipantListInstancePageOptions, callback?: (error: Error | null, items: InteractionChannelParticipantPage) => any): Promise<InteractionChannelParticipantPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InteractionChannelParticipantListInstance(version: V1, interactionSid: string, channelSid: string): InteractionChannelParticipantListInstance; export declare class InteractionChannelParticipantPage extends Page<V1, InteractionChannelParticipantPayload, InteractionChannelParticipantResource, InteractionChannelParticipantInstance> { /** * Initialize the InteractionChannelParticipantPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InteractionChannelParticipantSolution); /** * Build an instance of InteractionChannelParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload: InteractionChannelParticipantResource): InteractionChannelParticipantInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.d.ts000064400000020100151677225100023346 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to create a InteractionChannelInviteInstance */ export interface InteractionChannelInviteListInstanceCreateOptions { /** The Interaction\\\'s routing logic. */ routing: any; } /** * Options to pass to each */ export interface InteractionChannelInviteListInstanceEachOptions { /** 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: InteractionChannelInviteInstance, 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 InteractionChannelInviteListInstanceOptions { /** 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 InteractionChannelInviteListInstancePageOptions { /** 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 InteractionChannelInviteSolution { interactionSid: string; channelSid: string; } export interface InteractionChannelInviteListInstance { _version: V1; _solution: InteractionChannelInviteSolution; _uri: string; /** * Create a InteractionChannelInviteInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionChannelInviteInstance */ create(params: InteractionChannelInviteListInstanceCreateOptions, callback?: (error: Error | null, item?: InteractionChannelInviteInstance) => any): Promise<InteractionChannelInviteInstance>; /** * Streams InteractionChannelInviteInstance 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 { InteractionChannelInviteListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InteractionChannelInviteInstance, done: (err?: Error) => void) => void): void; each(params: InteractionChannelInviteListInstanceEachOptions, callback?: (item: InteractionChannelInviteInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InteractionChannelInviteInstance 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: InteractionChannelInvitePage) => any): Promise<InteractionChannelInvitePage>; /** * Lists InteractionChannelInviteInstance 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 { InteractionChannelInviteListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InteractionChannelInviteInstance[]) => any): Promise<InteractionChannelInviteInstance[]>; list(params: InteractionChannelInviteListInstanceOptions, callback?: (error: Error | null, items: InteractionChannelInviteInstance[]) => any): Promise<InteractionChannelInviteInstance[]>; /** * Retrieve a single page of InteractionChannelInviteInstance 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 { InteractionChannelInviteListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InteractionChannelInvitePage) => any): Promise<InteractionChannelInvitePage>; page(params: InteractionChannelInviteListInstancePageOptions, callback?: (error: Error | null, items: InteractionChannelInvitePage) => any): Promise<InteractionChannelInvitePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InteractionChannelInviteListInstance(version: V1, interactionSid: string, channelSid: string): InteractionChannelInviteListInstance; interface InteractionChannelInvitePayload extends TwilioResponsePayload { invites: InteractionChannelInviteResource[]; } interface InteractionChannelInviteResource { sid: string; interaction_sid: string; channel_sid: string; routing: any; url: string; } export declare class InteractionChannelInviteInstance { protected _version: V1; constructor(_version: V1, payload: InteractionChannelInviteResource, interactionSid: string, channelSid: string); /** * The unique string created by Twilio to identify an Interaction Channel Invite resource. */ sid: string; /** * The Interaction SID for this Channel. */ interactionSid: string; /** * The Channel SID for this Invite. */ channelSid: string; /** * A JSON object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). */ routing: any; url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; interactionSid: string; channelSid: string; routing: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class InteractionChannelInvitePage extends Page<V1, InteractionChannelInvitePayload, InteractionChannelInviteResource, InteractionChannelInviteInstance> { /** * Initialize the InteractionChannelInvitePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InteractionChannelInviteSolution); /** * Build an instance of InteractionChannelInviteInstance * * @param payload - Payload response from the API */ getInstance(payload: InteractionChannelInviteResource): InteractionChannelInviteInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/interaction/interactionChannel/interactionChannelInvite.js000064400000014370151677225100023126 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InteractionChannelInvitePage = exports.InteractionChannelInviteInstance = exports.InteractionChannelInviteListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function InteractionChannelInviteListInstance(version, interactionSid, channelSid) { if (!(0, utility_1.isValidPathParam)(interactionSid)) { throw new Error("Parameter 'interactionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { interactionSid, channelSid }; instance._uri = `/Interactions/${interactionSid}/Channels/${channelSid}/Invites`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["routing"] === null || params["routing"] === undefined) { throw new Error("Required parameter \"params['routing']\" missing."); } let data = {}; data["Routing"] = serialize.object(params["routing"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InteractionChannelInviteInstance(operationVersion, payload, instance._solution.interactionSid, instance._solution.channelSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InteractionChannelInvitePage(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 InteractionChannelInvitePage(instance._version, payload, 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; } exports.InteractionChannelInviteListInstance = InteractionChannelInviteListInstance; class InteractionChannelInviteInstance { constructor(_version, payload, interactionSid, channelSid) { this._version = _version; this.sid = payload.sid; this.interactionSid = payload.interaction_sid; this.channelSid = payload.channel_sid; this.routing = payload.routing; this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, interactionSid: this.interactionSid, channelSid: this.channelSid, routing: this.routing, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InteractionChannelInviteInstance = InteractionChannelInviteInstance; class InteractionChannelInvitePage extends Page_1.default { /** * Initialize the InteractionChannelInvitePage * * @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 InteractionChannelInviteInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InteractionChannelInviteInstance(this._version, payload, this._solution.interactionSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InteractionChannelInvitePage = InteractionChannelInvitePage; rest/flexApi/v1/interaction/interactionChannel/interactionChannelParticipant.js000064400000023120151677225100024137 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InteractionChannelParticipantPage = exports.InteractionChannelParticipantListInstance = exports.InteractionChannelParticipantInstance = exports.InteractionChannelParticipantContextImpl = void 0; 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 InteractionChannelParticipantContextImpl { constructor(_version, interactionSid, channelSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(interactionSid)) { throw new Error("Parameter 'interactionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { interactionSid, channelSid, sid }; this._uri = `/Interactions/${interactionSid}/Channels/${channelSid}/Participants/${sid}`; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InteractionChannelParticipantInstance(operationVersion, payload, instance._solution.interactionSid, instance._solution.channelSid, 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.InteractionChannelParticipantContextImpl = InteractionChannelParticipantContextImpl; class InteractionChannelParticipantInstance { constructor(_version, payload, interactionSid, channelSid, sid) { this._version = _version; this.sid = payload.sid; this.type = payload.type; this.interactionSid = payload.interaction_sid; this.channelSid = payload.channel_sid; this.url = payload.url; this.routingProperties = payload.routing_properties; this._solution = { interactionSid, channelSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InteractionChannelParticipantContextImpl(this._version, this._solution.interactionSid, this._solution.channelSid, this._solution.sid); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, type: this.type, interactionSid: this.interactionSid, channelSid: this.channelSid, url: this.url, routingProperties: this.routingProperties, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InteractionChannelParticipantInstance = InteractionChannelParticipantInstance; function InteractionChannelParticipantListInstance(version, interactionSid, channelSid) { if (!(0, utility_1.isValidPathParam)(interactionSid)) { throw new Error("Parameter 'interactionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(channelSid)) { throw new Error("Parameter 'channelSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InteractionChannelParticipantContextImpl(version, interactionSid, channelSid, sid); }; instance._version = version; instance._solution = { interactionSid, channelSid }; instance._uri = `/Interactions/${interactionSid}/Channels/${channelSid}/Participants`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } if (params["mediaProperties"] === null || params["mediaProperties"] === undefined) { throw new Error("Required parameter \"params['mediaProperties']\" missing."); } let data = {}; data["Type"] = params["type"]; data["MediaProperties"] = serialize.object(params["mediaProperties"]); if (params["routingProperties"] !== undefined) data["RoutingProperties"] = serialize.object(params["routingProperties"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InteractionChannelParticipantInstance(operationVersion, payload, instance._solution.interactionSid, instance._solution.channelSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InteractionChannelParticipantPage(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 InteractionChannelParticipantPage(instance._version, payload, 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; } exports.InteractionChannelParticipantListInstance = InteractionChannelParticipantListInstance; class InteractionChannelParticipantPage extends Page_1.default { /** * Initialize the InteractionChannelParticipantPage * * @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 InteractionChannelParticipantInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InteractionChannelParticipantInstance(this._version, payload, this._solution.interactionSid, this._solution.channelSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InteractionChannelParticipantPage = InteractionChannelParticipantPage; rest/flexApi/v1/interaction/interactionChannel.d.ts000064400000026273151677225100016400 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { InteractionChannelInviteListInstance } from "./interactionChannel/interactionChannelInvite"; import { InteractionChannelParticipantListInstance } from "./interactionChannel/interactionChannelParticipant"; export type InteractionChannelChannelStatus = "setup" | "active" | "failed" | "closed" | "inactive"; export type InteractionChannelType = "voice" | "sms" | "email" | "web" | "whatsapp" | "chat" | "messenger" | "gbm"; export type InteractionChannelUpdateChannelStatus = "closed" | "inactive"; /** * Options to pass to update a InteractionChannelInstance */ export interface InteractionChannelContextUpdateOptions { /** */ status: InteractionChannelUpdateChannelStatus; /** It changes the state of associated tasks. Routing status is required, When the channel status is set to `inactive`. Allowed Value for routing status is `closed`. Otherwise Optional, if not specified, all tasks will be set to `wrapping`. */ routing?: any; } /** * Options to pass to each */ export interface InteractionChannelListInstanceEachOptions { /** 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: InteractionChannelInstance, 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 InteractionChannelListInstanceOptions { /** 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 InteractionChannelListInstancePageOptions { /** 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 InteractionChannelContext { invites: InteractionChannelInviteListInstance; participants: InteractionChannelParticipantListInstance; /** * Fetch a InteractionChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionChannelInstance */ fetch(callback?: (error: Error | null, item?: InteractionChannelInstance) => any): Promise<InteractionChannelInstance>; /** * Update a InteractionChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionChannelInstance */ update(params: InteractionChannelContextUpdateOptions, callback?: (error: Error | null, item?: InteractionChannelInstance) => any): Promise<InteractionChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InteractionChannelContextSolution { interactionSid: string; sid: string; } export declare class InteractionChannelContextImpl implements InteractionChannelContext { protected _version: V1; protected _solution: InteractionChannelContextSolution; protected _uri: string; protected _invites?: InteractionChannelInviteListInstance; protected _participants?: InteractionChannelParticipantListInstance; constructor(_version: V1, interactionSid: string, sid: string); get invites(): InteractionChannelInviteListInstance; get participants(): InteractionChannelParticipantListInstance; fetch(callback?: (error: Error | null, item?: InteractionChannelInstance) => any): Promise<InteractionChannelInstance>; update(params: InteractionChannelContextUpdateOptions, callback?: (error: Error | null, item?: InteractionChannelInstance) => any): Promise<InteractionChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InteractionChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InteractionChannelPayload extends TwilioResponsePayload { channels: InteractionChannelResource[]; } interface InteractionChannelResource { sid: string; interaction_sid: string; type: InteractionChannelType; status: InteractionChannelChannelStatus; error_code: number; error_message: string; url: string; links: Record<string, string>; } export declare class InteractionChannelInstance { protected _version: V1; protected _solution: InteractionChannelContextSolution; protected _context?: InteractionChannelContext; constructor(_version: V1, payload: InteractionChannelResource, interactionSid: string, sid?: string); /** * The unique string created by Twilio to identify an Interaction Channel resource, prefixed with UO. */ sid: string; /** * The unique string created by Twilio to identify an Interaction resource, prefixed with KD. */ interactionSid: string; type: InteractionChannelType; status: InteractionChannelChannelStatus; /** * The Twilio error code for a failed channel. */ errorCode: number; /** * The error message for a failed channel. */ errorMessage: string; url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a InteractionChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionChannelInstance */ fetch(callback?: (error: Error | null, item?: InteractionChannelInstance) => any): Promise<InteractionChannelInstance>; /** * Update a InteractionChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionChannelInstance */ update(params: InteractionChannelContextUpdateOptions, callback?: (error: Error | null, item?: InteractionChannelInstance) => any): Promise<InteractionChannelInstance>; /** * Access the invites. */ invites(): InteractionChannelInviteListInstance; /** * Access the participants. */ participants(): InteractionChannelParticipantListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; interactionSid: string; type: InteractionChannelType; status: InteractionChannelChannelStatus; errorCode: number; errorMessage: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InteractionChannelSolution { interactionSid: string; } export interface InteractionChannelListInstance { _version: V1; _solution: InteractionChannelSolution; _uri: string; (sid: string): InteractionChannelContext; get(sid: string): InteractionChannelContext; /** * Streams InteractionChannelInstance 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 { InteractionChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InteractionChannelInstance, done: (err?: Error) => void) => void): void; each(params: InteractionChannelListInstanceEachOptions, callback?: (item: InteractionChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InteractionChannelInstance 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: InteractionChannelPage) => any): Promise<InteractionChannelPage>; /** * Lists InteractionChannelInstance 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 { InteractionChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InteractionChannelInstance[]) => any): Promise<InteractionChannelInstance[]>; list(params: InteractionChannelListInstanceOptions, callback?: (error: Error | null, items: InteractionChannelInstance[]) => any): Promise<InteractionChannelInstance[]>; /** * Retrieve a single page of InteractionChannelInstance 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 { InteractionChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InteractionChannelPage) => any): Promise<InteractionChannelPage>; page(params: InteractionChannelListInstancePageOptions, callback?: (error: Error | null, items: InteractionChannelPage) => any): Promise<InteractionChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InteractionChannelListInstance(version: V1, interactionSid: string): InteractionChannelListInstance; export declare class InteractionChannelPage extends Page<V1, InteractionChannelPayload, InteractionChannelResource, InteractionChannelInstance> { /** * Initialize the InteractionChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InteractionChannelSolution); /** * Build an instance of InteractionChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: InteractionChannelResource): InteractionChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/interaction/interactionChannel.js000064400000022565151677225100016144 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InteractionChannelPage = exports.InteractionChannelListInstance = exports.InteractionChannelInstance = exports.InteractionChannelContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const interactionChannelInvite_1 = require("./interactionChannel/interactionChannelInvite"); const interactionChannelParticipant_1 = require("./interactionChannel/interactionChannelParticipant"); class InteractionChannelContextImpl { constructor(_version, interactionSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(interactionSid)) { throw new Error("Parameter 'interactionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { interactionSid, sid }; this._uri = `/Interactions/${interactionSid}/Channels/${sid}`; } get invites() { this._invites = this._invites || (0, interactionChannelInvite_1.InteractionChannelInviteListInstance)(this._version, this._solution.interactionSid, this._solution.sid); return this._invites; } get participants() { this._participants = this._participants || (0, interactionChannelParticipant_1.InteractionChannelParticipantListInstance)(this._version, this._solution.interactionSid, this._solution.sid); return this._participants; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new InteractionChannelInstance(operationVersion, payload, instance._solution.interactionSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; if (params["routing"] !== undefined) data["Routing"] = serialize.object(params["routing"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InteractionChannelInstance(operationVersion, payload, instance._solution.interactionSid, 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.InteractionChannelContextImpl = InteractionChannelContextImpl; class InteractionChannelInstance { constructor(_version, payload, interactionSid, sid) { this._version = _version; this.sid = payload.sid; this.interactionSid = payload.interaction_sid; this.type = payload.type; this.status = payload.status; this.errorCode = deserialize.integer(payload.error_code); this.errorMessage = payload.error_message; this.url = payload.url; this.links = payload.links; this._solution = { interactionSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new InteractionChannelContextImpl(this._version, this._solution.interactionSid, this._solution.sid); return this._context; } /** * Fetch a InteractionChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InteractionChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the invites. */ invites() { return this._proxy.invites; } /** * Access the participants. */ participants() { return this._proxy.participants; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, interactionSid: this.interactionSid, type: this.type, status: this.status, errorCode: this.errorCode, errorMessage: this.errorMessage, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InteractionChannelInstance = InteractionChannelInstance; function InteractionChannelListInstance(version, interactionSid) { if (!(0, utility_1.isValidPathParam)(interactionSid)) { throw new Error("Parameter 'interactionSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new InteractionChannelContextImpl(version, interactionSid, sid); }; instance._version = version; instance._solution = { interactionSid }; instance._uri = `/Interactions/${interactionSid}/Channels`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InteractionChannelPage(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 InteractionChannelPage(instance._version, payload, 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; } exports.InteractionChannelListInstance = InteractionChannelListInstance; class InteractionChannelPage extends Page_1.default { /** * Initialize the InteractionChannelPage * * @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 InteractionChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InteractionChannelInstance(this._version, payload, this._solution.interactionSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InteractionChannelPage = InteractionChannelPage; rest/flexApi/v1/pluginConfigurationArchive.js000064400000010644151677225100015340 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.PluginConfigurationArchiveListInstance = exports.PluginConfigurationArchiveInstance = exports.PluginConfigurationArchiveContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class PluginConfigurationArchiveContextImpl { 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 = `/PluginService/Configurations/${sid}/Archive`; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PluginConfigurationArchiveInstance(operationVersion, payload, 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.PluginConfigurationArchiveContextImpl = PluginConfigurationArchiveContextImpl; class PluginConfigurationArchiveInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.name = payload.name; this.description = payload.description; this.archived = payload.archived; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PluginConfigurationArchiveContextImpl(this._version, this._solution.sid); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, name: this.name, description: this.description, archived: this.archived, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginConfigurationArchiveInstance = PluginConfigurationArchiveInstance; function PluginConfigurationArchiveListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PluginConfigurationArchiveContextImpl(version, sid); }; 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; } exports.PluginConfigurationArchiveListInstance = PluginConfigurationArchiveListInstance; rest/flexApi/v1/provisioningStatus.d.ts000064400000005540151677225100014175 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export type ProvisioningStatusStatus = "active" | "in-progress" | "not-configured" | "failed"; export interface ProvisioningStatusContext { /** * Fetch a ProvisioningStatusInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ProvisioningStatusInstance */ fetch(callback?: (error: Error | null, item?: ProvisioningStatusInstance) => any): Promise<ProvisioningStatusInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ProvisioningStatusContextSolution { } export declare class ProvisioningStatusContextImpl implements ProvisioningStatusContext { protected _version: V1; protected _solution: ProvisioningStatusContextSolution; protected _uri: string; constructor(_version: V1); fetch(callback?: (error: Error | null, item?: ProvisioningStatusInstance) => any): Promise<ProvisioningStatusInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ProvisioningStatusContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ProvisioningStatusResource { status: ProvisioningStatusStatus; url: string; } export declare class ProvisioningStatusInstance { protected _version: V1; protected _solution: ProvisioningStatusContextSolution; protected _context?: ProvisioningStatusContext; constructor(_version: V1, payload: ProvisioningStatusResource); status: ProvisioningStatusStatus; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Fetch a ProvisioningStatusInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ProvisioningStatusInstance */ fetch(callback?: (error: Error | null, item?: ProvisioningStatusInstance) => any): Promise<ProvisioningStatusInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { status: ProvisioningStatusStatus; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ProvisioningStatusSolution { } export interface ProvisioningStatusListInstance { _version: V1; _solution: ProvisioningStatusSolution; _uri: string; (): ProvisioningStatusContext; get(): ProvisioningStatusContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ProvisioningStatusListInstance(version: V1): ProvisioningStatusListInstance; export {}; rest/flexApi/v1/provisioningStatus.js000064400000006601151677225100013740 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.ProvisioningStatusListInstance = exports.ProvisioningStatusInstance = exports.ProvisioningStatusContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class ProvisioningStatusContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/account/provision/status`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ProvisioningStatusInstance(operationVersion, payload)); 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.ProvisioningStatusContextImpl = ProvisioningStatusContextImpl; class ProvisioningStatusInstance { constructor(_version, payload) { this._version = _version; this.status = payload.status; this.url = payload.url; this._solution = {}; } get _proxy() { this._context = this._context || new ProvisioningStatusContextImpl(this._version); return this._context; } /** * Fetch a ProvisioningStatusInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ProvisioningStatusInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { status: this.status, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ProvisioningStatusInstance = ProvisioningStatusInstance; function ProvisioningStatusListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new ProvisioningStatusContextImpl(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; } exports.ProvisioningStatusListInstance = ProvisioningStatusListInstance; rest/flexApi/v1/pluginConfiguration/configuredPlugin.d.ts000064400000027065151677225100017603 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to fetch a ConfiguredPluginInstance */ export interface ConfiguredPluginContextFetchOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; } /** * Options to pass to each */ export interface ConfiguredPluginListInstanceEachOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ConfiguredPluginInstance, 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 ConfiguredPluginListInstanceOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ConfiguredPluginListInstancePageOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ConfiguredPluginContext { /** * Fetch a ConfiguredPluginInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfiguredPluginInstance */ fetch(callback?: (error: Error | null, item?: ConfiguredPluginInstance) => any): Promise<ConfiguredPluginInstance>; /** * Fetch a ConfiguredPluginInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfiguredPluginInstance */ fetch(params: ConfiguredPluginContextFetchOptions, callback?: (error: Error | null, item?: ConfiguredPluginInstance) => any): Promise<ConfiguredPluginInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ConfiguredPluginContextSolution { configurationSid: string; pluginSid: string; } export declare class ConfiguredPluginContextImpl implements ConfiguredPluginContext { protected _version: V1; protected _solution: ConfiguredPluginContextSolution; protected _uri: string; constructor(_version: V1, configurationSid: string, pluginSid: string); fetch(params?: ConfiguredPluginContextFetchOptions | ((error: Error | null, item?: ConfiguredPluginInstance) => any), callback?: (error: Error | null, item?: ConfiguredPluginInstance) => any): Promise<ConfiguredPluginInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ConfiguredPluginContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ConfiguredPluginPayload extends TwilioResponsePayload { plugins: ConfiguredPluginResource[]; } interface ConfiguredPluginResource { account_sid: string; configuration_sid: string; plugin_sid: string; plugin_version_sid: string; phase: number; plugin_url: string; unique_name: string; friendly_name: string; description: string; plugin_archived: boolean; version: string; changelog: string; plugin_version_archived: boolean; private: boolean; date_created: Date; url: string; } export declare class ConfiguredPluginInstance { protected _version: V1; protected _solution: ConfiguredPluginContextSolution; protected _context?: ConfiguredPluginContext; constructor(_version: V1, payload: ConfiguredPluginResource, configurationSid: string, pluginSid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Flex Plugin resource is installed for. */ accountSid: string; /** * The SID of the Flex Plugin Configuration that this Flex Plugin belongs to. */ configurationSid: string; /** * The SID of the Flex Plugin. */ pluginSid: string; /** * The SID of the Flex Plugin Version. */ pluginVersionSid: string; /** * The phase this Flex Plugin would initialize at runtime. */ phase: number; /** * The URL of where the Flex Plugin Version JavaScript bundle is hosted on. */ pluginUrl: string; /** * The name that uniquely identifies this Flex Plugin resource. */ uniqueName: string; /** * The friendly name of this Flex Plugin resource. */ friendlyName: string; /** * A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long */ description: string; /** * Whether the Flex Plugin is archived. The default value is false. */ pluginArchived: boolean; /** * The latest version of this Flex Plugin Version. */ version: string; /** * A changelog that describes the changes this Flex Plugin Version brings. */ changelog: string; /** * Whether the Flex Plugin Version is archived. The default value is false. */ pluginVersionArchived: boolean; /** * Whether to validate the request is authorized to access the Flex Plugin Version. */ _private: boolean; /** * The date and time in GMT when the Flex Plugin was installed specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Flex Plugin resource. */ url: string; private get _proxy(); /** * Fetch a ConfiguredPluginInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfiguredPluginInstance */ fetch(callback?: (error: Error | null, item?: ConfiguredPluginInstance) => any): Promise<ConfiguredPluginInstance>; /** * Fetch a ConfiguredPluginInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ConfiguredPluginInstance */ fetch(params: ConfiguredPluginContextFetchOptions, callback?: (error: Error | null, item?: ConfiguredPluginInstance) => any): Promise<ConfiguredPluginInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; configurationSid: string; pluginSid: string; pluginVersionSid: string; phase: number; pluginUrl: string; uniqueName: string; friendlyName: string; description: string; pluginArchived: boolean; version: string; changelog: string; pluginVersionArchived: boolean; _private: boolean; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ConfiguredPluginSolution { configurationSid: string; } export interface ConfiguredPluginListInstance { _version: V1; _solution: ConfiguredPluginSolution; _uri: string; (pluginSid: string): ConfiguredPluginContext; get(pluginSid: string): ConfiguredPluginContext; /** * Streams ConfiguredPluginInstance 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 { ConfiguredPluginListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ConfiguredPluginInstance, done: (err?: Error) => void) => void): void; each(params: ConfiguredPluginListInstanceEachOptions, callback?: (item: ConfiguredPluginInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ConfiguredPluginInstance 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: ConfiguredPluginPage) => any): Promise<ConfiguredPluginPage>; /** * Lists ConfiguredPluginInstance 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 { ConfiguredPluginListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ConfiguredPluginInstance[]) => any): Promise<ConfiguredPluginInstance[]>; list(params: ConfiguredPluginListInstanceOptions, callback?: (error: Error | null, items: ConfiguredPluginInstance[]) => any): Promise<ConfiguredPluginInstance[]>; /** * Retrieve a single page of ConfiguredPluginInstance 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 { ConfiguredPluginListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ConfiguredPluginPage) => any): Promise<ConfiguredPluginPage>; page(params: ConfiguredPluginListInstancePageOptions, callback?: (error: Error | null, items: ConfiguredPluginPage) => any): Promise<ConfiguredPluginPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ConfiguredPluginListInstance(version: V1, configurationSid: string): ConfiguredPluginListInstance; export declare class ConfiguredPluginPage extends Page<V1, ConfiguredPluginPayload, ConfiguredPluginResource, ConfiguredPluginInstance> { /** * Initialize the ConfiguredPluginPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ConfiguredPluginSolution); /** * Build an instance of ConfiguredPluginInstance * * @param payload - Payload response from the API */ getInstance(payload: ConfiguredPluginResource): ConfiguredPluginInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/pluginConfiguration/configuredPlugin.js000064400000021000151677225100017326 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.ConfiguredPluginPage = exports.ConfiguredPluginListInstance = exports.ConfiguredPluginInstance = exports.ConfiguredPluginContextImpl = void 0; 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 ConfiguredPluginContextImpl { constructor(_version, configurationSid, pluginSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(configurationSid)) { throw new Error("Parameter 'configurationSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(pluginSid)) { throw new Error("Parameter 'pluginSid' is not valid."); } this._solution = { configurationSid, pluginSid }; this._uri = `/PluginService/Configurations/${configurationSid}/Plugins/${pluginSid}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConfiguredPluginInstance(operationVersion, payload, instance._solution.configurationSid, instance._solution.pluginSid)); 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.ConfiguredPluginContextImpl = ConfiguredPluginContextImpl; class ConfiguredPluginInstance { constructor(_version, payload, configurationSid, pluginSid) { this._version = _version; this.accountSid = payload.account_sid; this.configurationSid = payload.configuration_sid; this.pluginSid = payload.plugin_sid; this.pluginVersionSid = payload.plugin_version_sid; this.phase = deserialize.integer(payload.phase); this.pluginUrl = payload.plugin_url; this.uniqueName = payload.unique_name; this.friendlyName = payload.friendly_name; this.description = payload.description; this.pluginArchived = payload.plugin_archived; this.version = payload.version; this.changelog = payload.changelog; this.pluginVersionArchived = payload.plugin_version_archived; this._private = payload.private; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { configurationSid, pluginSid: pluginSid || this.pluginSid, }; } get _proxy() { this._context = this._context || new ConfiguredPluginContextImpl(this._version, this._solution.configurationSid, this._solution.pluginSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, configurationSid: this.configurationSid, pluginSid: this.pluginSid, pluginVersionSid: this.pluginVersionSid, phase: this.phase, pluginUrl: this.pluginUrl, uniqueName: this.uniqueName, friendlyName: this.friendlyName, description: this.description, pluginArchived: this.pluginArchived, version: this.version, changelog: this.changelog, pluginVersionArchived: this.pluginVersionArchived, _private: this._private, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConfiguredPluginInstance = ConfiguredPluginInstance; function ConfiguredPluginListInstance(version, configurationSid) { if (!(0, utility_1.isValidPathParam)(configurationSid)) { throw new Error("Parameter 'configurationSid' is not valid."); } const instance = ((pluginSid) => instance.get(pluginSid)); instance.get = function get(pluginSid) { return new ConfiguredPluginContextImpl(version, configurationSid, pluginSid); }; instance._version = version; instance._solution = { configurationSid }; instance._uri = `/PluginService/Configurations/${configurationSid}/Plugins`; 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 = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ConfiguredPluginPage(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 ConfiguredPluginPage(instance._version, payload, 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; } exports.ConfiguredPluginListInstance = ConfiguredPluginListInstance; class ConfiguredPluginPage extends Page_1.default { /** * Initialize the ConfiguredPluginPage * * @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 ConfiguredPluginInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ConfiguredPluginInstance(this._version, payload, this._solution.configurationSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ConfiguredPluginPage = ConfiguredPluginPage; rest/flexApi/v1/insightsSession.d.ts000064400000010317151677225100013435 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a InsightsSessionInstance */ export interface InsightsSessionContextCreateOptions { /** The Authorization HTTP request header */ authorization?: string; } export interface InsightsSessionContext { /** * Create a InsightsSessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsSessionInstance */ create(callback?: (error: Error | null, item?: InsightsSessionInstance) => any): Promise<InsightsSessionInstance>; /** * Create a InsightsSessionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsSessionInstance */ create(params: InsightsSessionContextCreateOptions, callback?: (error: Error | null, item?: InsightsSessionInstance) => any): Promise<InsightsSessionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface InsightsSessionContextSolution { } export declare class InsightsSessionContextImpl implements InsightsSessionContext { protected _version: V1; protected _solution: InsightsSessionContextSolution; protected _uri: string; constructor(_version: V1); create(params?: InsightsSessionContextCreateOptions | ((error: Error | null, item?: InsightsSessionInstance) => any), callback?: (error: Error | null, item?: InsightsSessionInstance) => any): Promise<InsightsSessionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): InsightsSessionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface InsightsSessionResource { workspace_id: string; session_expiry: string; session_id: string; base_url: string; url: string; } export declare class InsightsSessionInstance { protected _version: V1; protected _solution: InsightsSessionContextSolution; protected _context?: InsightsSessionContext; constructor(_version: V1, payload: InsightsSessionResource); /** * Unique ID to identify the user\'s workspace */ workspaceId: string; /** * The session expiry date and time, given in ISO 8601 format. */ sessionExpiry: string; /** * The unique ID for the session */ sessionId: string; /** * The base URL to fetch reports and dashboards */ baseUrl: string; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Create a InsightsSessionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsSessionInstance */ create(callback?: (error: Error | null, item?: InsightsSessionInstance) => any): Promise<InsightsSessionInstance>; /** * Create a InsightsSessionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed InsightsSessionInstance */ create(params: InsightsSessionContextCreateOptions, callback?: (error: Error | null, item?: InsightsSessionInstance) => any): Promise<InsightsSessionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { workspaceId: string; sessionExpiry: string; sessionId: string; baseUrl: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface InsightsSessionSolution { } export interface InsightsSessionListInstance { _version: V1; _solution: InsightsSessionSolution; _uri: string; (): InsightsSessionContext; get(): InsightsSessionContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsSessionListInstance(version: V1): InsightsSessionListInstance; export {}; rest/flexApi/v1/insightsQuestionnaires.js000064400000026242151677225100014573 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.InsightsQuestionnairesPage = exports.InsightsQuestionnairesListInstance = exports.InsightsQuestionnairesInstance = exports.InsightsQuestionnairesContextImpl = void 0; 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 InsightsQuestionnairesContextImpl { constructor(_version, questionnaireSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(questionnaireSid)) { throw new Error("Parameter 'questionnaireSid' is not valid."); } this._solution = { questionnaireSid }; this._uri = `/Insights/QualityManagement/Questionnaires/${questionnaireSid}`; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesInstance(operationVersion, payload, instance._solution.questionnaireSid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["active"] === null || params["active"] === undefined) { throw new Error("Required parameter \"params['active']\" missing."); } let data = {}; data["Active"] = serialize.bool(params["active"]); if (params["name"] !== undefined) data["Name"] = params["name"]; if (params["description"] !== undefined) data["Description"] = params["description"]; if (params["questionSids"] !== undefined) data["QuestionSids"] = serialize.map(params["questionSids"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesInstance(operationVersion, payload, instance._solution.questionnaireSid)); 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.InsightsQuestionnairesContextImpl = InsightsQuestionnairesContextImpl; class InsightsQuestionnairesInstance { constructor(_version, payload, questionnaireSid) { this._version = _version; this.accountSid = payload.account_sid; this.questionnaireSid = payload.questionnaire_sid; this.name = payload.name; this.description = payload.description; this.active = payload.active; this.questions = payload.questions; this.url = payload.url; this._solution = { questionnaireSid: questionnaireSid || this.questionnaireSid, }; } get _proxy() { this._context = this._context || new InsightsQuestionnairesContextImpl(this._version, this._solution.questionnaireSid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } fetch(params, callback) { return this._proxy.fetch(params, callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, questionnaireSid: this.questionnaireSid, name: this.name, description: this.description, active: this.active, questions: this.questions, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsQuestionnairesInstance = InsightsQuestionnairesInstance; function InsightsQuestionnairesListInstance(version) { const instance = ((questionnaireSid) => instance.get(questionnaireSid)); instance.get = function get(questionnaireSid) { return new InsightsQuestionnairesContextImpl(version, questionnaireSid); }; instance._version = version; instance._solution = {}; instance._uri = `/Insights/QualityManagement/Questionnaires`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["name"] === null || params["name"] === undefined) { throw new Error("Required parameter \"params['name']\" missing."); } let data = {}; data["Name"] = params["name"]; if (params["description"] !== undefined) data["Description"] = params["description"]; if (params["active"] !== undefined) data["Active"] = serialize.bool(params["active"]); if (params["questionSids"] !== undefined) data["QuestionSids"] = serialize.map(params["questionSids"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesInstance(operationVersion, payload)); 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["includeInactive"] !== undefined) data["IncludeInactive"] = serialize.bool(params["includeInactive"]); 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 = {}; if (params["authorization"] !== undefined) headers["Authorization"] = params["authorization"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new InsightsQuestionnairesPage(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 InsightsQuestionnairesPage(instance._version, payload, 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; } exports.InsightsQuestionnairesListInstance = InsightsQuestionnairesListInstance; class InsightsQuestionnairesPage extends Page_1.default { /** * Initialize the InsightsQuestionnairesPage * * @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 InsightsQuestionnairesInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new InsightsQuestionnairesInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.InsightsQuestionnairesPage = InsightsQuestionnairesPage; rest/flexApi/v1/channel.js000064400000022620151677225100011415 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.ChannelPage = exports.ChannelListInstance = exports.ChannelInstance = exports.ChannelContextImpl = void 0; 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 ChannelContextImpl { 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 = `/Channels/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload, 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.ChannelContextImpl = ChannelContextImpl; class ChannelInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.flexFlowSid = payload.flex_flow_sid; this.sid = payload.sid; this.userSid = payload.user_sid; this.taskSid = payload.task_sid; this.url = payload.url; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ChannelContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, flexFlowSid: this.flexFlowSid, sid: this.sid, userSid: this.userSid, taskSid: this.taskSid, url: this.url, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelInstance = ChannelInstance; function ChannelListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ChannelContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Channels`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["flexFlowSid"] === null || params["flexFlowSid"] === undefined) { throw new Error("Required parameter \"params['flexFlowSid']\" missing."); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } if (params["chatUserFriendlyName"] === null || params["chatUserFriendlyName"] === undefined) { throw new Error("Required parameter \"params['chatUserFriendlyName']\" missing."); } if (params["chatFriendlyName"] === null || params["chatFriendlyName"] === undefined) { throw new Error("Required parameter \"params['chatFriendlyName']\" missing."); } let data = {}; data["FlexFlowSid"] = params["flexFlowSid"]; data["Identity"] = params["identity"]; data["ChatUserFriendlyName"] = params["chatUserFriendlyName"]; data["ChatFriendlyName"] = params["chatFriendlyName"]; if (params["target"] !== undefined) data["Target"] = params["target"]; if (params["chatUniqueName"] !== undefined) data["ChatUniqueName"] = params["chatUniqueName"]; if (params["preEngagementData"] !== undefined) data["PreEngagementData"] = params["preEngagementData"]; if (params["taskSid"] !== undefined) data["TaskSid"] = params["taskSid"]; if (params["taskAttributes"] !== undefined) data["TaskAttributes"] = params["taskAttributes"]; if (params["longLived"] !== undefined) data["LongLived"] = serialize.bool(params["longLived"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelPage(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 ChannelPage(instance._version, payload, 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; } exports.ChannelListInstance = ChannelListInstance; class ChannelPage extends Page_1.default { /** * Initialize the ChannelPage * * @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 ChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ChannelInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelPage = ChannelPage; rest/flexApi/v1/pluginConfiguration.d.ts000064400000027017151677225100014274 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { ConfiguredPluginListInstance } from "./pluginConfiguration/configuredPlugin"; /** * Options to pass to fetch a PluginConfigurationInstance */ export interface PluginConfigurationContextFetchOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; } /** * Options to pass to create a PluginConfigurationInstance */ export interface PluginConfigurationListInstanceCreateOptions { /** The Flex Plugin Configuration\\\'s name. */ name: string; /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** A list of objects that describe the plugin versions included in the configuration. Each object contains the sid of the plugin version. */ plugins?: Array<any>; /** The Flex Plugin Configuration\\\'s description. */ description?: string; } /** * Options to pass to each */ export interface PluginConfigurationListInstanceEachOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: PluginConfigurationInstance, 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 PluginConfigurationListInstanceOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface PluginConfigurationListInstancePageOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface PluginConfigurationContext { plugins: ConfiguredPluginListInstance; /** * Fetch a PluginConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginConfigurationInstance */ fetch(callback?: (error: Error | null, item?: PluginConfigurationInstance) => any): Promise<PluginConfigurationInstance>; /** * Fetch a PluginConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginConfigurationInstance */ fetch(params: PluginConfigurationContextFetchOptions, callback?: (error: Error | null, item?: PluginConfigurationInstance) => any): Promise<PluginConfigurationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PluginConfigurationContextSolution { sid: string; } export declare class PluginConfigurationContextImpl implements PluginConfigurationContext { protected _version: V1; protected _solution: PluginConfigurationContextSolution; protected _uri: string; protected _plugins?: ConfiguredPluginListInstance; constructor(_version: V1, sid: string); get plugins(): ConfiguredPluginListInstance; fetch(params?: PluginConfigurationContextFetchOptions | ((error: Error | null, item?: PluginConfigurationInstance) => any), callback?: (error: Error | null, item?: PluginConfigurationInstance) => any): Promise<PluginConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PluginConfigurationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PluginConfigurationPayload extends TwilioResponsePayload { configurations: PluginConfigurationResource[]; } interface PluginConfigurationResource { sid: string; account_sid: string; name: string; description: string; archived: boolean; date_created: Date; url: string; links: Record<string, string>; } export declare class PluginConfigurationInstance { protected _version: V1; protected _solution: PluginConfigurationContextSolution; protected _context?: PluginConfigurationContext; constructor(_version: V1, payload: PluginConfigurationResource, sid?: string); /** * The unique string that we created to identify the Flex Plugin Configuration resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Configuration resource and owns this resource. */ accountSid: string; /** * The name of this Flex Plugin Configuration. */ name: string; /** * The description of the Flex Plugin Configuration resource. */ description: string; /** * Whether the Flex Plugin Configuration is archived. The default value is false. */ archived: boolean; /** * The date and time in GMT when the Flex Plugin Configuration was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Flex Plugin Configuration resource. */ url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a PluginConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginConfigurationInstance */ fetch(callback?: (error: Error | null, item?: PluginConfigurationInstance) => any): Promise<PluginConfigurationInstance>; /** * Fetch a PluginConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginConfigurationInstance */ fetch(params: PluginConfigurationContextFetchOptions, callback?: (error: Error | null, item?: PluginConfigurationInstance) => any): Promise<PluginConfigurationInstance>; /** * Access the plugins. */ plugins(): ConfiguredPluginListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; name: string; description: string; archived: boolean; dateCreated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PluginConfigurationSolution { } export interface PluginConfigurationListInstance { _version: V1; _solution: PluginConfigurationSolution; _uri: string; (sid: string): PluginConfigurationContext; get(sid: string): PluginConfigurationContext; /** * Create a PluginConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginConfigurationInstance */ create(params: PluginConfigurationListInstanceCreateOptions, callback?: (error: Error | null, item?: PluginConfigurationInstance) => any): Promise<PluginConfigurationInstance>; /** * Streams PluginConfigurationInstance 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 { PluginConfigurationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PluginConfigurationInstance, done: (err?: Error) => void) => void): void; each(params: PluginConfigurationListInstanceEachOptions, callback?: (item: PluginConfigurationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PluginConfigurationInstance 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: PluginConfigurationPage) => any): Promise<PluginConfigurationPage>; /** * Lists PluginConfigurationInstance 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 { PluginConfigurationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PluginConfigurationInstance[]) => any): Promise<PluginConfigurationInstance[]>; list(params: PluginConfigurationListInstanceOptions, callback?: (error: Error | null, items: PluginConfigurationInstance[]) => any): Promise<PluginConfigurationInstance[]>; /** * Retrieve a single page of PluginConfigurationInstance 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 { PluginConfigurationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PluginConfigurationPage) => any): Promise<PluginConfigurationPage>; page(params: PluginConfigurationListInstancePageOptions, callback?: (error: Error | null, items: PluginConfigurationPage) => any): Promise<PluginConfigurationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PluginConfigurationListInstance(version: V1): PluginConfigurationListInstance; export declare class PluginConfigurationPage extends Page<V1, PluginConfigurationPayload, PluginConfigurationResource, PluginConfigurationInstance> { /** * Initialize the PluginConfigurationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: PluginConfigurationSolution); /** * Build an instance of PluginConfigurationInstance * * @param payload - Payload response from the API */ getInstance(payload: PluginConfigurationResource): PluginConfigurationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/plugin/pluginVersions.d.ts000064400000027052151677225100014572 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to fetch a PluginVersionsInstance */ export interface PluginVersionsContextFetchOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; } /** * Options to pass to create a PluginVersionsInstance */ export interface PluginVersionsListInstanceCreateOptions { /** The Flex Plugin Version\\\'s version. */ version: string; /** The URL of the Flex Plugin Version bundle */ pluginUrl: string; /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** The changelog of the Flex Plugin Version. */ changelog?: string; /** Whether this Flex Plugin Version requires authorization. */ private?: boolean; /** The version of Flex Plugins CLI used to create this plugin */ cliVersion?: string; /** The validation status of the plugin, indicating whether it has been validated */ validateStatus?: string; } /** * Options to pass to each */ export interface PluginVersionsListInstanceEachOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: PluginVersionsInstance, 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 PluginVersionsListInstanceOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface PluginVersionsListInstancePageOptions { /** The Flex-Metadata HTTP request header */ flexMetadata?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface PluginVersionsContext { /** * Fetch a PluginVersionsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginVersionsInstance */ fetch(callback?: (error: Error | null, item?: PluginVersionsInstance) => any): Promise<PluginVersionsInstance>; /** * Fetch a PluginVersionsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginVersionsInstance */ fetch(params: PluginVersionsContextFetchOptions, callback?: (error: Error | null, item?: PluginVersionsInstance) => any): Promise<PluginVersionsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PluginVersionsContextSolution { pluginSid: string; sid: string; } export declare class PluginVersionsContextImpl implements PluginVersionsContext { protected _version: V1; protected _solution: PluginVersionsContextSolution; protected _uri: string; constructor(_version: V1, pluginSid: string, sid: string); fetch(params?: PluginVersionsContextFetchOptions | ((error: Error | null, item?: PluginVersionsInstance) => any), callback?: (error: Error | null, item?: PluginVersionsInstance) => any): Promise<PluginVersionsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PluginVersionsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PluginVersionsPayload extends TwilioResponsePayload { plugin_versions: PluginVersionsResource[]; } interface PluginVersionsResource { sid: string; plugin_sid: string; account_sid: string; version: string; plugin_url: string; changelog: string; private: boolean; archived: boolean; validated: boolean; date_created: Date; url: string; } export declare class PluginVersionsInstance { protected _version: V1; protected _solution: PluginVersionsContextSolution; protected _context?: PluginVersionsContext; constructor(_version: V1, payload: PluginVersionsResource, pluginSid: string, sid?: string); /** * The unique string that we created to identify the Flex Plugin Version resource. */ sid: string; /** * The SID of the Flex Plugin resource this Flex Plugin Version belongs to. */ pluginSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Plugin Version resource and owns this resource. */ accountSid: string; /** * The unique version of this Flex Plugin Version. */ version: string; /** * The URL of where the Flex Plugin Version JavaScript bundle is hosted on. */ pluginUrl: string; /** * A changelog that describes the changes this Flex Plugin Version brings. */ changelog: string; /** * Whether the Flex Plugin Version is validated. The default value is false. */ _private: boolean; /** * Whether the Flex Plugin Version is archived. The default value is false. */ archived: boolean; validated: boolean; /** * The date and time in GMT when the Flex Plugin Version was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Flex Plugin Version resource. */ url: string; private get _proxy(); /** * Fetch a PluginVersionsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginVersionsInstance */ fetch(callback?: (error: Error | null, item?: PluginVersionsInstance) => any): Promise<PluginVersionsInstance>; /** * Fetch a PluginVersionsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginVersionsInstance */ fetch(params: PluginVersionsContextFetchOptions, callback?: (error: Error | null, item?: PluginVersionsInstance) => any): Promise<PluginVersionsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; pluginSid: string; accountSid: string; version: string; pluginUrl: string; changelog: string; _private: boolean; archived: boolean; validated: boolean; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PluginVersionsSolution { pluginSid: string; } export interface PluginVersionsListInstance { _version: V1; _solution: PluginVersionsSolution; _uri: string; (sid: string): PluginVersionsContext; get(sid: string): PluginVersionsContext; /** * Create a PluginVersionsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PluginVersionsInstance */ create(params: PluginVersionsListInstanceCreateOptions, callback?: (error: Error | null, item?: PluginVersionsInstance) => any): Promise<PluginVersionsInstance>; /** * Streams PluginVersionsInstance 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 { PluginVersionsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PluginVersionsInstance, done: (err?: Error) => void) => void): void; each(params: PluginVersionsListInstanceEachOptions, callback?: (item: PluginVersionsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PluginVersionsInstance 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: PluginVersionsPage) => any): Promise<PluginVersionsPage>; /** * Lists PluginVersionsInstance 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 { PluginVersionsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PluginVersionsInstance[]) => any): Promise<PluginVersionsInstance[]>; list(params: PluginVersionsListInstanceOptions, callback?: (error: Error | null, items: PluginVersionsInstance[]) => any): Promise<PluginVersionsInstance[]>; /** * Retrieve a single page of PluginVersionsInstance 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 { PluginVersionsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PluginVersionsPage) => any): Promise<PluginVersionsPage>; page(params: PluginVersionsListInstancePageOptions, callback?: (error: Error | null, items: PluginVersionsPage) => any): Promise<PluginVersionsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PluginVersionsListInstance(version: V1, pluginSid: string): PluginVersionsListInstance; export declare class PluginVersionsPage extends Page<V1, PluginVersionsPayload, PluginVersionsResource, PluginVersionsInstance> { /** * Initialize the PluginVersionsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: PluginVersionsSolution); /** * Build an instance of PluginVersionsInstance * * @param payload - Payload response from the API */ getInstance(payload: PluginVersionsResource): PluginVersionsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/plugin/pluginVersions.js000064400000022547151677225100014342 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.PluginVersionsPage = exports.PluginVersionsListInstance = exports.PluginVersionsInstance = exports.PluginVersionsContextImpl = void 0; 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 PluginVersionsContextImpl { constructor(_version, pluginSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(pluginSid)) { throw new Error("Parameter 'pluginSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { pluginSid, sid }; this._uri = `/PluginService/Plugins/${pluginSid}/Versions/${sid}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PluginVersionsInstance(operationVersion, payload, instance._solution.pluginSid, 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.PluginVersionsContextImpl = PluginVersionsContextImpl; class PluginVersionsInstance { constructor(_version, payload, pluginSid, sid) { this._version = _version; this.sid = payload.sid; this.pluginSid = payload.plugin_sid; this.accountSid = payload.account_sid; this.version = payload.version; this.pluginUrl = payload.plugin_url; this.changelog = payload.changelog; this._private = payload.private; this.archived = payload.archived; this.validated = payload.validated; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { pluginSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PluginVersionsContextImpl(this._version, this._solution.pluginSid, this._solution.sid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, pluginSid: this.pluginSid, accountSid: this.accountSid, version: this.version, pluginUrl: this.pluginUrl, changelog: this.changelog, _private: this._private, archived: this.archived, validated: this.validated, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginVersionsInstance = PluginVersionsInstance; function PluginVersionsListInstance(version, pluginSid) { if (!(0, utility_1.isValidPathParam)(pluginSid)) { throw new Error("Parameter 'pluginSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PluginVersionsContextImpl(version, pluginSid, sid); }; instance._version = version; instance._solution = { pluginSid }; instance._uri = `/PluginService/Plugins/${pluginSid}/Versions`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["version"] === null || params["version"] === undefined) { throw new Error("Required parameter \"params['version']\" missing."); } if (params["pluginUrl"] === null || params["pluginUrl"] === undefined) { throw new Error("Required parameter \"params['pluginUrl']\" missing."); } let data = {}; data["Version"] = params["version"]; data["PluginUrl"] = params["pluginUrl"]; if (params["changelog"] !== undefined) data["Changelog"] = params["changelog"]; if (params["private"] !== undefined) data["Private"] = serialize.bool(params["private"]); if (params["cliVersion"] !== undefined) data["CliVersion"] = params["cliVersion"]; if (params["validateStatus"] !== undefined) data["ValidateStatus"] = params["validateStatus"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PluginVersionsInstance(operationVersion, payload, instance._solution.pluginSid)); 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 = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PluginVersionsPage(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 PluginVersionsPage(instance._version, payload, 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; } exports.PluginVersionsListInstance = PluginVersionsListInstance; class PluginVersionsPage extends Page_1.default { /** * Initialize the PluginVersionsPage * * @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 PluginVersionsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PluginVersionsInstance(this._version, payload, this._solution.pluginSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginVersionsPage = PluginVersionsPage; rest/flexApi/v1/insightsConversations.d.ts000064400000016035151677225100014652 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface InsightsConversationsListInstanceEachOptions { /** The Authorization HTTP request header */ authorization?: string; /** Unique Id of the segment for which conversation details needs to be fetched */ segmentId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InsightsConversationsInstance, 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 InsightsConversationsListInstanceOptions { /** The Authorization HTTP request header */ authorization?: string; /** Unique Id of the segment for which conversation details needs to be fetched */ segmentId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InsightsConversationsListInstancePageOptions { /** The Authorization HTTP request header */ authorization?: string; /** Unique Id of the segment for which conversation details needs to be fetched */ segmentId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InsightsConversationsSolution { } export interface InsightsConversationsListInstance { _version: V1; _solution: InsightsConversationsSolution; _uri: string; /** * Streams InsightsConversationsInstance 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 { InsightsConversationsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InsightsConversationsInstance, done: (err?: Error) => void) => void): void; each(params: InsightsConversationsListInstanceEachOptions, callback?: (item: InsightsConversationsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InsightsConversationsInstance 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: InsightsConversationsPage) => any): Promise<InsightsConversationsPage>; /** * Lists InsightsConversationsInstance 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 { InsightsConversationsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InsightsConversationsInstance[]) => any): Promise<InsightsConversationsInstance[]>; list(params: InsightsConversationsListInstanceOptions, callback?: (error: Error | null, items: InsightsConversationsInstance[]) => any): Promise<InsightsConversationsInstance[]>; /** * Retrieve a single page of InsightsConversationsInstance 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 { InsightsConversationsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InsightsConversationsPage) => any): Promise<InsightsConversationsPage>; page(params: InsightsConversationsListInstancePageOptions, callback?: (error: Error | null, items: InsightsConversationsPage) => any): Promise<InsightsConversationsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsConversationsListInstance(version: V1): InsightsConversationsListInstance; interface InsightsConversationsPayload extends TwilioResponsePayload { conversations: InsightsConversationsResource[]; } interface InsightsConversationsResource { account_id: string; conversation_id: string; segment_count: number; segments: Array<any>; } export declare class InsightsConversationsInstance { protected _version: V1; constructor(_version: V1, payload: InsightsConversationsResource); /** * The id of the account. */ accountId: string; /** * The unique id of the conversation */ conversationId: string; /** * The count of segments for a conversation */ segmentCount: number; /** * The Segments of a conversation */ segments: Array<any>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountId: string; conversationId: string; segmentCount: number; segments: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class InsightsConversationsPage extends Page<V1, InsightsConversationsPayload, InsightsConversationsResource, InsightsConversationsInstance> { /** * Initialize the InsightsConversationsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InsightsConversationsSolution); /** * Build an instance of InsightsConversationsInstance * * @param payload - Payload response from the API */ getInstance(payload: InsightsConversationsResource): InsightsConversationsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/insightsSegments.d.ts000064400000022265151677225100013604 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface InsightsSegmentsListInstanceEachOptions { /** The Authorization HTTP request header */ authorization?: string; /** To unique id of the segment */ segmentId?: string; /** The list of reservation Ids */ reservationId?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: InsightsSegmentsInstance, 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 InsightsSegmentsListInstanceOptions { /** The Authorization HTTP request header */ authorization?: string; /** To unique id of the segment */ segmentId?: string; /** The list of reservation Ids */ reservationId?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface InsightsSegmentsListInstancePageOptions { /** The Authorization HTTP request header */ authorization?: string; /** To unique id of the segment */ segmentId?: string; /** The list of reservation Ids */ reservationId?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface InsightsSegmentsSolution { } export interface InsightsSegmentsListInstance { _version: V1; _solution: InsightsSegmentsSolution; _uri: string; /** * Streams InsightsSegmentsInstance 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 { InsightsSegmentsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: InsightsSegmentsInstance, done: (err?: Error) => void) => void): void; each(params: InsightsSegmentsListInstanceEachOptions, callback?: (item: InsightsSegmentsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of InsightsSegmentsInstance 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: InsightsSegmentsPage) => any): Promise<InsightsSegmentsPage>; /** * Lists InsightsSegmentsInstance 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 { InsightsSegmentsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: InsightsSegmentsInstance[]) => any): Promise<InsightsSegmentsInstance[]>; list(params: InsightsSegmentsListInstanceOptions, callback?: (error: Error | null, items: InsightsSegmentsInstance[]) => any): Promise<InsightsSegmentsInstance[]>; /** * Retrieve a single page of InsightsSegmentsInstance 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 { InsightsSegmentsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: InsightsSegmentsPage) => any): Promise<InsightsSegmentsPage>; page(params: InsightsSegmentsListInstancePageOptions, callback?: (error: Error | null, items: InsightsSegmentsPage) => any): Promise<InsightsSegmentsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function InsightsSegmentsListInstance(version: V1): InsightsSegmentsListInstance; interface InsightsSegmentsPayload extends TwilioResponsePayload { segments: InsightsSegmentsResource[]; } interface InsightsSegmentsResource { segment_id: string; external_id: string; queue: string; external_contact: string; external_segment_link_id: string; date: string; account_id: string; external_segment_link: string; agent_id: string; agent_phone: string; agent_name: string; agent_team_name: string; agent_team_name_in_hierarchy: string; agent_link: string; customer_phone: string; customer_name: string; customer_link: string; segment_recording_offset: string; media: any; assessment_type: any; assessment_percentage: any; url: string; } export declare class InsightsSegmentsInstance { protected _version: V1; constructor(_version: V1, payload: InsightsSegmentsResource); /** * To unique id of the segment */ segmentId: string; /** * The unique id for the conversation. */ externalId: string; queue: string; externalContact: string; /** * The uuid for the external_segment_link. */ externalSegmentLinkId: string; /** * The date of the conversation. */ date: string; /** * The unique id for the account. */ accountId: string; /** * The hyperlink to recording of the task event. */ externalSegmentLink: string; /** * The unique id for the agent. */ agentId: string; /** * The phone number of the agent. */ agentPhone: string; /** * The name of the agent. */ agentName: string; /** * The team name to which agent belongs. */ agentTeamName: string; /** * he team name to which agent belongs. */ agentTeamNameInHierarchy: string; /** * The link to the agent conversation. */ agentLink: string; /** * The phone number of the customer. */ customerPhone: string; /** * The name of the customer. */ customerName: string; /** * The link to the customer conversation. */ customerLink: string; /** * The offset value for the recording. */ segmentRecordingOffset: string; /** * The media identifiers of the conversation. */ media: any; /** * The type of the assessment. */ assessmentType: any; /** * The percentage scored on the Assessments. */ assessmentPercentage: any; url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { segmentId: string; externalId: string; queue: string; externalContact: string; externalSegmentLinkId: string; date: string; accountId: string; externalSegmentLink: string; agentId: string; agentPhone: string; agentName: string; agentTeamName: string; agentTeamNameInHierarchy: string; agentLink: string; customerPhone: string; customerName: string; customerLink: string; segmentRecordingOffset: string; media: any; assessmentType: any; assessmentPercentage: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class InsightsSegmentsPage extends Page<V1, InsightsSegmentsPayload, InsightsSegmentsResource, InsightsSegmentsInstance> { /** * Initialize the InsightsSegmentsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: InsightsSegmentsSolution); /** * Build an instance of InsightsSegmentsInstance * * @param payload - Payload response from the API */ getInstance(payload: InsightsSegmentsResource): InsightsSegmentsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/flexApi/v1/plugin.js000064400000023525151677225100011310 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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.PluginPage = exports.PluginListInstance = exports.PluginInstance = exports.PluginContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const pluginVersions_1 = require("./plugin/pluginVersions"); class PluginContextImpl { 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 = `/PluginService/Plugins/${sid}`; } get pluginVersions() { this._pluginVersions = this._pluginVersions || (0, pluginVersions_1.PluginVersionsListInstance)(this._version, this._solution.sid); return this._pluginVersions; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PluginInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["description"] !== undefined) data["Description"] = params["description"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PluginInstance(operationVersion, payload, 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.PluginContextImpl = PluginContextImpl; class PluginInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.uniqueName = payload.unique_name; this.friendlyName = payload.friendly_name; this.description = payload.description; this.archived = payload.archived; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PluginContextImpl(this._version, this._solution.sid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the pluginVersions. */ pluginVersions() { return this._proxy.pluginVersions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, uniqueName: this.uniqueName, friendlyName: this.friendlyName, description: this.description, archived: this.archived, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginInstance = PluginInstance; function PluginListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PluginContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/PluginService/Plugins`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["uniqueName"] === null || params["uniqueName"] === undefined) { throw new Error("Required parameter \"params['uniqueName']\" missing."); } let data = {}; data["UniqueName"] = params["uniqueName"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["description"] !== undefined) data["Description"] = params["description"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PluginInstance(operationVersion, payload)); 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 = {}; if (params["flexMetadata"] !== undefined) headers["Flex-Metadata"] = params["flexMetadata"]; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PluginPage(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 PluginPage(instance._version, payload, 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; } exports.PluginListInstance = PluginListInstance; class PluginPage extends Page_1.default { /** * Initialize the PluginPage * * @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 PluginInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PluginInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PluginPage = PluginPage; rest/flexApi/V1.js000064400000020602151677225100007743 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Flex * 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 assessments_1 = require("./v1/assessments"); const channel_1 = require("./v1/channel"); const configuration_1 = require("./v1/configuration"); const flexFlow_1 = require("./v1/flexFlow"); const insightsAssessmentsComment_1 = require("./v1/insightsAssessmentsComment"); const insightsConversations_1 = require("./v1/insightsConversations"); const insightsQuestionnaires_1 = require("./v1/insightsQuestionnaires"); const insightsQuestionnairesCategory_1 = require("./v1/insightsQuestionnairesCategory"); const insightsQuestionnairesQuestion_1 = require("./v1/insightsQuestionnairesQuestion"); const insightsSegments_1 = require("./v1/insightsSegments"); const insightsSession_1 = require("./v1/insightsSession"); const insightsSettingsAnswerSets_1 = require("./v1/insightsSettingsAnswerSets"); const insightsSettingsComment_1 = require("./v1/insightsSettingsComment"); const insightsUserRoles_1 = require("./v1/insightsUserRoles"); const interaction_1 = require("./v1/interaction"); const plugin_1 = require("./v1/plugin"); const pluginArchive_1 = require("./v1/pluginArchive"); const pluginConfiguration_1 = require("./v1/pluginConfiguration"); const pluginConfigurationArchive_1 = require("./v1/pluginConfigurationArchive"); const pluginRelease_1 = require("./v1/pluginRelease"); const pluginVersionArchive_1 = require("./v1/pluginVersionArchive"); const provisioningStatus_1 = require("./v1/provisioningStatus"); const webChannel_1 = require("./v1/webChannel"); class V1 extends Version_1.default { /** * Initialize the V1 version of FlexApi * * @param domain - The Twilio (Twilio.FlexApi) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for assessments resource */ get assessments() { this._assessments = this._assessments || (0, assessments_1.AssessmentsListInstance)(this); return this._assessments; } /** Getter for channel resource */ get channel() { this._channel = this._channel || (0, channel_1.ChannelListInstance)(this); return this._channel; } /** Getter for configuration resource */ get configuration() { this._configuration = this._configuration || (0, configuration_1.ConfigurationListInstance)(this); return this._configuration; } /** Getter for flexFlow resource */ get flexFlow() { this._flexFlow = this._flexFlow || (0, flexFlow_1.FlexFlowListInstance)(this); return this._flexFlow; } /** Getter for insightsAssessmentsComment resource */ get insightsAssessmentsComment() { this._insightsAssessmentsComment = this._insightsAssessmentsComment || (0, insightsAssessmentsComment_1.InsightsAssessmentsCommentListInstance)(this); return this._insightsAssessmentsComment; } /** Getter for insightsConversations resource */ get insightsConversations() { this._insightsConversations = this._insightsConversations || (0, insightsConversations_1.InsightsConversationsListInstance)(this); return this._insightsConversations; } /** Getter for insightsQuestionnaires resource */ get insightsQuestionnaires() { this._insightsQuestionnaires = this._insightsQuestionnaires || (0, insightsQuestionnaires_1.InsightsQuestionnairesListInstance)(this); return this._insightsQuestionnaires; } /** Getter for insightsQuestionnairesCategory resource */ get insightsQuestionnairesCategory() { this._insightsQuestionnairesCategory = this._insightsQuestionnairesCategory || (0, insightsQuestionnairesCategory_1.InsightsQuestionnairesCategoryListInstance)(this); return this._insightsQuestionnairesCategory; } /** Getter for insightsQuestionnairesQuestion resource */ get insightsQuestionnairesQuestion() { this._insightsQuestionnairesQuestion = this._insightsQuestionnairesQuestion || (0, insightsQuestionnairesQuestion_1.InsightsQuestionnairesQuestionListInstance)(this); return this._insightsQuestionnairesQuestion; } /** Getter for insightsSegments resource */ get insightsSegments() { this._insightsSegments = this._insightsSegments || (0, insightsSegments_1.InsightsSegmentsListInstance)(this); return this._insightsSegments; } /** Getter for insightsSession resource */ get insightsSession() { this._insightsSession = this._insightsSession || (0, insightsSession_1.InsightsSessionListInstance)(this); return this._insightsSession; } /** Getter for insightsSettingsAnswerSets resource */ get insightsSettingsAnswerSets() { this._insightsSettingsAnswerSets = this._insightsSettingsAnswerSets || (0, insightsSettingsAnswerSets_1.InsightsSettingsAnswerSetsListInstance)(this); return this._insightsSettingsAnswerSets; } /** Getter for insightsSettingsComment resource */ get insightsSettingsComment() { this._insightsSettingsComment = this._insightsSettingsComment || (0, insightsSettingsComment_1.InsightsSettingsCommentListInstance)(this); return this._insightsSettingsComment; } /** Getter for insightsUserRoles resource */ get insightsUserRoles() { this._insightsUserRoles = this._insightsUserRoles || (0, insightsUserRoles_1.InsightsUserRolesListInstance)(this); return this._insightsUserRoles; } /** Getter for interaction resource */ get interaction() { this._interaction = this._interaction || (0, interaction_1.InteractionListInstance)(this); return this._interaction; } /** Getter for plugins resource */ get plugins() { this._plugins = this._plugins || (0, plugin_1.PluginListInstance)(this); return this._plugins; } /** Getter for pluginArchive resource */ get pluginArchive() { this._pluginArchive = this._pluginArchive || (0, pluginArchive_1.PluginArchiveListInstance)(this); return this._pluginArchive; } /** Getter for pluginConfigurations resource */ get pluginConfigurations() { this._pluginConfigurations = this._pluginConfigurations || (0, pluginConfiguration_1.PluginConfigurationListInstance)(this); return this._pluginConfigurations; } /** Getter for pluginConfigurationArchive resource */ get pluginConfigurationArchive() { this._pluginConfigurationArchive = this._pluginConfigurationArchive || (0, pluginConfigurationArchive_1.PluginConfigurationArchiveListInstance)(this); return this._pluginConfigurationArchive; } /** Getter for pluginReleases resource */ get pluginReleases() { this._pluginReleases = this._pluginReleases || (0, pluginRelease_1.PluginReleaseListInstance)(this); return this._pluginReleases; } /** Getter for pluginVersionArchive resource */ get pluginVersionArchive() { this._pluginVersionArchive = this._pluginVersionArchive || (0, pluginVersionArchive_1.PluginVersionArchiveListInstance)(this); return this._pluginVersionArchive; } /** Getter for provisioningStatus resource */ get provisioningStatus() { this._provisioningStatus = this._provisioningStatus || (0, provisioningStatus_1.ProvisioningStatusListInstance)(this); return this._provisioningStatus; } /** Getter for webChannel resource */ get webChannel() { this._webChannel = this._webChannel || (0, webChannel_1.WebChannelListInstance)(this); return this._webChannel; } } exports.default = V1; rest/Sync.d.ts000064400000000371151677225100007236 0ustar00import { ServiceListInstance } from "./sync/v1/service"; import SyncBase from "./SyncBase"; declare class Sync extends SyncBase { /** * @deprecated - Use v1.services instead */ get services(): ServiceListInstance; } export = Sync; rest/taskrouter/V1.d.ts000064400000001104151677225100011006 0ustar00import TaskrouterBase from "../TaskrouterBase"; import Version from "../../base/Version"; import { WorkspaceListInstance } from "./v1/workspace"; export default class V1 extends Version { /** * Initialize the V1 version of Taskrouter * * @param domain - The Twilio (Twilio.Taskrouter) domain */ constructor(domain: TaskrouterBase); /** workspaces - { Twilio.Taskrouter.V1.WorkspaceListInstance } resource */ protected _workspaces?: WorkspaceListInstance; /** Getter for workspaces resource */ get workspaces(): WorkspaceListInstance; } rest/taskrouter/v1/workspace.d.ts000064400000051436151677225100013061 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { ActivityListInstance } from "./workspace/activity"; import { EventListInstance } from "./workspace/event"; import { TaskListInstance } from "./workspace/task"; import { TaskChannelListInstance } from "./workspace/taskChannel"; import { TaskQueueListInstance } from "./workspace/taskQueue"; import { WorkerListInstance } from "./workspace/worker"; import { WorkflowListInstance } from "./workspace/workflow"; import { WorkspaceCumulativeStatisticsListInstance } from "./workspace/workspaceCumulativeStatistics"; import { WorkspaceRealTimeStatisticsListInstance } from "./workspace/workspaceRealTimeStatistics"; import { WorkspaceStatisticsListInstance } from "./workspace/workspaceStatistics"; export type WorkspaceQueueOrder = "FIFO" | "LIFO"; /** * Options to pass to update a WorkspaceInstance */ export interface WorkspaceContextUpdateOptions { /** The SID of the Activity that will be used when new Workers are created in the Workspace. */ defaultActivitySid?: string; /** The URL we should call when an event occurs. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio\\\'s [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). */ eventCallbackUrl?: string; /** The list of Workspace events for which to call event_callback_url. For example if `EventsFilter=task.created,task.canceled,worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. */ eventsFilter?: string; /** A descriptive string that you create to describe the Workspace resource. For example: `Sales Call Center` or `Customer Support Team`. */ friendlyName?: string; /** Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can\\\'t be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). */ multiTaskEnabled?: boolean; /** The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. */ timeoutActivitySid?: string; /** */ prioritizeQueueOrder?: WorkspaceQueueOrder; } /** * Options to pass to create a WorkspaceInstance */ export interface WorkspaceListInstanceCreateOptions { /** A descriptive string that you create to describe the Workspace resource. It can be up to 64 characters long. For example: `Customer Support` or `2014 Election Campaign`. */ friendlyName: string; /** The URL we should call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio\\\'s [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). */ eventCallbackUrl?: string; /** The list of Workspace events for which to call event_callback_url. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. */ eventsFilter?: string; /** Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be created as multi-tasking. The default is `true`. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). */ multiTaskEnabled?: boolean; /** An available template name. Can be: `NONE` or `FIFO` and the default is `NONE`. Pre-configures the Workspace with the Workflow and Activities specified in the template. `NONE` will create a Workspace with only a set of default activities. `FIFO` will configure TaskRouter with a set of default activities and a single TaskQueue for first-in, first-out distribution, which can be useful when you are getting started with TaskRouter. */ template?: string; /** */ prioritizeQueueOrder?: WorkspaceQueueOrder; } /** * Options to pass to each */ export interface WorkspaceListInstanceEachOptions { /** The `friendly_name` of the Workspace resources to read. For example `Customer Support` or `2014 Election Campaign`. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: WorkspaceInstance, 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 WorkspaceListInstanceOptions { /** The `friendly_name` of the Workspace resources to read. For example `Customer Support` or `2014 Election Campaign`. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface WorkspaceListInstancePageOptions { /** The `friendly_name` of the Workspace resources to read. For example `Customer Support` or `2014 Election Campaign`. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface WorkspaceContext { activities: ActivityListInstance; events: EventListInstance; tasks: TaskListInstance; taskChannels: TaskChannelListInstance; taskQueues: TaskQueueListInstance; workers: WorkerListInstance; workflows: WorkflowListInstance; cumulativeStatistics: WorkspaceCumulativeStatisticsListInstance; realTimeStatistics: WorkspaceRealTimeStatisticsListInstance; statistics: WorkspaceStatisticsListInstance; /** * Remove a WorkspaceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WorkspaceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceInstance */ fetch(callback?: (error: Error | null, item?: WorkspaceInstance) => any): Promise<WorkspaceInstance>; /** * Update a WorkspaceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceInstance */ update(callback?: (error: Error | null, item?: WorkspaceInstance) => any): Promise<WorkspaceInstance>; /** * Update a WorkspaceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceInstance */ update(params: WorkspaceContextUpdateOptions, callback?: (error: Error | null, item?: WorkspaceInstance) => any): Promise<WorkspaceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkspaceContextSolution { sid: string; } export declare class WorkspaceContextImpl implements WorkspaceContext { protected _version: V1; protected _solution: WorkspaceContextSolution; protected _uri: string; protected _activities?: ActivityListInstance; protected _events?: EventListInstance; protected _tasks?: TaskListInstance; protected _taskChannels?: TaskChannelListInstance; protected _taskQueues?: TaskQueueListInstance; protected _workers?: WorkerListInstance; protected _workflows?: WorkflowListInstance; protected _cumulativeStatistics?: WorkspaceCumulativeStatisticsListInstance; protected _realTimeStatistics?: WorkspaceRealTimeStatisticsListInstance; protected _statistics?: WorkspaceStatisticsListInstance; constructor(_version: V1, sid: string); get activities(): ActivityListInstance; get events(): EventListInstance; get tasks(): TaskListInstance; get taskChannels(): TaskChannelListInstance; get taskQueues(): TaskQueueListInstance; get workers(): WorkerListInstance; get workflows(): WorkflowListInstance; get cumulativeStatistics(): WorkspaceCumulativeStatisticsListInstance; get realTimeStatistics(): WorkspaceRealTimeStatisticsListInstance; get statistics(): WorkspaceStatisticsListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: WorkspaceInstance) => any): Promise<WorkspaceInstance>; update(params?: WorkspaceContextUpdateOptions | ((error: Error | null, item?: WorkspaceInstance) => any), callback?: (error: Error | null, item?: WorkspaceInstance) => any): Promise<WorkspaceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkspaceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkspacePayload extends TwilioResponsePayload { workspaces: WorkspaceResource[]; } interface WorkspaceResource { account_sid: string; date_created: Date; date_updated: Date; default_activity_name: string; default_activity_sid: string; event_callback_url: string; events_filter: string; friendly_name: string; multi_task_enabled: boolean; sid: string; timeout_activity_name: string; timeout_activity_sid: string; prioritize_queue_order: WorkspaceQueueOrder; url: string; links: Record<string, string>; } export declare class WorkspaceInstance { protected _version: V1; protected _solution: WorkspaceContextSolution; protected _context?: WorkspaceContext; constructor(_version: V1, payload: WorkspaceResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. */ accountSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The name of the default activity. */ defaultActivityName: string; /** * The SID of the Activity that will be used when new Workers are created in the Workspace. */ defaultActivitySid: string; /** * The URL we call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio\'s [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). */ eventCallbackUrl: string; /** * The list of Workspace events for which to call `event_callback_url`. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. */ eventsFilter: string; /** * The string that you assigned to describe the Workspace resource. For example `Customer Support` or `2014 Election Campaign`. */ friendlyName: string; /** * Whether multi-tasking is enabled. The default is `true`, which enables multi-tasking. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking each Worker would only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). */ multiTaskEnabled: boolean; /** * The unique string that we created to identify the Workspace resource. */ sid: string; /** * The name of the timeout activity. */ timeoutActivityName: string; /** * The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. */ timeoutActivitySid: string; prioritizeQueueOrder: WorkspaceQueueOrder; /** * The absolute URL of the Workspace resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a WorkspaceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WorkspaceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceInstance */ fetch(callback?: (error: Error | null, item?: WorkspaceInstance) => any): Promise<WorkspaceInstance>; /** * Update a WorkspaceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceInstance */ update(callback?: (error: Error | null, item?: WorkspaceInstance) => any): Promise<WorkspaceInstance>; /** * Update a WorkspaceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceInstance */ update(params: WorkspaceContextUpdateOptions, callback?: (error: Error | null, item?: WorkspaceInstance) => any): Promise<WorkspaceInstance>; /** * Access the activities. */ activities(): ActivityListInstance; /** * Access the events. */ events(): EventListInstance; /** * Access the tasks. */ tasks(): TaskListInstance; /** * Access the taskChannels. */ taskChannels(): TaskChannelListInstance; /** * Access the taskQueues. */ taskQueues(): TaskQueueListInstance; /** * Access the workers. */ workers(): WorkerListInstance; /** * Access the workflows. */ workflows(): WorkflowListInstance; /** * Access the cumulativeStatistics. */ cumulativeStatistics(): WorkspaceCumulativeStatisticsListInstance; /** * Access the realTimeStatistics. */ realTimeStatistics(): WorkspaceRealTimeStatisticsListInstance; /** * Access the statistics. */ statistics(): WorkspaceStatisticsListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; defaultActivityName: string; defaultActivitySid: string; eventCallbackUrl: string; eventsFilter: string; friendlyName: string; multiTaskEnabled: boolean; sid: string; timeoutActivityName: string; timeoutActivitySid: string; prioritizeQueueOrder: WorkspaceQueueOrder; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkspaceSolution { } export interface WorkspaceListInstance { _version: V1; _solution: WorkspaceSolution; _uri: string; (sid: string): WorkspaceContext; get(sid: string): WorkspaceContext; /** * Create a WorkspaceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceInstance */ create(params: WorkspaceListInstanceCreateOptions, callback?: (error: Error | null, item?: WorkspaceInstance) => any): Promise<WorkspaceInstance>; /** * Streams WorkspaceInstance 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 { WorkspaceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WorkspaceInstance, done: (err?: Error) => void) => void): void; each(params: WorkspaceListInstanceEachOptions, callback?: (item: WorkspaceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WorkspaceInstance 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: WorkspacePage) => any): Promise<WorkspacePage>; /** * Lists WorkspaceInstance 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 { WorkspaceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WorkspaceInstance[]) => any): Promise<WorkspaceInstance[]>; list(params: WorkspaceListInstanceOptions, callback?: (error: Error | null, items: WorkspaceInstance[]) => any): Promise<WorkspaceInstance[]>; /** * Retrieve a single page of WorkspaceInstance 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 { WorkspaceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WorkspacePage) => any): Promise<WorkspacePage>; page(params: WorkspaceListInstancePageOptions, callback?: (error: Error | null, items: WorkspacePage) => any): Promise<WorkspacePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkspaceListInstance(version: V1): WorkspaceListInstance; export declare class WorkspacePage extends Page<V1, WorkspacePayload, WorkspaceResource, WorkspaceInstance> { /** * Initialize the WorkspacePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: WorkspaceSolution); /** * Build an instance of WorkspaceInstance * * @param payload - Payload response from the API */ getInstance(payload: WorkspaceResource): WorkspaceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace.js000064400000036233151677225100012623 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkspacePage = exports.WorkspaceListInstance = exports.WorkspaceInstance = exports.WorkspaceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const activity_1 = require("./workspace/activity"); const event_1 = require("./workspace/event"); const task_1 = require("./workspace/task"); const taskChannel_1 = require("./workspace/taskChannel"); const taskQueue_1 = require("./workspace/taskQueue"); const worker_1 = require("./workspace/worker"); const workflow_1 = require("./workspace/workflow"); const workspaceCumulativeStatistics_1 = require("./workspace/workspaceCumulativeStatistics"); const workspaceRealTimeStatistics_1 = require("./workspace/workspaceRealTimeStatistics"); const workspaceStatistics_1 = require("./workspace/workspaceStatistics"); class WorkspaceContextImpl { 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 = `/Workspaces/${sid}`; } get activities() { this._activities = this._activities || (0, activity_1.ActivityListInstance)(this._version, this._solution.sid); return this._activities; } get events() { this._events = this._events || (0, event_1.EventListInstance)(this._version, this._solution.sid); return this._events; } get tasks() { this._tasks = this._tasks || (0, task_1.TaskListInstance)(this._version, this._solution.sid); return this._tasks; } get taskChannels() { this._taskChannels = this._taskChannels || (0, taskChannel_1.TaskChannelListInstance)(this._version, this._solution.sid); return this._taskChannels; } get taskQueues() { this._taskQueues = this._taskQueues || (0, taskQueue_1.TaskQueueListInstance)(this._version, this._solution.sid); return this._taskQueues; } get workers() { this._workers = this._workers || (0, worker_1.WorkerListInstance)(this._version, this._solution.sid); return this._workers; } get workflows() { this._workflows = this._workflows || (0, workflow_1.WorkflowListInstance)(this._version, this._solution.sid); return this._workflows; } get cumulativeStatistics() { this._cumulativeStatistics = this._cumulativeStatistics || (0, workspaceCumulativeStatistics_1.WorkspaceCumulativeStatisticsListInstance)(this._version, this._solution.sid); return this._cumulativeStatistics; } get realTimeStatistics() { this._realTimeStatistics = this._realTimeStatistics || (0, workspaceRealTimeStatistics_1.WorkspaceRealTimeStatisticsListInstance)(this._version, this._solution.sid); return this._realTimeStatistics; } get statistics() { this._statistics = this._statistics || (0, workspaceStatistics_1.WorkspaceStatisticsListInstance)(this._version, this._solution.sid); return this._statistics; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WorkspaceInstance(operationVersion, payload, 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["defaultActivitySid"] !== undefined) data["DefaultActivitySid"] = params["defaultActivitySid"]; if (params["eventCallbackUrl"] !== undefined) data["EventCallbackUrl"] = params["eventCallbackUrl"]; if (params["eventsFilter"] !== undefined) data["EventsFilter"] = params["eventsFilter"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["multiTaskEnabled"] !== undefined) data["MultiTaskEnabled"] = serialize.bool(params["multiTaskEnabled"]); if (params["timeoutActivitySid"] !== undefined) data["TimeoutActivitySid"] = params["timeoutActivitySid"]; if (params["prioritizeQueueOrder"] !== undefined) data["PrioritizeQueueOrder"] = params["prioritizeQueueOrder"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WorkspaceInstance(operationVersion, payload, 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.WorkspaceContextImpl = WorkspaceContextImpl; class WorkspaceInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.defaultActivityName = payload.default_activity_name; this.defaultActivitySid = payload.default_activity_sid; this.eventCallbackUrl = payload.event_callback_url; this.eventsFilter = payload.events_filter; this.friendlyName = payload.friendly_name; this.multiTaskEnabled = payload.multi_task_enabled; this.sid = payload.sid; this.timeoutActivityName = payload.timeout_activity_name; this.timeoutActivitySid = payload.timeout_activity_sid; this.prioritizeQueueOrder = payload.prioritize_queue_order; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WorkspaceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a WorkspaceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a WorkspaceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the activities. */ activities() { return this._proxy.activities; } /** * Access the events. */ events() { return this._proxy.events; } /** * Access the tasks. */ tasks() { return this._proxy.tasks; } /** * Access the taskChannels. */ taskChannels() { return this._proxy.taskChannels; } /** * Access the taskQueues. */ taskQueues() { return this._proxy.taskQueues; } /** * Access the workers. */ workers() { return this._proxy.workers; } /** * Access the workflows. */ workflows() { return this._proxy.workflows; } /** * Access the cumulativeStatistics. */ cumulativeStatistics() { return this._proxy.cumulativeStatistics; } /** * Access the realTimeStatistics. */ realTimeStatistics() { return this._proxy.realTimeStatistics; } /** * Access the statistics. */ statistics() { return this._proxy.statistics; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, defaultActivityName: this.defaultActivityName, defaultActivitySid: this.defaultActivitySid, eventCallbackUrl: this.eventCallbackUrl, eventsFilter: this.eventsFilter, friendlyName: this.friendlyName, multiTaskEnabled: this.multiTaskEnabled, sid: this.sid, timeoutActivityName: this.timeoutActivityName, timeoutActivitySid: this.timeoutActivitySid, prioritizeQueueOrder: this.prioritizeQueueOrder, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkspaceInstance = WorkspaceInstance; function WorkspaceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WorkspaceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Workspaces`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["eventCallbackUrl"] !== undefined) data["EventCallbackUrl"] = params["eventCallbackUrl"]; if (params["eventsFilter"] !== undefined) data["EventsFilter"] = params["eventsFilter"]; if (params["multiTaskEnabled"] !== undefined) data["MultiTaskEnabled"] = serialize.bool(params["multiTaskEnabled"]); if (params["template"] !== undefined) data["Template"] = params["template"]; if (params["prioritizeQueueOrder"] !== undefined) data["PrioritizeQueueOrder"] = params["prioritizeQueueOrder"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WorkspaceInstance(operationVersion, payload)); 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["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkspacePage(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 WorkspacePage(instance._version, payload, 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; } exports.WorkspaceListInstance = WorkspaceListInstance; class WorkspacePage extends Page_1.default { /** * Initialize the WorkspacePage * * @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 WorkspaceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WorkspaceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkspacePage = WorkspacePage; rest/taskrouter/v1/workspace/workspaceStatistics.js000064400000011513151677225100016666 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkspaceStatisticsListInstance = exports.WorkspaceStatisticsInstance = exports.WorkspaceStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class WorkspaceStatisticsContextImpl { constructor(_version, workspaceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } this._solution = { workspaceSid }; this._uri = `/Workspaces/${workspaceSid}/Statistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["splitByWaitTime"] !== undefined) data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkspaceStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid)); 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.WorkspaceStatisticsContextImpl = WorkspaceStatisticsContextImpl; class WorkspaceStatisticsInstance { constructor(_version, payload, workspaceSid) { this._version = _version; this.realtime = payload.realtime; this.cumulative = payload.cumulative; this.accountSid = payload.account_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid }; } get _proxy() { this._context = this._context || new WorkspaceStatisticsContextImpl(this._version, this._solution.workspaceSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { realtime: this.realtime, cumulative: this.cumulative, accountSid: this.accountSid, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkspaceStatisticsInstance = WorkspaceStatisticsInstance; function WorkspaceStatisticsListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkspaceStatisticsContextImpl(version, workspaceSid); }; instance._version = version; instance._solution = { workspaceSid }; 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; } exports.WorkspaceStatisticsListInstance = WorkspaceStatisticsListInstance; rest/taskrouter/v1/workspace/taskQueue/taskQueueStatistics.d.ts000064400000013414151677225100021044 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a TaskQueueStatisticsInstance */ export interface TaskQueueStatisticsContextFetchOptions { /** Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** Only calculate statistics since this many minutes in the past. The default is 15 minutes. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate real-time and cumulative statistics for the specified TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. */ splitByWaitTime?: string; } export interface TaskQueueStatisticsContext { /** * Fetch a TaskQueueStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueStatisticsInstance */ fetch(callback?: (error: Error | null, item?: TaskQueueStatisticsInstance) => any): Promise<TaskQueueStatisticsInstance>; /** * Fetch a TaskQueueStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueStatisticsInstance */ fetch(params: TaskQueueStatisticsContextFetchOptions, callback?: (error: Error | null, item?: TaskQueueStatisticsInstance) => any): Promise<TaskQueueStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TaskQueueStatisticsContextSolution { workspaceSid: string; taskQueueSid: string; } export declare class TaskQueueStatisticsContextImpl implements TaskQueueStatisticsContext { protected _version: V1; protected _solution: TaskQueueStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, taskQueueSid: string); fetch(params?: TaskQueueStatisticsContextFetchOptions | ((error: Error | null, item?: TaskQueueStatisticsInstance) => any), callback?: (error: Error | null, item?: TaskQueueStatisticsInstance) => any): Promise<TaskQueueStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TaskQueueStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TaskQueueStatisticsResource { account_sid: string; cumulative: any; realtime: any; task_queue_sid: string; workspace_sid: string; url: string; } export declare class TaskQueueStatisticsInstance { protected _version: V1; protected _solution: TaskQueueStatisticsContextSolution; protected _context?: TaskQueueStatisticsContext; constructor(_version: V1, payload: TaskQueueStatisticsResource, workspaceSid: string, taskQueueSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. */ accountSid: string; /** * An object that contains the cumulative statistics for the TaskQueue. */ cumulative: any; /** * An object that contains the real-time statistics for the TaskQueue. */ realtime: any; /** * The SID of the TaskQueue from which these statistics were calculated. */ taskQueueSid: string; /** * The SID of the Workspace that contains the TaskQueue. */ workspaceSid: string; /** * The absolute URL of the TaskQueue statistics resource. */ url: string; private get _proxy(); /** * Fetch a TaskQueueStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueStatisticsInstance */ fetch(callback?: (error: Error | null, item?: TaskQueueStatisticsInstance) => any): Promise<TaskQueueStatisticsInstance>; /** * Fetch a TaskQueueStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueStatisticsInstance */ fetch(params: TaskQueueStatisticsContextFetchOptions, callback?: (error: Error | null, item?: TaskQueueStatisticsInstance) => any): Promise<TaskQueueStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; cumulative: any; realtime: any; taskQueueSid: string; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TaskQueueStatisticsSolution { workspaceSid: string; taskQueueSid: string; } export interface TaskQueueStatisticsListInstance { _version: V1; _solution: TaskQueueStatisticsSolution; _uri: string; (): TaskQueueStatisticsContext; get(): TaskQueueStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TaskQueueStatisticsListInstance(version: V1, workspaceSid: string, taskQueueSid: string): TaskQueueStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.d.ts000064400000023562151677225100021234 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to each */ export interface TaskQueuesStatisticsListInstanceEachOptions { /** Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** The `friendly_name` of the TaskQueue statistics to read. */ friendlyName?: string; /** Only calculate statistics since this many minutes in the past. The default is 15 minutes. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. */ splitByWaitTime?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: TaskQueuesStatisticsInstance, 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 TaskQueuesStatisticsListInstanceOptions { /** Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** The `friendly_name` of the TaskQueue statistics to read. */ friendlyName?: string; /** Only calculate statistics since this many minutes in the past. The default is 15 minutes. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. */ splitByWaitTime?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface TaskQueuesStatisticsListInstancePageOptions { /** Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** The `friendly_name` of the TaskQueue statistics to read. */ friendlyName?: string; /** Only calculate statistics since this many minutes in the past. The default is 15 minutes. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. */ splitByWaitTime?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface TaskQueuesStatisticsSolution { workspaceSid: string; } export interface TaskQueuesStatisticsListInstance { _version: V1; _solution: TaskQueuesStatisticsSolution; _uri: string; /** * Streams TaskQueuesStatisticsInstance 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 { TaskQueuesStatisticsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TaskQueuesStatisticsInstance, done: (err?: Error) => void) => void): void; each(params: TaskQueuesStatisticsListInstanceEachOptions, callback?: (item: TaskQueuesStatisticsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TaskQueuesStatisticsInstance 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: TaskQueuesStatisticsPage) => any): Promise<TaskQueuesStatisticsPage>; /** * Lists TaskQueuesStatisticsInstance 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 { TaskQueuesStatisticsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TaskQueuesStatisticsInstance[]) => any): Promise<TaskQueuesStatisticsInstance[]>; list(params: TaskQueuesStatisticsListInstanceOptions, callback?: (error: Error | null, items: TaskQueuesStatisticsInstance[]) => any): Promise<TaskQueuesStatisticsInstance[]>; /** * Retrieve a single page of TaskQueuesStatisticsInstance 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 { TaskQueuesStatisticsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TaskQueuesStatisticsPage) => any): Promise<TaskQueuesStatisticsPage>; page(params: TaskQueuesStatisticsListInstancePageOptions, callback?: (error: Error | null, items: TaskQueuesStatisticsPage) => any): Promise<TaskQueuesStatisticsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TaskQueuesStatisticsListInstance(version: V1, workspaceSid: string): TaskQueuesStatisticsListInstance; interface TaskQueuesStatisticsPayload extends TwilioResponsePayload { task_queues_statistics: TaskQueuesStatisticsResource[]; } interface TaskQueuesStatisticsResource { account_sid: string; cumulative: any; realtime: any; task_queue_sid: string; workspace_sid: string; } export declare class TaskQueuesStatisticsInstance { protected _version: V1; constructor(_version: V1, payload: TaskQueuesStatisticsResource, workspaceSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. */ accountSid: string; /** * An object that contains the cumulative statistics for the TaskQueues. */ cumulative: any; /** * An object that contains the real-time statistics for the TaskQueues. */ realtime: any; /** * The SID of the TaskQueue from which these statistics were calculated. */ taskQueueSid: string; /** * The SID of the Workspace that contains the TaskQueues. */ workspaceSid: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; cumulative: any; realtime: any; taskQueueSid: string; workspaceSid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class TaskQueuesStatisticsPage extends Page<V1, TaskQueuesStatisticsPayload, TaskQueuesStatisticsResource, TaskQueuesStatisticsInstance> { /** * Initialize the TaskQueuesStatisticsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TaskQueuesStatisticsSolution); /** * Build an instance of TaskQueuesStatisticsInstance * * @param payload - Payload response from the API */ getInstance(payload: TaskQueuesStatisticsResource): TaskQueuesStatisticsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.d.ts000064400000023414151677225100023104 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a TaskQueueCumulativeStatisticsInstance */ export interface TaskQueueCumulativeStatisticsContextFetchOptions { /** Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** Only calculate statistics since this many minutes in the past. The default is 15 minutes. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. TaskRouter will calculate statistics on up to 10,000 Tasks/Reservations for any given threshold. */ splitByWaitTime?: string; } export interface TaskQueueCumulativeStatisticsContext { /** * Fetch a TaskQueueCumulativeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueCumulativeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: TaskQueueCumulativeStatisticsInstance) => any): Promise<TaskQueueCumulativeStatisticsInstance>; /** * Fetch a TaskQueueCumulativeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueCumulativeStatisticsInstance */ fetch(params: TaskQueueCumulativeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: TaskQueueCumulativeStatisticsInstance) => any): Promise<TaskQueueCumulativeStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TaskQueueCumulativeStatisticsContextSolution { workspaceSid: string; taskQueueSid: string; } export declare class TaskQueueCumulativeStatisticsContextImpl implements TaskQueueCumulativeStatisticsContext { protected _version: V1; protected _solution: TaskQueueCumulativeStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, taskQueueSid: string); fetch(params?: TaskQueueCumulativeStatisticsContextFetchOptions | ((error: Error | null, item?: TaskQueueCumulativeStatisticsInstance) => any), callback?: (error: Error | null, item?: TaskQueueCumulativeStatisticsInstance) => any): Promise<TaskQueueCumulativeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TaskQueueCumulativeStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TaskQueueCumulativeStatisticsResource { account_sid: string; avg_task_acceptance_time: number; start_time: Date; end_time: Date; reservations_created: number; reservations_accepted: number; reservations_rejected: number; reservations_timed_out: number; reservations_canceled: number; reservations_rescinded: number; split_by_wait_time: any; task_queue_sid: string; wait_duration_until_accepted: any; wait_duration_until_canceled: any; wait_duration_in_queue_until_accepted: any; tasks_canceled: number; tasks_completed: number; tasks_deleted: number; tasks_entered: number; tasks_moved: number; workspace_sid: string; url: string; } export declare class TaskQueueCumulativeStatisticsInstance { protected _version: V1; protected _solution: TaskQueueCumulativeStatisticsContextSolution; protected _context?: TaskQueueCumulativeStatisticsContext; constructor(_version: V1, payload: TaskQueueCumulativeStatisticsResource, workspaceSid: string, taskQueueSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. */ accountSid: string; /** * The average time in seconds between Task creation and acceptance. */ avgTaskAcceptanceTime: number; /** * The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startTime: Date; /** * The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ endTime: Date; /** * The total number of Reservations created for Tasks in the TaskQueue. */ reservationsCreated: number; /** * The total number of Reservations accepted for Tasks in the TaskQueue. */ reservationsAccepted: number; /** * The total number of Reservations rejected for Tasks in the TaskQueue. */ reservationsRejected: number; /** * The total number of Reservations that timed out for Tasks in the TaskQueue. */ reservationsTimedOut: number; /** * The total number of Reservations canceled for Tasks in the TaskQueue. */ reservationsCanceled: number; /** * The total number of Reservations rescinded. */ reservationsRescinded: number; /** * A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. */ splitByWaitTime: any; /** * The SID of the TaskQueue from which these statistics were calculated. */ taskQueueSid: string; /** * The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks were created. For transfers, the wait duration is counted from the moment ***the Task was created***, and not from when the transfer was initiated. */ waitDurationUntilAccepted: any; /** * The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks canceled while in the TaskQueue. */ waitDurationUntilCanceled: any; /** * The relative wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks entered the TaskQueue. */ waitDurationInQueueUntilAccepted: any; /** * The total number of Tasks canceled in the TaskQueue. */ tasksCanceled: number; /** * The total number of Tasks completed in the TaskQueue. */ tasksCompleted: number; /** * The total number of Tasks deleted in the TaskQueue. */ tasksDeleted: number; /** * The total number of Tasks entered into the TaskQueue. */ tasksEntered: number; /** * The total number of Tasks that were moved from one queue to another. */ tasksMoved: number; /** * The SID of the Workspace that contains the TaskQueue. */ workspaceSid: string; /** * The absolute URL of the TaskQueue statistics resource. */ url: string; private get _proxy(); /** * Fetch a TaskQueueCumulativeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueCumulativeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: TaskQueueCumulativeStatisticsInstance) => any): Promise<TaskQueueCumulativeStatisticsInstance>; /** * Fetch a TaskQueueCumulativeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueCumulativeStatisticsInstance */ fetch(params: TaskQueueCumulativeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: TaskQueueCumulativeStatisticsInstance) => any): Promise<TaskQueueCumulativeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; avgTaskAcceptanceTime: number; startTime: Date; endTime: Date; reservationsCreated: number; reservationsAccepted: number; reservationsRejected: number; reservationsTimedOut: number; reservationsCanceled: number; reservationsRescinded: number; splitByWaitTime: any; taskQueueSid: string; waitDurationUntilAccepted: any; waitDurationUntilCanceled: any; waitDurationInQueueUntilAccepted: any; tasksCanceled: number; tasksCompleted: number; tasksDeleted: number; tasksEntered: number; tasksMoved: number; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TaskQueueCumulativeStatisticsSolution { workspaceSid: string; taskQueueSid: string; } export interface TaskQueueCumulativeStatisticsListInstance { _version: V1; _solution: TaskQueueCumulativeStatisticsSolution; _uri: string; (): TaskQueueCumulativeStatisticsContext; get(): TaskQueueCumulativeStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TaskQueueCumulativeStatisticsListInstance(version: V1, workspaceSid: string, taskQueueSid: string): TaskQueueCumulativeStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/taskQueue/taskQueuesStatistics.js000064400000013227151677225100020775 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.TaskQueuesStatisticsPage = exports.TaskQueuesStatisticsInstance = exports.TaskQueuesStatisticsListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function TaskQueuesStatisticsListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { workspaceSid }; instance._uri = `/Workspaces/${workspaceSid}/TaskQueues/Statistics`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["splitByWaitTime"] !== undefined) data["SplitByWaitTime"] = params["splitByWaitTime"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TaskQueuesStatisticsPage(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 TaskQueuesStatisticsPage(instance._version, payload, 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; } exports.TaskQueuesStatisticsListInstance = TaskQueuesStatisticsListInstance; class TaskQueuesStatisticsInstance { constructor(_version, payload, workspaceSid) { this._version = _version; this.accountSid = payload.account_sid; this.cumulative = payload.cumulative; this.realtime = payload.realtime; this.taskQueueSid = payload.task_queue_sid; this.workspaceSid = payload.workspace_sid; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, cumulative: this.cumulative, realtime: this.realtime, taskQueueSid: this.taskQueueSid, workspaceSid: this.workspaceSid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskQueuesStatisticsInstance = TaskQueuesStatisticsInstance; class TaskQueuesStatisticsPage extends Page_1.default { /** * Initialize the TaskQueuesStatisticsPage * * @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 TaskQueuesStatisticsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TaskQueuesStatisticsInstance(this._version, payload, this._solution.workspaceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskQueuesStatisticsPage = TaskQueuesStatisticsPage; rest/taskrouter/v1/workspace/taskQueue/taskQueueStatistics.js000064400000012602151677225100020606 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.TaskQueueStatisticsListInstance = exports.TaskQueueStatisticsInstance = exports.TaskQueueStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class TaskQueueStatisticsContextImpl { constructor(_version, workspaceSid, taskQueueSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(taskQueueSid)) { throw new Error("Parameter 'taskQueueSid' is not valid."); } this._solution = { workspaceSid, taskQueueSid }; this._uri = `/Workspaces/${workspaceSid}/TaskQueues/${taskQueueSid}/Statistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["splitByWaitTime"] !== undefined) data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TaskQueueStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.taskQueueSid)); 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.TaskQueueStatisticsContextImpl = TaskQueueStatisticsContextImpl; class TaskQueueStatisticsInstance { constructor(_version, payload, workspaceSid, taskQueueSid) { this._version = _version; this.accountSid = payload.account_sid; this.cumulative = payload.cumulative; this.realtime = payload.realtime; this.taskQueueSid = payload.task_queue_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid, taskQueueSid }; } get _proxy() { this._context = this._context || new TaskQueueStatisticsContextImpl(this._version, this._solution.workspaceSid, this._solution.taskQueueSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, cumulative: this.cumulative, realtime: this.realtime, taskQueueSid: this.taskQueueSid, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskQueueStatisticsInstance = TaskQueueStatisticsInstance; function TaskQueueStatisticsListInstance(version, workspaceSid, taskQueueSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(taskQueueSid)) { throw new Error("Parameter 'taskQueueSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new TaskQueueStatisticsContextImpl(version, workspaceSid, taskQueueSid); }; instance._version = version; instance._solution = { workspaceSid, taskQueueSid }; 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; } exports.TaskQueueStatisticsListInstance = TaskQueueStatisticsListInstance; rest/taskrouter/v1/workspace/taskQueue/taskQueueBulkRealTimeStatistics.d.ts000064400000007203151677225100023304 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to create a TaskQueueBulkRealTimeStatisticsInstance */ export interface TaskQueueBulkRealTimeStatisticsListInstanceCreateOptions { /** */ body?: object; } export interface TaskQueueBulkRealTimeStatisticsSolution { workspaceSid: string; } export interface TaskQueueBulkRealTimeStatisticsListInstance { _version: V1; _solution: TaskQueueBulkRealTimeStatisticsSolution; _uri: string; /** * Create a TaskQueueBulkRealTimeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueBulkRealTimeStatisticsInstance */ create(callback?: (error: Error | null, item?: TaskQueueBulkRealTimeStatisticsInstance) => any): Promise<TaskQueueBulkRealTimeStatisticsInstance>; /** * Create a TaskQueueBulkRealTimeStatisticsInstance * * @param params - Body for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueBulkRealTimeStatisticsInstance */ create(params: object, callback?: (error: Error | null, item?: TaskQueueBulkRealTimeStatisticsInstance) => any): Promise<TaskQueueBulkRealTimeStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TaskQueueBulkRealTimeStatisticsListInstance(version: V1, workspaceSid: string): TaskQueueBulkRealTimeStatisticsListInstance; interface TaskQueueBulkRealTimeStatisticsResource { account_sid: string; workspace_sid: string; task_queue_data: Array<any>; task_queue_response_count: number; url: string; } export declare class TaskQueueBulkRealTimeStatisticsInstance { protected _version: V1; constructor(_version: V1, payload: TaskQueueBulkRealTimeStatisticsResource, workspaceSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. */ accountSid: string; /** * The SID of the Workspace that contains the TaskQueue. */ workspaceSid: string; /** * The real-time statistics for each requested TaskQueue SID. `task_queue_data` returns the following attributes: `task_queue_sid`: The SID of the TaskQueue from which these statistics were calculated. `total_available_workers`: The total number of Workers available for Tasks in the TaskQueue. `total_eligible_workers`: The total number of Workers eligible for Tasks in the TaskQueue, regardless of their Activity state. `total_tasks`: The total number of Tasks. `longest_task_waiting_age`: The age of the longest waiting Task. `longest_task_waiting_sid`: The SID of the longest waiting Task. `tasks_by_status`: The number of Tasks grouped by their current status. `tasks_by_priority`: The number of Tasks grouped by priority. `activity_statistics`: The number of current Workers grouped by Activity. */ taskQueueData: Array<any>; /** * The number of TaskQueue statistics received in task_queue_data. */ taskQueueResponseCount: number; /** * The absolute URL of the TaskQueue statistics resource. */ url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; workspaceSid: string; taskQueueData: any[]; taskQueueResponseCount: number; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/taskQueue/taskQueueRealTimeStatistics.js000064400000014411151677225100022231 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.TaskQueueRealTimeStatisticsListInstance = exports.TaskQueueRealTimeStatisticsInstance = exports.TaskQueueRealTimeStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class TaskQueueRealTimeStatisticsContextImpl { constructor(_version, workspaceSid, taskQueueSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(taskQueueSid)) { throw new Error("Parameter 'taskQueueSid' is not valid."); } this._solution = { workspaceSid, taskQueueSid }; this._uri = `/Workspaces/${workspaceSid}/TaskQueues/${taskQueueSid}/RealTimeStatistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TaskQueueRealTimeStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.taskQueueSid)); 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.TaskQueueRealTimeStatisticsContextImpl = TaskQueueRealTimeStatisticsContextImpl; class TaskQueueRealTimeStatisticsInstance { constructor(_version, payload, workspaceSid, taskQueueSid) { this._version = _version; this.accountSid = payload.account_sid; this.activityStatistics = payload.activity_statistics; this.longestTaskWaitingAge = deserialize.integer(payload.longest_task_waiting_age); this.longestTaskWaitingSid = payload.longest_task_waiting_sid; this.longestRelativeTaskAgeInQueue = deserialize.integer(payload.longest_relative_task_age_in_queue); this.longestRelativeTaskSidInQueue = payload.longest_relative_task_sid_in_queue; this.taskQueueSid = payload.task_queue_sid; this.tasksByPriority = payload.tasks_by_priority; this.tasksByStatus = payload.tasks_by_status; this.totalAvailableWorkers = deserialize.integer(payload.total_available_workers); this.totalEligibleWorkers = deserialize.integer(payload.total_eligible_workers); this.totalTasks = deserialize.integer(payload.total_tasks); this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid, taskQueueSid }; } get _proxy() { this._context = this._context || new TaskQueueRealTimeStatisticsContextImpl(this._version, this._solution.workspaceSid, this._solution.taskQueueSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, activityStatistics: this.activityStatistics, longestTaskWaitingAge: this.longestTaskWaitingAge, longestTaskWaitingSid: this.longestTaskWaitingSid, longestRelativeTaskAgeInQueue: this.longestRelativeTaskAgeInQueue, longestRelativeTaskSidInQueue: this.longestRelativeTaskSidInQueue, taskQueueSid: this.taskQueueSid, tasksByPriority: this.tasksByPriority, tasksByStatus: this.tasksByStatus, totalAvailableWorkers: this.totalAvailableWorkers, totalEligibleWorkers: this.totalEligibleWorkers, totalTasks: this.totalTasks, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskQueueRealTimeStatisticsInstance = TaskQueueRealTimeStatisticsInstance; function TaskQueueRealTimeStatisticsListInstance(version, workspaceSid, taskQueueSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(taskQueueSid)) { throw new Error("Parameter 'taskQueueSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new TaskQueueRealTimeStatisticsContextImpl(version, workspaceSid, taskQueueSid); }; instance._version = version; instance._solution = { workspaceSid, taskQueueSid }; 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; } exports.TaskQueueRealTimeStatisticsListInstance = TaskQueueRealTimeStatisticsListInstance; rest/taskrouter/v1/workspace/taskQueue/taskQueueCumulativeStatistics.js000064400000017427151677225100022657 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.TaskQueueCumulativeStatisticsListInstance = exports.TaskQueueCumulativeStatisticsInstance = exports.TaskQueueCumulativeStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class TaskQueueCumulativeStatisticsContextImpl { constructor(_version, workspaceSid, taskQueueSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(taskQueueSid)) { throw new Error("Parameter 'taskQueueSid' is not valid."); } this._solution = { workspaceSid, taskQueueSid }; this._uri = `/Workspaces/${workspaceSid}/TaskQueues/${taskQueueSid}/CumulativeStatistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["splitByWaitTime"] !== undefined) data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TaskQueueCumulativeStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.taskQueueSid)); 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.TaskQueueCumulativeStatisticsContextImpl = TaskQueueCumulativeStatisticsContextImpl; class TaskQueueCumulativeStatisticsInstance { constructor(_version, payload, workspaceSid, taskQueueSid) { this._version = _version; this.accountSid = payload.account_sid; this.avgTaskAcceptanceTime = deserialize.integer(payload.avg_task_acceptance_time); this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.reservationsCreated = deserialize.integer(payload.reservations_created); this.reservationsAccepted = deserialize.integer(payload.reservations_accepted); this.reservationsRejected = deserialize.integer(payload.reservations_rejected); this.reservationsTimedOut = deserialize.integer(payload.reservations_timed_out); this.reservationsCanceled = deserialize.integer(payload.reservations_canceled); this.reservationsRescinded = deserialize.integer(payload.reservations_rescinded); this.splitByWaitTime = payload.split_by_wait_time; this.taskQueueSid = payload.task_queue_sid; this.waitDurationUntilAccepted = payload.wait_duration_until_accepted; this.waitDurationUntilCanceled = payload.wait_duration_until_canceled; this.waitDurationInQueueUntilAccepted = payload.wait_duration_in_queue_until_accepted; this.tasksCanceled = deserialize.integer(payload.tasks_canceled); this.tasksCompleted = deserialize.integer(payload.tasks_completed); this.tasksDeleted = deserialize.integer(payload.tasks_deleted); this.tasksEntered = deserialize.integer(payload.tasks_entered); this.tasksMoved = deserialize.integer(payload.tasks_moved); this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid, taskQueueSid }; } get _proxy() { this._context = this._context || new TaskQueueCumulativeStatisticsContextImpl(this._version, this._solution.workspaceSid, this._solution.taskQueueSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, avgTaskAcceptanceTime: this.avgTaskAcceptanceTime, startTime: this.startTime, endTime: this.endTime, reservationsCreated: this.reservationsCreated, reservationsAccepted: this.reservationsAccepted, reservationsRejected: this.reservationsRejected, reservationsTimedOut: this.reservationsTimedOut, reservationsCanceled: this.reservationsCanceled, reservationsRescinded: this.reservationsRescinded, splitByWaitTime: this.splitByWaitTime, taskQueueSid: this.taskQueueSid, waitDurationUntilAccepted: this.waitDurationUntilAccepted, waitDurationUntilCanceled: this.waitDurationUntilCanceled, waitDurationInQueueUntilAccepted: this.waitDurationInQueueUntilAccepted, tasksCanceled: this.tasksCanceled, tasksCompleted: this.tasksCompleted, tasksDeleted: this.tasksDeleted, tasksEntered: this.tasksEntered, tasksMoved: this.tasksMoved, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskQueueCumulativeStatisticsInstance = TaskQueueCumulativeStatisticsInstance; function TaskQueueCumulativeStatisticsListInstance(version, workspaceSid, taskQueueSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(taskQueueSid)) { throw new Error("Parameter 'taskQueueSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new TaskQueueCumulativeStatisticsContextImpl(version, workspaceSid, taskQueueSid); }; instance._version = version; instance._solution = { workspaceSid, taskQueueSid }; 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; } exports.TaskQueueCumulativeStatisticsListInstance = TaskQueueCumulativeStatisticsListInstance; rest/taskrouter/v1/workspace/taskQueue/taskQueueRealTimeStatistics.d.ts000064400000016155151677225100022474 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a TaskQueueRealTimeStatisticsInstance */ export interface TaskQueueRealTimeStatisticsContextFetchOptions { /** The TaskChannel for which to fetch statistics. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; } export interface TaskQueueRealTimeStatisticsContext { /** * Fetch a TaskQueueRealTimeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueRealTimeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: TaskQueueRealTimeStatisticsInstance) => any): Promise<TaskQueueRealTimeStatisticsInstance>; /** * Fetch a TaskQueueRealTimeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueRealTimeStatisticsInstance */ fetch(params: TaskQueueRealTimeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: TaskQueueRealTimeStatisticsInstance) => any): Promise<TaskQueueRealTimeStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TaskQueueRealTimeStatisticsContextSolution { workspaceSid: string; taskQueueSid: string; } export declare class TaskQueueRealTimeStatisticsContextImpl implements TaskQueueRealTimeStatisticsContext { protected _version: V1; protected _solution: TaskQueueRealTimeStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, taskQueueSid: string); fetch(params?: TaskQueueRealTimeStatisticsContextFetchOptions | ((error: Error | null, item?: TaskQueueRealTimeStatisticsInstance) => any), callback?: (error: Error | null, item?: TaskQueueRealTimeStatisticsInstance) => any): Promise<TaskQueueRealTimeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TaskQueueRealTimeStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TaskQueueRealTimeStatisticsResource { account_sid: string; activity_statistics: Array<any>; longest_task_waiting_age: number; longest_task_waiting_sid: string; longest_relative_task_age_in_queue: number; longest_relative_task_sid_in_queue: string; task_queue_sid: string; tasks_by_priority: any; tasks_by_status: any; total_available_workers: number; total_eligible_workers: number; total_tasks: number; workspace_sid: string; url: string; } export declare class TaskQueueRealTimeStatisticsInstance { protected _version: V1; protected _solution: TaskQueueRealTimeStatisticsContextSolution; protected _context?: TaskQueueRealTimeStatisticsContext; constructor(_version: V1, payload: TaskQueueRealTimeStatisticsResource, workspaceSid: string, taskQueueSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. */ accountSid: string; /** * The number of current Workers by Activity. */ activityStatistics: Array<any>; /** * The age of the longest waiting Task. */ longestTaskWaitingAge: number; /** * The SID of the longest waiting Task. */ longestTaskWaitingSid: string; /** * The relative age in the TaskQueue for the longest waiting Task. Calculation is based on the time when the Task entered the TaskQueue. */ longestRelativeTaskAgeInQueue: number; /** * The Task SID of the Task waiting in the TaskQueue the longest. Calculation is based on the time when the Task entered the TaskQueue. */ longestRelativeTaskSidInQueue: string; /** * The SID of the TaskQueue from which these statistics were calculated. */ taskQueueSid: string; /** * The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. */ tasksByPriority: any; /** * The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. */ tasksByStatus: any; /** * The total number of Workers available for Tasks in the TaskQueue. */ totalAvailableWorkers: number; /** * The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state. */ totalEligibleWorkers: number; /** * The total number of Tasks. */ totalTasks: number; /** * The SID of the Workspace that contains the TaskQueue. */ workspaceSid: string; /** * The absolute URL of the TaskQueue statistics resource. */ url: string; private get _proxy(); /** * Fetch a TaskQueueRealTimeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueRealTimeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: TaskQueueRealTimeStatisticsInstance) => any): Promise<TaskQueueRealTimeStatisticsInstance>; /** * Fetch a TaskQueueRealTimeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueRealTimeStatisticsInstance */ fetch(params: TaskQueueRealTimeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: TaskQueueRealTimeStatisticsInstance) => any): Promise<TaskQueueRealTimeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; activityStatistics: any[]; longestTaskWaitingAge: number; longestTaskWaitingSid: string; longestRelativeTaskAgeInQueue: number; longestRelativeTaskSidInQueue: string; taskQueueSid: string; tasksByPriority: any; tasksByStatus: any; totalAvailableWorkers: number; totalEligibleWorkers: number; totalTasks: number; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TaskQueueRealTimeStatisticsSolution { workspaceSid: string; taskQueueSid: string; } export interface TaskQueueRealTimeStatisticsListInstance { _version: V1; _solution: TaskQueueRealTimeStatisticsSolution; _uri: string; (): TaskQueueRealTimeStatisticsContext; get(): TaskQueueRealTimeStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TaskQueueRealTimeStatisticsListInstance(version: V1, workspaceSid: string, taskQueueSid: string): TaskQueueRealTimeStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/taskQueue/taskQueueBulkRealTimeStatistics.js000064400000006636151677225100023061 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.TaskQueueBulkRealTimeStatisticsInstance = exports.TaskQueueBulkRealTimeStatisticsListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function TaskQueueBulkRealTimeStatisticsListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { workspaceSid }; instance._uri = `/Workspaces/${workspaceSid}/TaskQueues/RealTimeStatistics`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; data = params; const headers = {}; headers["Content-Type"] = "application/json"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TaskQueueBulkRealTimeStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid)); 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; } exports.TaskQueueBulkRealTimeStatisticsListInstance = TaskQueueBulkRealTimeStatisticsListInstance; class TaskQueueBulkRealTimeStatisticsInstance { constructor(_version, payload, workspaceSid) { this._version = _version; this.accountSid = payload.account_sid; this.workspaceSid = payload.workspace_sid; this.taskQueueData = payload.task_queue_data; this.taskQueueResponseCount = deserialize.integer(payload.task_queue_response_count); this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, workspaceSid: this.workspaceSid, taskQueueData: this.taskQueueData, taskQueueResponseCount: this.taskQueueResponseCount, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskQueueBulkRealTimeStatisticsInstance = TaskQueueBulkRealTimeStatisticsInstance; rest/taskrouter/v1/workspace/taskQueue.js000064400000035176151677225100014577 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.TaskQueuePage = exports.TaskQueueListInstance = exports.TaskQueueInstance = exports.TaskQueueContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const taskQueueBulkRealTimeStatistics_1 = require("./taskQueue/taskQueueBulkRealTimeStatistics"); const taskQueueCumulativeStatistics_1 = require("./taskQueue/taskQueueCumulativeStatistics"); const taskQueueRealTimeStatistics_1 = require("./taskQueue/taskQueueRealTimeStatistics"); const taskQueueStatistics_1 = require("./taskQueue/taskQueueStatistics"); const taskQueuesStatistics_1 = require("./taskQueue/taskQueuesStatistics"); class TaskQueueContextImpl { constructor(_version, workspaceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, sid }; this._uri = `/Workspaces/${workspaceSid}/TaskQueues/${sid}`; } get cumulativeStatistics() { this._cumulativeStatistics = this._cumulativeStatistics || (0, taskQueueCumulativeStatistics_1.TaskQueueCumulativeStatisticsListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._cumulativeStatistics; } get realTimeStatistics() { this._realTimeStatistics = this._realTimeStatistics || (0, taskQueueRealTimeStatistics_1.TaskQueueRealTimeStatisticsListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._realTimeStatistics; } get statistics() { this._statistics = this._statistics || (0, taskQueueStatistics_1.TaskQueueStatisticsListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._statistics; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TaskQueueInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["targetWorkers"] !== undefined) data["TargetWorkers"] = params["targetWorkers"]; if (params["reservationActivitySid"] !== undefined) data["ReservationActivitySid"] = params["reservationActivitySid"]; if (params["assignmentActivitySid"] !== undefined) data["AssignmentActivitySid"] = params["assignmentActivitySid"]; if (params["maxReservedWorkers"] !== undefined) data["MaxReservedWorkers"] = params["maxReservedWorkers"]; if (params["taskOrder"] !== undefined) data["TaskOrder"] = params["taskOrder"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TaskQueueInstance(operationVersion, payload, instance._solution.workspaceSid, 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.TaskQueueContextImpl = TaskQueueContextImpl; class TaskQueueInstance { constructor(_version, payload, workspaceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.assignmentActivitySid = payload.assignment_activity_sid; this.assignmentActivityName = payload.assignment_activity_name; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.maxReservedWorkers = deserialize.integer(payload.max_reserved_workers); this.reservationActivitySid = payload.reservation_activity_sid; this.reservationActivityName = payload.reservation_activity_name; this.sid = payload.sid; this.targetWorkers = payload.target_workers; this.taskOrder = payload.task_order; this.url = payload.url; this.workspaceSid = payload.workspace_sid; this.links = payload.links; this._solution = { workspaceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TaskQueueContextImpl(this._version, this._solution.workspaceSid, this._solution.sid); return this._context; } /** * Remove a TaskQueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TaskQueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the cumulativeStatistics. */ cumulativeStatistics() { return this._proxy.cumulativeStatistics; } /** * Access the realTimeStatistics. */ realTimeStatistics() { return this._proxy.realTimeStatistics; } /** * Access the statistics. */ statistics() { return this._proxy.statistics; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, assignmentActivitySid: this.assignmentActivitySid, assignmentActivityName: this.assignmentActivityName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, maxReservedWorkers: this.maxReservedWorkers, reservationActivitySid: this.reservationActivitySid, reservationActivityName: this.reservationActivityName, sid: this.sid, targetWorkers: this.targetWorkers, taskOrder: this.taskOrder, url: this.url, workspaceSid: this.workspaceSid, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskQueueInstance = TaskQueueInstance; function TaskQueueListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TaskQueueContextImpl(version, workspaceSid, sid); }; instance._version = version; instance._solution = { workspaceSid }; instance._uri = `/Workspaces/${workspaceSid}/TaskQueues`; Object.defineProperty(instance, "bulkRealTimeStatistics", { get: function bulkRealTimeStatistics() { if (!instance._bulkRealTimeStatistics) { instance._bulkRealTimeStatistics = (0, taskQueueBulkRealTimeStatistics_1.TaskQueueBulkRealTimeStatisticsListInstance)(instance._version, instance._solution.workspaceSid); } return instance._bulkRealTimeStatistics; }, }); Object.defineProperty(instance, "statistics", { get: function statistics() { if (!instance._statistics) { instance._statistics = (0, taskQueuesStatistics_1.TaskQueuesStatisticsListInstance)(instance._version, instance._solution.workspaceSid); } return instance._statistics; }, }); instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["targetWorkers"] !== undefined) data["TargetWorkers"] = params["targetWorkers"]; if (params["maxReservedWorkers"] !== undefined) data["MaxReservedWorkers"] = params["maxReservedWorkers"]; if (params["taskOrder"] !== undefined) data["TaskOrder"] = params["taskOrder"]; if (params["reservationActivitySid"] !== undefined) data["ReservationActivitySid"] = params["reservationActivitySid"]; if (params["assignmentActivitySid"] !== undefined) data["AssignmentActivitySid"] = params["assignmentActivitySid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TaskQueueInstance(operationVersion, payload, instance._solution.workspaceSid)); 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["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["evaluateWorkerAttributes"] !== undefined) data["EvaluateWorkerAttributes"] = params["evaluateWorkerAttributes"]; if (params["workerSid"] !== undefined) data["WorkerSid"] = params["workerSid"]; if (params["ordering"] !== undefined) data["Ordering"] = params["ordering"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TaskQueuePage(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 TaskQueuePage(instance._version, payload, 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; } exports.TaskQueueListInstance = TaskQueueListInstance; class TaskQueuePage extends Page_1.default { /** * Initialize the TaskQueuePage * * @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 TaskQueueInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TaskQueueInstance(this._version, payload, this._solution.workspaceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskQueuePage = TaskQueuePage; rest/taskrouter/v1/workspace/activity.d.ts000064400000032575151677225100014720 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to update a ActivityInstance */ export interface ActivityContextUpdateOptions { /** A descriptive string that you create to describe the Activity resource. It can be up to 64 characters long. These names are used to calculate and expose statistics about Workers, and provide visibility into the state of each Worker. Examples of friendly names include: `on-call`, `break`, and `email`. */ friendlyName?: string; } /** * Options to pass to create a ActivityInstance */ export interface ActivityListInstanceCreateOptions { /** A descriptive string that you create to describe the Activity resource. It can be up to 64 characters long. These names are used to calculate and expose statistics about Workers, and provide visibility into the state of each Worker. Examples of friendly names include: `on-call`, `break`, and `email`. */ friendlyName: string; /** Whether the Worker should be eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` specifies the Activity is available. All other values specify that it is not. The value cannot be changed after the Activity is created. */ available?: boolean; } /** * Options to pass to each */ export interface ActivityListInstanceEachOptions { /** The `friendly_name` of the Activity resources to read. */ friendlyName?: string; /** Whether return only Activity resources that are available or unavailable. A value of `true` returns only available activities. Values of \'1\' or `yes` also indicate `true`. All other values represent `false` and return activities that are unavailable. */ available?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ActivityInstance, 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 ActivityListInstanceOptions { /** The `friendly_name` of the Activity resources to read. */ friendlyName?: string; /** Whether return only Activity resources that are available or unavailable. A value of `true` returns only available activities. Values of \'1\' or `yes` also indicate `true`. All other values represent `false` and return activities that are unavailable. */ available?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ActivityListInstancePageOptions { /** The `friendly_name` of the Activity resources to read. */ friendlyName?: string; /** Whether return only Activity resources that are available or unavailable. A value of `true` returns only available activities. Values of \'1\' or `yes` also indicate `true`. All other values represent `false` and return activities that are unavailable. */ available?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ActivityContext { /** * Remove a ActivityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ActivityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ActivityInstance */ fetch(callback?: (error: Error | null, item?: ActivityInstance) => any): Promise<ActivityInstance>; /** * Update a ActivityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ActivityInstance */ update(callback?: (error: Error | null, item?: ActivityInstance) => any): Promise<ActivityInstance>; /** * Update a ActivityInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ActivityInstance */ update(params: ActivityContextUpdateOptions, callback?: (error: Error | null, item?: ActivityInstance) => any): Promise<ActivityInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ActivityContextSolution { workspaceSid: string; sid: string; } export declare class ActivityContextImpl implements ActivityContext { protected _version: V1; protected _solution: ActivityContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ActivityInstance) => any): Promise<ActivityInstance>; update(params?: ActivityContextUpdateOptions | ((error: Error | null, item?: ActivityInstance) => any), callback?: (error: Error | null, item?: ActivityInstance) => any): Promise<ActivityInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ActivityContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ActivityPayload extends TwilioResponsePayload { activities: ActivityResource[]; } interface ActivityResource { account_sid: string; available: boolean; date_created: Date; date_updated: Date; friendly_name: string; sid: string; workspace_sid: string; url: string; links: Record<string, string>; } export declare class ActivityInstance { protected _version: V1; protected _solution: ActivityContextSolution; protected _context?: ActivityContext; constructor(_version: V1, payload: ActivityResource, workspaceSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Activity resource. */ accountSid: string; /** * Whether the Worker is eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` indicates the Activity is available. All other values indicate that it is not. The value cannot be changed after the Activity is created. */ available: boolean; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The string that you assigned to describe the Activity resource. */ friendlyName: string; /** * The unique string that we created to identify the Activity resource. */ sid: string; /** * The SID of the Workspace that contains the Activity. */ workspaceSid: string; /** * The absolute URL of the Activity resource. */ url: string; links: Record<string, string>; private get _proxy(); /** * Remove a ActivityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ActivityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ActivityInstance */ fetch(callback?: (error: Error | null, item?: ActivityInstance) => any): Promise<ActivityInstance>; /** * Update a ActivityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ActivityInstance */ update(callback?: (error: Error | null, item?: ActivityInstance) => any): Promise<ActivityInstance>; /** * Update a ActivityInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ActivityInstance */ update(params: ActivityContextUpdateOptions, callback?: (error: Error | null, item?: ActivityInstance) => any): Promise<ActivityInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; available: boolean; dateCreated: Date; dateUpdated: Date; friendlyName: string; sid: string; workspaceSid: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ActivitySolution { workspaceSid: string; } export interface ActivityListInstance { _version: V1; _solution: ActivitySolution; _uri: string; (sid: string): ActivityContext; get(sid: string): ActivityContext; /** * Create a ActivityInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ActivityInstance */ create(params: ActivityListInstanceCreateOptions, callback?: (error: Error | null, item?: ActivityInstance) => any): Promise<ActivityInstance>; /** * Streams ActivityInstance 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 { ActivityListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ActivityInstance, done: (err?: Error) => void) => void): void; each(params: ActivityListInstanceEachOptions, callback?: (item: ActivityInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ActivityInstance 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: ActivityPage) => any): Promise<ActivityPage>; /** * Lists ActivityInstance 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 { ActivityListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ActivityInstance[]) => any): Promise<ActivityInstance[]>; list(params: ActivityListInstanceOptions, callback?: (error: Error | null, items: ActivityInstance[]) => any): Promise<ActivityInstance[]>; /** * Retrieve a single page of ActivityInstance 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 { ActivityListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ActivityPage) => any): Promise<ActivityPage>; page(params: ActivityListInstancePageOptions, callback?: (error: Error | null, items: ActivityPage) => any): Promise<ActivityPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ActivityListInstance(version: V1, workspaceSid: string): ActivityListInstance; export declare class ActivityPage extends Page<V1, ActivityPayload, ActivityResource, ActivityInstance> { /** * Initialize the ActivityPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ActivitySolution); /** * Build an instance of ActivityInstance * * @param payload - Payload response from the API */ getInstance(payload: ActivityResource): ActivityInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/activity.js000064400000024045151677225100014455 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.ActivityPage = exports.ActivityListInstance = exports.ActivityInstance = exports.ActivityContextImpl = void 0; 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 ActivityContextImpl { constructor(_version, workspaceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, sid }; this._uri = `/Workspaces/${workspaceSid}/Activities/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ActivityInstance(operationVersion, payload, instance._solution.workspaceSid, 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"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ActivityInstance(operationVersion, payload, instance._solution.workspaceSid, 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.ActivityContextImpl = ActivityContextImpl; class ActivityInstance { constructor(_version, payload, workspaceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.available = payload.available; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.sid = payload.sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this.links = payload.links; this._solution = { workspaceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ActivityContextImpl(this._version, this._solution.workspaceSid, this._solution.sid); return this._context; } /** * Remove a ActivityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ActivityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ActivityInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, available: this.available, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, sid: this.sid, workspaceSid: this.workspaceSid, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ActivityInstance = ActivityInstance; function ActivityListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ActivityContextImpl(version, workspaceSid, sid); }; instance._version = version; instance._solution = { workspaceSid }; instance._uri = `/Workspaces/${workspaceSid}/Activities`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["available"] !== undefined) data["Available"] = serialize.bool(params["available"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ActivityInstance(operationVersion, payload, instance._solution.workspaceSid)); 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["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["available"] !== undefined) data["Available"] = params["available"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ActivityPage(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 ActivityPage(instance._version, payload, 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; } exports.ActivityListInstance = ActivityListInstance; class ActivityPage extends Page_1.default { /** * Initialize the ActivityPage * * @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 ActivityInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ActivityInstance(this._version, payload, this._solution.workspaceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ActivityPage = ActivityPage; rest/taskrouter/v1/workspace/workflow.js000064400000032407151677225100014474 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkflowPage = exports.WorkflowListInstance = exports.WorkflowInstance = exports.WorkflowContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const workflowCumulativeStatistics_1 = require("./workflow/workflowCumulativeStatistics"); const workflowRealTimeStatistics_1 = require("./workflow/workflowRealTimeStatistics"); const workflowStatistics_1 = require("./workflow/workflowStatistics"); class WorkflowContextImpl { constructor(_version, workspaceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, sid }; this._uri = `/Workspaces/${workspaceSid}/Workflows/${sid}`; } get cumulativeStatistics() { this._cumulativeStatistics = this._cumulativeStatistics || (0, workflowCumulativeStatistics_1.WorkflowCumulativeStatisticsListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._cumulativeStatistics; } get realTimeStatistics() { this._realTimeStatistics = this._realTimeStatistics || (0, workflowRealTimeStatistics_1.WorkflowRealTimeStatisticsListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._realTimeStatistics; } get statistics() { this._statistics = this._statistics || (0, workflowStatistics_1.WorkflowStatisticsListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._statistics; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WorkflowInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["assignmentCallbackUrl"] !== undefined) data["AssignmentCallbackUrl"] = params["assignmentCallbackUrl"]; if (params["fallbackAssignmentCallbackUrl"] !== undefined) data["FallbackAssignmentCallbackUrl"] = params["fallbackAssignmentCallbackUrl"]; if (params["configuration"] !== undefined) data["Configuration"] = params["configuration"]; if (params["taskReservationTimeout"] !== undefined) data["TaskReservationTimeout"] = params["taskReservationTimeout"]; if (params["reEvaluateTasks"] !== undefined) data["ReEvaluateTasks"] = params["reEvaluateTasks"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WorkflowInstance(operationVersion, payload, instance._solution.workspaceSid, 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.WorkflowContextImpl = WorkflowContextImpl; class WorkflowInstance { constructor(_version, payload, workspaceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.assignmentCallbackUrl = payload.assignment_callback_url; this.configuration = payload.configuration; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.documentContentType = payload.document_content_type; this.fallbackAssignmentCallbackUrl = payload.fallback_assignment_callback_url; this.friendlyName = payload.friendly_name; this.sid = payload.sid; this.taskReservationTimeout = deserialize.integer(payload.task_reservation_timeout); this.workspaceSid = payload.workspace_sid; this.url = payload.url; this.links = payload.links; this._solution = { workspaceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WorkflowContextImpl(this._version, this._solution.workspaceSid, this._solution.sid); return this._context; } /** * Remove a WorkflowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a WorkflowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the cumulativeStatistics. */ cumulativeStatistics() { return this._proxy.cumulativeStatistics; } /** * Access the realTimeStatistics. */ realTimeStatistics() { return this._proxy.realTimeStatistics; } /** * Access the statistics. */ statistics() { return this._proxy.statistics; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, assignmentCallbackUrl: this.assignmentCallbackUrl, configuration: this.configuration, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, documentContentType: this.documentContentType, fallbackAssignmentCallbackUrl: this.fallbackAssignmentCallbackUrl, friendlyName: this.friendlyName, sid: this.sid, taskReservationTimeout: this.taskReservationTimeout, workspaceSid: this.workspaceSid, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkflowInstance = WorkflowInstance; function WorkflowListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WorkflowContextImpl(version, workspaceSid, sid); }; instance._version = version; instance._solution = { workspaceSid }; instance._uri = `/Workspaces/${workspaceSid}/Workflows`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["configuration"] === null || params["configuration"] === undefined) { throw new Error("Required parameter \"params['configuration']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Configuration"] = params["configuration"]; if (params["assignmentCallbackUrl"] !== undefined) data["AssignmentCallbackUrl"] = params["assignmentCallbackUrl"]; if (params["fallbackAssignmentCallbackUrl"] !== undefined) data["FallbackAssignmentCallbackUrl"] = params["fallbackAssignmentCallbackUrl"]; if (params["taskReservationTimeout"] !== undefined) data["TaskReservationTimeout"] = params["taskReservationTimeout"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WorkflowInstance(operationVersion, payload, instance._solution.workspaceSid)); 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["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkflowPage(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 WorkflowPage(instance._version, payload, 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; } exports.WorkflowListInstance = WorkflowListInstance; class WorkflowPage extends Page_1.default { /** * Initialize the WorkflowPage * * @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 WorkflowInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WorkflowInstance(this._version, payload, this._solution.workspaceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkflowPage = WorkflowPage; rest/taskrouter/v1/workspace/workflow/workflowRealTimeStatistics.d.ts000064400000013661151677225100022301 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a WorkflowRealTimeStatisticsInstance */ export interface WorkflowRealTimeStatisticsContextFetchOptions { /** Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; } export interface WorkflowRealTimeStatisticsContext { /** * Fetch a WorkflowRealTimeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowRealTimeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkflowRealTimeStatisticsInstance) => any): Promise<WorkflowRealTimeStatisticsInstance>; /** * Fetch a WorkflowRealTimeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowRealTimeStatisticsInstance */ fetch(params: WorkflowRealTimeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkflowRealTimeStatisticsInstance) => any): Promise<WorkflowRealTimeStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkflowRealTimeStatisticsContextSolution { workspaceSid: string; workflowSid: string; } export declare class WorkflowRealTimeStatisticsContextImpl implements WorkflowRealTimeStatisticsContext { protected _version: V1; protected _solution: WorkflowRealTimeStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, workflowSid: string); fetch(params?: WorkflowRealTimeStatisticsContextFetchOptions | ((error: Error | null, item?: WorkflowRealTimeStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkflowRealTimeStatisticsInstance) => any): Promise<WorkflowRealTimeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkflowRealTimeStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkflowRealTimeStatisticsResource { account_sid: string; longest_task_waiting_age: number; longest_task_waiting_sid: string; tasks_by_priority: any; tasks_by_status: any; total_tasks: number; workflow_sid: string; workspace_sid: string; url: string; } export declare class WorkflowRealTimeStatisticsInstance { protected _version: V1; protected _solution: WorkflowRealTimeStatisticsContextSolution; protected _context?: WorkflowRealTimeStatisticsContext; constructor(_version: V1, payload: WorkflowRealTimeStatisticsResource, workspaceSid: string, workflowSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. */ accountSid: string; /** * The age of the longest waiting Task. */ longestTaskWaitingAge: number; /** * The SID of the longest waiting Task. */ longestTaskWaitingSid: string; /** * The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. */ tasksByPriority: any; /** * The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. */ tasksByStatus: any; /** * The total number of Tasks. */ totalTasks: number; /** * Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. */ workflowSid: string; /** * The SID of the Workspace that contains the Workflow. */ workspaceSid: string; /** * The absolute URL of the Workflow statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkflowRealTimeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowRealTimeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkflowRealTimeStatisticsInstance) => any): Promise<WorkflowRealTimeStatisticsInstance>; /** * Fetch a WorkflowRealTimeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowRealTimeStatisticsInstance */ fetch(params: WorkflowRealTimeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkflowRealTimeStatisticsInstance) => any): Promise<WorkflowRealTimeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; longestTaskWaitingAge: number; longestTaskWaitingSid: string; tasksByPriority: any; tasksByStatus: any; totalTasks: number; workflowSid: string; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkflowRealTimeStatisticsSolution { workspaceSid: string; workflowSid: string; } export interface WorkflowRealTimeStatisticsListInstance { _version: V1; _solution: WorkflowRealTimeStatisticsSolution; _uri: string; (): WorkflowRealTimeStatisticsContext; get(): WorkflowRealTimeStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkflowRealTimeStatisticsListInstance(version: V1, workspaceSid: string, workflowSid: string): WorkflowRealTimeStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.d.ts000064400000023214151677225100022710 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a WorkflowCumulativeStatisticsInstance */ export interface WorkflowCumulativeStatisticsContextFetchOptions { /** Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. TaskRouter will calculate statistics on up to 10,000 Tasks for any given threshold. */ splitByWaitTime?: string; } export interface WorkflowCumulativeStatisticsContext { /** * Fetch a WorkflowCumulativeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowCumulativeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkflowCumulativeStatisticsInstance) => any): Promise<WorkflowCumulativeStatisticsInstance>; /** * Fetch a WorkflowCumulativeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowCumulativeStatisticsInstance */ fetch(params: WorkflowCumulativeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkflowCumulativeStatisticsInstance) => any): Promise<WorkflowCumulativeStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkflowCumulativeStatisticsContextSolution { workspaceSid: string; workflowSid: string; } export declare class WorkflowCumulativeStatisticsContextImpl implements WorkflowCumulativeStatisticsContext { protected _version: V1; protected _solution: WorkflowCumulativeStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, workflowSid: string); fetch(params?: WorkflowCumulativeStatisticsContextFetchOptions | ((error: Error | null, item?: WorkflowCumulativeStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkflowCumulativeStatisticsInstance) => any): Promise<WorkflowCumulativeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkflowCumulativeStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkflowCumulativeStatisticsResource { account_sid: string; avg_task_acceptance_time: number; start_time: Date; end_time: Date; reservations_created: number; reservations_accepted: number; reservations_rejected: number; reservations_timed_out: number; reservations_canceled: number; reservations_rescinded: number; split_by_wait_time: any; wait_duration_until_accepted: any; wait_duration_until_canceled: any; tasks_canceled: number; tasks_completed: number; tasks_entered: number; tasks_deleted: number; tasks_moved: number; tasks_timed_out_in_workflow: number; workflow_sid: string; workspace_sid: string; url: string; } export declare class WorkflowCumulativeStatisticsInstance { protected _version: V1; protected _solution: WorkflowCumulativeStatisticsContextSolution; protected _context?: WorkflowCumulativeStatisticsContext; constructor(_version: V1, payload: WorkflowCumulativeStatisticsResource, workspaceSid: string, workflowSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. */ accountSid: string; /** * The average time in seconds between Task creation and acceptance. */ avgTaskAcceptanceTime: number; /** * The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startTime: Date; /** * The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ endTime: Date; /** * The total number of Reservations that were created for Workers. */ reservationsCreated: number; /** * The total number of Reservations accepted by Workers. */ reservationsAccepted: number; /** * The total number of Reservations that were rejected. */ reservationsRejected: number; /** * The total number of Reservations that were timed out. */ reservationsTimedOut: number; /** * The total number of Reservations that were canceled. */ reservationsCanceled: number; /** * The total number of Reservations that were rescinded. */ reservationsRescinded: number; /** * A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. */ splitByWaitTime: any; /** * The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. */ waitDurationUntilAccepted: any; /** * The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. */ waitDurationUntilCanceled: any; /** * The total number of Tasks that were canceled. */ tasksCanceled: number; /** * The total number of Tasks that were completed. */ tasksCompleted: number; /** * The total number of Tasks that entered the Workflow. */ tasksEntered: number; /** * The total number of Tasks that were deleted. */ tasksDeleted: number; /** * The total number of Tasks that were moved from one queue to another. */ tasksMoved: number; /** * The total number of Tasks that were timed out of their Workflows (and deleted). */ tasksTimedOutInWorkflow: number; /** * Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value. */ workflowSid: string; /** * The SID of the Workspace that contains the Workflow. */ workspaceSid: string; /** * The absolute URL of the Workflow statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkflowCumulativeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowCumulativeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkflowCumulativeStatisticsInstance) => any): Promise<WorkflowCumulativeStatisticsInstance>; /** * Fetch a WorkflowCumulativeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowCumulativeStatisticsInstance */ fetch(params: WorkflowCumulativeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkflowCumulativeStatisticsInstance) => any): Promise<WorkflowCumulativeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; avgTaskAcceptanceTime: number; startTime: Date; endTime: Date; reservationsCreated: number; reservationsAccepted: number; reservationsRejected: number; reservationsTimedOut: number; reservationsCanceled: number; reservationsRescinded: number; splitByWaitTime: any; waitDurationUntilAccepted: any; waitDurationUntilCanceled: any; tasksCanceled: number; tasksCompleted: number; tasksEntered: number; tasksDeleted: number; tasksMoved: number; tasksTimedOutInWorkflow: number; workflowSid: string; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkflowCumulativeStatisticsSolution { workspaceSid: string; workflowSid: string; } export interface WorkflowCumulativeStatisticsListInstance { _version: V1; _solution: WorkflowCumulativeStatisticsSolution; _uri: string; (): WorkflowCumulativeStatisticsContext; get(): WorkflowCumulativeStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkflowCumulativeStatisticsListInstance(version: V1, workspaceSid: string, workflowSid: string): WorkflowCumulativeStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/workflow/workflowCumulativeStatistics.js000064400000017330151677225100022456 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkflowCumulativeStatisticsListInstance = exports.WorkflowCumulativeStatisticsInstance = exports.WorkflowCumulativeStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class WorkflowCumulativeStatisticsContextImpl { constructor(_version, workspaceSid, workflowSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workflowSid)) { throw new Error("Parameter 'workflowSid' is not valid."); } this._solution = { workspaceSid, workflowSid }; this._uri = `/Workspaces/${workspaceSid}/Workflows/${workflowSid}/CumulativeStatistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["splitByWaitTime"] !== undefined) data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkflowCumulativeStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.workflowSid)); 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.WorkflowCumulativeStatisticsContextImpl = WorkflowCumulativeStatisticsContextImpl; class WorkflowCumulativeStatisticsInstance { constructor(_version, payload, workspaceSid, workflowSid) { this._version = _version; this.accountSid = payload.account_sid; this.avgTaskAcceptanceTime = deserialize.integer(payload.avg_task_acceptance_time); this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.reservationsCreated = deserialize.integer(payload.reservations_created); this.reservationsAccepted = deserialize.integer(payload.reservations_accepted); this.reservationsRejected = deserialize.integer(payload.reservations_rejected); this.reservationsTimedOut = deserialize.integer(payload.reservations_timed_out); this.reservationsCanceled = deserialize.integer(payload.reservations_canceled); this.reservationsRescinded = deserialize.integer(payload.reservations_rescinded); this.splitByWaitTime = payload.split_by_wait_time; this.waitDurationUntilAccepted = payload.wait_duration_until_accepted; this.waitDurationUntilCanceled = payload.wait_duration_until_canceled; this.tasksCanceled = deserialize.integer(payload.tasks_canceled); this.tasksCompleted = deserialize.integer(payload.tasks_completed); this.tasksEntered = deserialize.integer(payload.tasks_entered); this.tasksDeleted = deserialize.integer(payload.tasks_deleted); this.tasksMoved = deserialize.integer(payload.tasks_moved); this.tasksTimedOutInWorkflow = deserialize.integer(payload.tasks_timed_out_in_workflow); this.workflowSid = payload.workflow_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid, workflowSid }; } get _proxy() { this._context = this._context || new WorkflowCumulativeStatisticsContextImpl(this._version, this._solution.workspaceSid, this._solution.workflowSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, avgTaskAcceptanceTime: this.avgTaskAcceptanceTime, startTime: this.startTime, endTime: this.endTime, reservationsCreated: this.reservationsCreated, reservationsAccepted: this.reservationsAccepted, reservationsRejected: this.reservationsRejected, reservationsTimedOut: this.reservationsTimedOut, reservationsCanceled: this.reservationsCanceled, reservationsRescinded: this.reservationsRescinded, splitByWaitTime: this.splitByWaitTime, waitDurationUntilAccepted: this.waitDurationUntilAccepted, waitDurationUntilCanceled: this.waitDurationUntilCanceled, tasksCanceled: this.tasksCanceled, tasksCompleted: this.tasksCompleted, tasksEntered: this.tasksEntered, tasksDeleted: this.tasksDeleted, tasksMoved: this.tasksMoved, tasksTimedOutInWorkflow: this.tasksTimedOutInWorkflow, workflowSid: this.workflowSid, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkflowCumulativeStatisticsInstance = WorkflowCumulativeStatisticsInstance; function WorkflowCumulativeStatisticsListInstance(version, workspaceSid, workflowSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workflowSid)) { throw new Error("Parameter 'workflowSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkflowCumulativeStatisticsContextImpl(version, workspaceSid, workflowSid); }; instance._version = version; instance._solution = { workspaceSid, workflowSid }; 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; } exports.WorkflowCumulativeStatisticsListInstance = WorkflowCumulativeStatisticsListInstance; rest/taskrouter/v1/workspace/workflow/workflowStatistics.js000064400000012537151677225100020423 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkflowStatisticsListInstance = exports.WorkflowStatisticsInstance = exports.WorkflowStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class WorkflowStatisticsContextImpl { constructor(_version, workspaceSid, workflowSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workflowSid)) { throw new Error("Parameter 'workflowSid' is not valid."); } this._solution = { workspaceSid, workflowSid }; this._uri = `/Workspaces/${workspaceSid}/Workflows/${workflowSid}/Statistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["splitByWaitTime"] !== undefined) data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkflowStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.workflowSid)); 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.WorkflowStatisticsContextImpl = WorkflowStatisticsContextImpl; class WorkflowStatisticsInstance { constructor(_version, payload, workspaceSid, workflowSid) { this._version = _version; this.accountSid = payload.account_sid; this.cumulative = payload.cumulative; this.realtime = payload.realtime; this.workflowSid = payload.workflow_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid, workflowSid }; } get _proxy() { this._context = this._context || new WorkflowStatisticsContextImpl(this._version, this._solution.workspaceSid, this._solution.workflowSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, cumulative: this.cumulative, realtime: this.realtime, workflowSid: this.workflowSid, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkflowStatisticsInstance = WorkflowStatisticsInstance; function WorkflowStatisticsListInstance(version, workspaceSid, workflowSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workflowSid)) { throw new Error("Parameter 'workflowSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkflowStatisticsContextImpl(version, workspaceSid, workflowSid); }; instance._version = version; instance._solution = { workspaceSid, workflowSid }; 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; } exports.WorkflowStatisticsListInstance = WorkflowStatisticsListInstance; rest/taskrouter/v1/workspace/workflow/workflowStatistics.d.ts000064400000014065151677225100020655 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a WorkflowStatisticsInstance */ export interface WorkflowStatisticsContextFetchOptions { /** Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. */ splitByWaitTime?: string; } export interface WorkflowStatisticsContext { /** * Fetch a WorkflowStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkflowStatisticsInstance) => any): Promise<WorkflowStatisticsInstance>; /** * Fetch a WorkflowStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowStatisticsInstance */ fetch(params: WorkflowStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkflowStatisticsInstance) => any): Promise<WorkflowStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkflowStatisticsContextSolution { workspaceSid: string; workflowSid: string; } export declare class WorkflowStatisticsContextImpl implements WorkflowStatisticsContext { protected _version: V1; protected _solution: WorkflowStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, workflowSid: string); fetch(params?: WorkflowStatisticsContextFetchOptions | ((error: Error | null, item?: WorkflowStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkflowStatisticsInstance) => any): Promise<WorkflowStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkflowStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkflowStatisticsResource { account_sid: string; cumulative: any; realtime: any; workflow_sid: string; workspace_sid: string; url: string; } export declare class WorkflowStatisticsInstance { protected _version: V1; protected _solution: WorkflowStatisticsContextSolution; protected _context?: WorkflowStatisticsContext; constructor(_version: V1, payload: WorkflowStatisticsResource, workspaceSid: string, workflowSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. */ accountSid: string; /** * An object that contains the cumulative statistics for the Workflow. */ cumulative: any; /** * An object that contains the real-time statistics for the Workflow. */ realtime: any; /** * Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. */ workflowSid: string; /** * The SID of the Workspace that contains the Workflow. */ workspaceSid: string; /** * The absolute URL of the Workflow statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkflowStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkflowStatisticsInstance) => any): Promise<WorkflowStatisticsInstance>; /** * Fetch a WorkflowStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowStatisticsInstance */ fetch(params: WorkflowStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkflowStatisticsInstance) => any): Promise<WorkflowStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; cumulative: any; realtime: any; workflowSid: string; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkflowStatisticsSolution { workspaceSid: string; workflowSid: string; } export interface WorkflowStatisticsListInstance { _version: V1; _solution: WorkflowStatisticsSolution; _uri: string; (): WorkflowStatisticsContext; get(): WorkflowStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkflowStatisticsListInstance(version: V1, workspaceSid: string, workflowSid: string): WorkflowStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/workflow/workflowRealTimeStatistics.js000064400000012715151677225100022044 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkflowRealTimeStatisticsListInstance = exports.WorkflowRealTimeStatisticsInstance = exports.WorkflowRealTimeStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class WorkflowRealTimeStatisticsContextImpl { constructor(_version, workspaceSid, workflowSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workflowSid)) { throw new Error("Parameter 'workflowSid' is not valid."); } this._solution = { workspaceSid, workflowSid }; this._uri = `/Workspaces/${workspaceSid}/Workflows/${workflowSid}/RealTimeStatistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkflowRealTimeStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.workflowSid)); 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.WorkflowRealTimeStatisticsContextImpl = WorkflowRealTimeStatisticsContextImpl; class WorkflowRealTimeStatisticsInstance { constructor(_version, payload, workspaceSid, workflowSid) { this._version = _version; this.accountSid = payload.account_sid; this.longestTaskWaitingAge = deserialize.integer(payload.longest_task_waiting_age); this.longestTaskWaitingSid = payload.longest_task_waiting_sid; this.tasksByPriority = payload.tasks_by_priority; this.tasksByStatus = payload.tasks_by_status; this.totalTasks = deserialize.integer(payload.total_tasks); this.workflowSid = payload.workflow_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid, workflowSid }; } get _proxy() { this._context = this._context || new WorkflowRealTimeStatisticsContextImpl(this._version, this._solution.workspaceSid, this._solution.workflowSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, longestTaskWaitingAge: this.longestTaskWaitingAge, longestTaskWaitingSid: this.longestTaskWaitingSid, tasksByPriority: this.tasksByPriority, tasksByStatus: this.tasksByStatus, totalTasks: this.totalTasks, workflowSid: this.workflowSid, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkflowRealTimeStatisticsInstance = WorkflowRealTimeStatisticsInstance; function WorkflowRealTimeStatisticsListInstance(version, workspaceSid, workflowSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workflowSid)) { throw new Error("Parameter 'workflowSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkflowRealTimeStatisticsContextImpl(version, workspaceSid, workflowSid); }; instance._version = version; instance._solution = { workspaceSid, workflowSid }; 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; } exports.WorkflowRealTimeStatisticsListInstance = WorkflowRealTimeStatisticsListInstance; rest/taskrouter/v1/workspace/workspaceStatistics.d.ts000064400000013401151677225100017120 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; /** * Options to pass to fetch a WorkspaceStatisticsInstance */ export interface WorkspaceStatisticsContextFetchOptions { /** Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** Only calculate statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. */ splitByWaitTime?: string; } export interface WorkspaceStatisticsContext { /** * Fetch a WorkspaceStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkspaceStatisticsInstance) => any): Promise<WorkspaceStatisticsInstance>; /** * Fetch a WorkspaceStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceStatisticsInstance */ fetch(params: WorkspaceStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkspaceStatisticsInstance) => any): Promise<WorkspaceStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkspaceStatisticsContextSolution { workspaceSid: string; } export declare class WorkspaceStatisticsContextImpl implements WorkspaceStatisticsContext { protected _version: V1; protected _solution: WorkspaceStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string); fetch(params?: WorkspaceStatisticsContextFetchOptions | ((error: Error | null, item?: WorkspaceStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkspaceStatisticsInstance) => any): Promise<WorkspaceStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkspaceStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkspaceStatisticsResource { realtime: any; cumulative: any; account_sid: string; workspace_sid: string; url: string; } export declare class WorkspaceStatisticsInstance { protected _version: V1; protected _solution: WorkspaceStatisticsContextSolution; protected _context?: WorkspaceStatisticsContext; constructor(_version: V1, payload: WorkspaceStatisticsResource, workspaceSid: string); /** * An object that contains the real-time statistics for the Workspace. */ realtime: any; /** * An object that contains the cumulative statistics for the Workspace. */ cumulative: any; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. */ accountSid: string; /** * The SID of the Workspace. */ workspaceSid: string; /** * The absolute URL of the Workspace statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkspaceStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkspaceStatisticsInstance) => any): Promise<WorkspaceStatisticsInstance>; /** * Fetch a WorkspaceStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceStatisticsInstance */ fetch(params: WorkspaceStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkspaceStatisticsInstance) => any): Promise<WorkspaceStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { realtime: any; cumulative: any; accountSid: string; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkspaceStatisticsSolution { workspaceSid: string; } export interface WorkspaceStatisticsListInstance { _version: V1; _solution: WorkspaceStatisticsSolution; _uri: string; (): WorkspaceStatisticsContext; get(): WorkspaceStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkspaceStatisticsListInstance(version: V1, workspaceSid: string): WorkspaceStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/task/reservation.js000064400000037222151677225100016125 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.ReservationPage = exports.ReservationListInstance = exports.ReservationInstance = exports.ReservationContextImpl = void 0; 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 ReservationContextImpl { constructor(_version, workspaceSid, taskSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(taskSid)) { throw new Error("Parameter 'taskSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, taskSid, sid }; this._uri = `/Workspaces/${workspaceSid}/Tasks/${taskSid}/Reservations/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ReservationInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.taskSid, 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["reservationStatus"] !== undefined) data["ReservationStatus"] = params["reservationStatus"]; if (params["workerActivitySid"] !== undefined) data["WorkerActivitySid"] = params["workerActivitySid"]; if (params["instruction"] !== undefined) data["Instruction"] = params["instruction"]; if (params["dequeuePostWorkActivitySid"] !== undefined) data["DequeuePostWorkActivitySid"] = params["dequeuePostWorkActivitySid"]; if (params["dequeueFrom"] !== undefined) data["DequeueFrom"] = params["dequeueFrom"]; if (params["dequeueRecord"] !== undefined) data["DequeueRecord"] = params["dequeueRecord"]; if (params["dequeueTimeout"] !== undefined) data["DequeueTimeout"] = params["dequeueTimeout"]; if (params["dequeueTo"] !== undefined) data["DequeueTo"] = params["dequeueTo"]; if (params["dequeueStatusCallbackUrl"] !== undefined) data["DequeueStatusCallbackUrl"] = params["dequeueStatusCallbackUrl"]; if (params["callFrom"] !== undefined) data["CallFrom"] = params["callFrom"]; if (params["callRecord"] !== undefined) data["CallRecord"] = params["callRecord"]; if (params["callTimeout"] !== undefined) data["CallTimeout"] = params["callTimeout"]; if (params["callTo"] !== undefined) data["CallTo"] = params["callTo"]; if (params["callUrl"] !== undefined) data["CallUrl"] = params["callUrl"]; if (params["callStatusCallbackUrl"] !== undefined) data["CallStatusCallbackUrl"] = params["callStatusCallbackUrl"]; if (params["callAccept"] !== undefined) data["CallAccept"] = serialize.bool(params["callAccept"]); if (params["redirectCallSid"] !== undefined) data["RedirectCallSid"] = params["redirectCallSid"]; if (params["redirectAccept"] !== undefined) data["RedirectAccept"] = serialize.bool(params["redirectAccept"]); if (params["redirectUrl"] !== undefined) data["RedirectUrl"] = params["redirectUrl"]; if (params["to"] !== undefined) data["To"] = params["to"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["statusCallbackEvent"] !== undefined) data["StatusCallbackEvent"] = serialize.map(params["statusCallbackEvent"], (e) => e); if (params["timeout"] !== undefined) data["Timeout"] = params["timeout"]; if (params["record"] !== undefined) data["Record"] = serialize.bool(params["record"]); if (params["muted"] !== undefined) data["Muted"] = serialize.bool(params["muted"]); if (params["beep"] !== undefined) data["Beep"] = params["beep"]; if (params["startConferenceOnEnter"] !== undefined) data["StartConferenceOnEnter"] = serialize.bool(params["startConferenceOnEnter"]); if (params["endConferenceOnExit"] !== undefined) data["EndConferenceOnExit"] = serialize.bool(params["endConferenceOnExit"]); if (params["waitUrl"] !== undefined) data["WaitUrl"] = params["waitUrl"]; if (params["waitMethod"] !== undefined) data["WaitMethod"] = params["waitMethod"]; if (params["earlyMedia"] !== undefined) data["EarlyMedia"] = serialize.bool(params["earlyMedia"]); if (params["maxParticipants"] !== undefined) data["MaxParticipants"] = params["maxParticipants"]; if (params["conferenceStatusCallback"] !== undefined) data["ConferenceStatusCallback"] = params["conferenceStatusCallback"]; if (params["conferenceStatusCallbackMethod"] !== undefined) data["ConferenceStatusCallbackMethod"] = params["conferenceStatusCallbackMethod"]; if (params["conferenceStatusCallbackEvent"] !== undefined) data["ConferenceStatusCallbackEvent"] = serialize.map(params["conferenceStatusCallbackEvent"], (e) => e); if (params["conferenceRecord"] !== undefined) data["ConferenceRecord"] = params["conferenceRecord"]; if (params["conferenceTrim"] !== undefined) data["ConferenceTrim"] = params["conferenceTrim"]; if (params["recordingChannels"] !== undefined) data["RecordingChannels"] = params["recordingChannels"]; if (params["recordingStatusCallback"] !== undefined) data["RecordingStatusCallback"] = params["recordingStatusCallback"]; if (params["recordingStatusCallbackMethod"] !== undefined) data["RecordingStatusCallbackMethod"] = params["recordingStatusCallbackMethod"]; if (params["conferenceRecordingStatusCallback"] !== undefined) data["ConferenceRecordingStatusCallback"] = params["conferenceRecordingStatusCallback"]; if (params["conferenceRecordingStatusCallbackMethod"] !== undefined) data["ConferenceRecordingStatusCallbackMethod"] = params["conferenceRecordingStatusCallbackMethod"]; if (params["region"] !== undefined) data["Region"] = params["region"]; if (params["sipAuthUsername"] !== undefined) data["SipAuthUsername"] = params["sipAuthUsername"]; if (params["sipAuthPassword"] !== undefined) data["SipAuthPassword"] = params["sipAuthPassword"]; if (params["dequeueStatusCallbackEvent"] !== undefined) data["DequeueStatusCallbackEvent"] = serialize.map(params["dequeueStatusCallbackEvent"], (e) => e); if (params["postWorkActivitySid"] !== undefined) data["PostWorkActivitySid"] = params["postWorkActivitySid"]; if (params["supervisorMode"] !== undefined) data["SupervisorMode"] = params["supervisorMode"]; if (params["supervisor"] !== undefined) data["Supervisor"] = params["supervisor"]; if (params["endConferenceOnCustomerExit"] !== undefined) data["EndConferenceOnCustomerExit"] = serialize.bool(params["endConferenceOnCustomerExit"]); if (params["beepOnCustomerEntrance"] !== undefined) data["BeepOnCustomerEntrance"] = serialize.bool(params["beepOnCustomerEntrance"]); if (params["jitterBufferSize"] !== undefined) data["JitterBufferSize"] = params["jitterBufferSize"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ReservationInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.taskSid, 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.ReservationContextImpl = ReservationContextImpl; class ReservationInstance { constructor(_version, payload, workspaceSid, taskSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.reservationStatus = payload.reservation_status; this.sid = payload.sid; this.taskSid = payload.task_sid; this.workerName = payload.worker_name; this.workerSid = payload.worker_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this.links = payload.links; this._solution = { workspaceSid, taskSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ReservationContextImpl(this._version, this._solution.workspaceSid, this._solution.taskSid, this._solution.sid); return this._context; } /** * Fetch a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, reservationStatus: this.reservationStatus, sid: this.sid, taskSid: this.taskSid, workerName: this.workerName, workerSid: this.workerSid, workspaceSid: this.workspaceSid, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ReservationInstance = ReservationInstance; function ReservationListInstance(version, workspaceSid, taskSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(taskSid)) { throw new Error("Parameter 'taskSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ReservationContextImpl(version, workspaceSid, taskSid, sid); }; instance._version = version; instance._solution = { workspaceSid, taskSid }; instance._uri = `/Workspaces/${workspaceSid}/Tasks/${taskSid}/Reservations`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["reservationStatus"] !== undefined) data["ReservationStatus"] = params["reservationStatus"]; if (params["workerSid"] !== undefined) data["WorkerSid"] = params["workerSid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ReservationPage(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 ReservationPage(instance._version, payload, 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; } exports.ReservationListInstance = ReservationListInstance; class ReservationPage extends Page_1.default { /** * Initialize the ReservationPage * * @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 ReservationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ReservationInstance(this._version, payload, this._solution.workspaceSid, this._solution.taskSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ReservationPage = ReservationPage; rest/taskrouter/v1/workspace/task/reservation.d.ts000064400000050262151677225100016360 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type ReservationCallStatus = "initiated" | "ringing" | "answered" | "completed"; export type ReservationConferenceEvent = "start" | "end" | "join" | "leave" | "mute" | "hold" | "speaker"; export type ReservationStatus = "pending" | "accepted" | "rejected" | "timeout" | "canceled" | "rescinded" | "wrapping" | "completed"; export type ReservationSupervisorMode = "monitor" | "whisper" | "barge"; /** * Options to pass to update a ReservationInstance */ export interface ReservationContextUpdateOptions { /** The If-Match HTTP request header */ ifMatch?: string; /** */ reservationStatus?: ReservationStatus; /** The new worker activity SID if rejecting a reservation. */ workerActivitySid?: string; /** The assignment instruction for reservation. */ instruction?: string; /** The SID of the Activity resource to start after executing a Dequeue instruction. */ dequeuePostWorkActivitySid?: string; /** The Caller ID of the call to the worker when executing a Dequeue instruction. */ dequeueFrom?: string; /** Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. */ dequeueRecord?: string; /** Timeout for call when executing a Dequeue instruction. */ dequeueTimeout?: number; /** The Contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. */ dequeueTo?: string; /** The Callback URL for completed call event when executing a Dequeue instruction. */ dequeueStatusCallbackUrl?: string; /** The Caller ID of the outbound call when executing a Call instruction. */ callFrom?: string; /** Whether to record both legs of a call when executing a Call instruction or which leg to record. */ callRecord?: string; /** Timeout for call when executing a Call instruction. */ callTimeout?: number; /** The Contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. */ callTo?: string; /** TwiML URI executed on answering the worker\\\'s leg as a result of the Call instruction. */ callUrl?: string; /** The URL to call for the completed call event when executing a Call instruction. */ callStatusCallbackUrl?: string; /** Whether to accept a reservation when executing a Call instruction. */ callAccept?: boolean; /** The Call SID of the call parked in the queue when executing a Redirect instruction. */ redirectCallSid?: string; /** Whether the reservation should be accepted when executing a Redirect instruction. */ redirectAccept?: boolean; /** TwiML URI to redirect the call to when executing the Redirect instruction. */ redirectUrl?: string; /** The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. */ to?: string; /** The Caller ID of the call to the worker when executing a Conference instruction. */ from?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. */ statusCallbackMethod?: string; /** The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. */ statusCallbackEvent?: Array<ReservationCallStatus>; /** Timeout for call when executing a Conference instruction. */ timeout?: number; /** Whether to record the participant and their conferences, including the time between conferences. The default is `false`. */ record?: boolean; /** Whether the agent is muted in the conference. The default is `false`. */ muted?: boolean; /** Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. */ beep?: string; /** Whether to start the conference when the participant joins, if it has not already started. The default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. */ startConferenceOnEnter?: boolean; /** Whether to end the conference when the agent leaves. */ endConferenceOnExit?: boolean; /** The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). */ waitUrl?: string; /** The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. */ waitMethod?: string; /** Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. */ earlyMedia?: boolean; /** The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. */ maxParticipants?: number; /** The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. */ conferenceStatusCallback?: string; /** The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ conferenceStatusCallbackMethod?: string; /** The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. */ conferenceStatusCallbackEvent?: Array<ReservationConferenceEvent>; /** Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. */ conferenceRecord?: string; /** How to trim the leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. */ conferenceTrim?: string; /** The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. */ recordingChannels?: string; /** The URL that we should call using the `recording_status_callback_method` when the recording status changes. */ recordingStatusCallback?: string; /** The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ recordingStatusCallbackMethod?: string; /** The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. */ conferenceRecordingStatusCallback?: string; /** The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ conferenceRecordingStatusCallbackMethod?: string; /** The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. */ region?: string; /** The SIP username used for authentication. */ sipAuthUsername?: string; /** The SIP password for authentication. */ sipAuthPassword?: string; /** The Call progress events sent via webhooks as a result of a Dequeue instruction. */ dequeueStatusCallbackEvent?: Array<string>; /** The new worker activity SID after executing a Conference instruction. */ postWorkActivitySid?: string; /** */ supervisorMode?: ReservationSupervisorMode; /** The Supervisor SID/URI when executing the Supervise instruction. */ supervisor?: string; /** Whether to end the conference when the customer leaves. */ endConferenceOnCustomerExit?: boolean; /** Whether to play a notification beep when the customer joins. */ beepOnCustomerEntrance?: boolean; /** The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. */ jitterBufferSize?: string; } /** * Options to pass to each */ export interface ReservationListInstanceEachOptions { /** Returns the list of reservations for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, or `timeout`. */ reservationStatus?: ReservationStatus; /** The SID of the reserved Worker resource to read. */ workerSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ReservationInstance, 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 ReservationListInstanceOptions { /** Returns the list of reservations for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, or `timeout`. */ reservationStatus?: ReservationStatus; /** The SID of the reserved Worker resource to read. */ workerSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ReservationListInstancePageOptions { /** Returns the list of reservations for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, or `timeout`. */ reservationStatus?: ReservationStatus; /** The SID of the reserved Worker resource to read. */ workerSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ReservationContext { /** * Fetch a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ fetch(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Update a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ update(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Update a ReservationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ update(params: ReservationContextUpdateOptions, callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ReservationContextSolution { workspaceSid: string; taskSid: string; sid: string; } export declare class ReservationContextImpl implements ReservationContext { protected _version: V1; protected _solution: ReservationContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, taskSid: string, sid: string); fetch(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; update(params?: ReservationContextUpdateOptions | ((error: Error | null, item?: ReservationInstance) => any), callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ReservationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ReservationPayload extends TwilioResponsePayload { reservations: ReservationResource[]; } interface ReservationResource { account_sid: string; date_created: Date; date_updated: Date; reservation_status: ReservationStatus; sid: string; task_sid: string; worker_name: string; worker_sid: string; workspace_sid: string; url: string; links: Record<string, string>; } export declare class ReservationInstance { protected _version: V1; protected _solution: ReservationContextSolution; protected _context?: ReservationContext; constructor(_version: V1, payload: ReservationResource, workspaceSid: string, taskSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskReservation resource. */ accountSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; reservationStatus: ReservationStatus; /** * The unique string that we created to identify the TaskReservation resource. */ sid: string; /** * The SID of the reserved Task resource. */ taskSid: string; /** * The `friendly_name` of the Worker that is reserved. */ workerName: string; /** * The SID of the reserved Worker resource. */ workerSid: string; /** * The SID of the Workspace that this task is contained within. */ workspaceSid: string; /** * The absolute URL of the TaskReservation reservation. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ fetch(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Update a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ update(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Update a ReservationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ update(params: ReservationContextUpdateOptions, callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; reservationStatus: ReservationStatus; sid: string; taskSid: string; workerName: string; workerSid: string; workspaceSid: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ReservationSolution { workspaceSid: string; taskSid: string; } export interface ReservationListInstance { _version: V1; _solution: ReservationSolution; _uri: string; (sid: string): ReservationContext; get(sid: string): ReservationContext; /** * Streams ReservationInstance 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 { ReservationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ReservationInstance, done: (err?: Error) => void) => void): void; each(params: ReservationListInstanceEachOptions, callback?: (item: ReservationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ReservationInstance 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: ReservationPage) => any): Promise<ReservationPage>; /** * Lists ReservationInstance 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 { ReservationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ReservationInstance[]) => any): Promise<ReservationInstance[]>; list(params: ReservationListInstanceOptions, callback?: (error: Error | null, items: ReservationInstance[]) => any): Promise<ReservationInstance[]>; /** * Retrieve a single page of ReservationInstance 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 { ReservationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ReservationPage) => any): Promise<ReservationPage>; page(params: ReservationListInstancePageOptions, callback?: (error: Error | null, items: ReservationPage) => any): Promise<ReservationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ReservationListInstance(version: V1, workspaceSid: string, taskSid: string): ReservationListInstance; export declare class ReservationPage extends Page<V1, ReservationPayload, ReservationResource, ReservationInstance> { /** * Initialize the ReservationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ReservationSolution); /** * Build an instance of ReservationInstance * * @param payload - Payload response from the API */ getInstance(payload: ReservationResource): ReservationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/worker.d.ts000064400000046731151677225100014374 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { ReservationListInstance } from "./worker/reservation"; import { WorkerChannelListInstance } from "./worker/workerChannel"; import { WorkerStatisticsListInstance } from "./worker/workerStatistics"; import { WorkersCumulativeStatisticsListInstance } from "./worker/workersCumulativeStatistics"; import { WorkersRealTimeStatisticsListInstance } from "./worker/workersRealTimeStatistics"; import { WorkersStatisticsListInstance } from "./worker/workersStatistics"; /** * Options to pass to remove a WorkerInstance */ export interface WorkerContextRemoveOptions { /** The If-Match HTTP request header */ ifMatch?: string; } /** * Options to pass to update a WorkerInstance */ export interface WorkerContextUpdateOptions { /** The If-Match HTTP request header */ ifMatch?: string; /** The SID of a valid Activity that will describe the Worker\\\'s initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. */ activitySid?: string; /** The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. */ attributes?: string; /** A descriptive string that you create to describe the Worker. It can be up to 64 characters long. */ friendlyName?: string; /** Whether to reject the Worker\\\'s pending reservations. This option is only valid if the Worker\\\'s new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. */ rejectPendingReservations?: boolean; } /** * Options to pass to create a WorkerInstance */ export interface WorkerListInstanceCreateOptions { /** A descriptive string that you create to describe the new Worker. It can be up to 64 characters long. */ friendlyName: string; /** The SID of a valid Activity that will describe the new Worker\\\'s initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. If not provided, the new Worker\\\'s initial state is the `default_activity_sid` configured on the Workspace. */ activitySid?: string; /** A valid JSON string that describes the new Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. */ attributes?: string; } /** * Options to pass to each */ export interface WorkerListInstanceEachOptions { /** The `activity_name` of the Worker resources to read. */ activityName?: string; /** The `activity_sid` of the Worker resources to read. */ activitySid?: string; /** Whether to return only Worker resources that are available or unavailable. Can be `true`, `1`, or `yes` to return Worker resources that are available, and `false`, or any value returns the Worker resources that are not available. */ available?: string; /** The `friendly_name` of the Worker resources to read. */ friendlyName?: string; /** Filter by Workers that would match an expression. In addition to fields in the workers\' attributes, the expression can include the following worker fields: `sid`, `friendly_name`, `activity_sid`, or `activity_name` */ targetWorkersExpression?: string; /** The `friendly_name` of the TaskQueue that the Workers to read are eligible for. */ taskQueueName?: string; /** The SID of the TaskQueue that the Workers to read are eligible for. */ taskQueueSid?: string; /** Sorting parameter for Workers */ ordering?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: WorkerInstance, 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 WorkerListInstanceOptions { /** The `activity_name` of the Worker resources to read. */ activityName?: string; /** The `activity_sid` of the Worker resources to read. */ activitySid?: string; /** Whether to return only Worker resources that are available or unavailable. Can be `true`, `1`, or `yes` to return Worker resources that are available, and `false`, or any value returns the Worker resources that are not available. */ available?: string; /** The `friendly_name` of the Worker resources to read. */ friendlyName?: string; /** Filter by Workers that would match an expression. In addition to fields in the workers\' attributes, the expression can include the following worker fields: `sid`, `friendly_name`, `activity_sid`, or `activity_name` */ targetWorkersExpression?: string; /** The `friendly_name` of the TaskQueue that the Workers to read are eligible for. */ taskQueueName?: string; /** The SID of the TaskQueue that the Workers to read are eligible for. */ taskQueueSid?: string; /** Sorting parameter for Workers */ ordering?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface WorkerListInstancePageOptions { /** The `activity_name` of the Worker resources to read. */ activityName?: string; /** The `activity_sid` of the Worker resources to read. */ activitySid?: string; /** Whether to return only Worker resources that are available or unavailable. Can be `true`, `1`, or `yes` to return Worker resources that are available, and `false`, or any value returns the Worker resources that are not available. */ available?: string; /** The `friendly_name` of the Worker resources to read. */ friendlyName?: string; /** Filter by Workers that would match an expression. In addition to fields in the workers\' attributes, the expression can include the following worker fields: `sid`, `friendly_name`, `activity_sid`, or `activity_name` */ targetWorkersExpression?: string; /** The `friendly_name` of the TaskQueue that the Workers to read are eligible for. */ taskQueueName?: string; /** The SID of the TaskQueue that the Workers to read are eligible for. */ taskQueueSid?: string; /** Sorting parameter for Workers */ ordering?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface WorkerContext { reservations: ReservationListInstance; workerChannels: WorkerChannelListInstance; statistics: WorkerStatisticsListInstance; /** * Remove a WorkerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a WorkerInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ remove(params: WorkerContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WorkerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ fetch(callback?: (error: Error | null, item?: WorkerInstance) => any): Promise<WorkerInstance>; /** * Update a WorkerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ update(callback?: (error: Error | null, item?: WorkerInstance) => any): Promise<WorkerInstance>; /** * Update a WorkerInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ update(params: WorkerContextUpdateOptions, callback?: (error: Error | null, item?: WorkerInstance) => any): Promise<WorkerInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkerContextSolution { workspaceSid: string; sid: string; } export declare class WorkerContextImpl implements WorkerContext { protected _version: V1; protected _solution: WorkerContextSolution; protected _uri: string; protected _reservations?: ReservationListInstance; protected _workerChannels?: WorkerChannelListInstance; protected _statistics?: WorkerStatisticsListInstance; constructor(_version: V1, workspaceSid: string, sid: string); get reservations(): ReservationListInstance; get workerChannels(): WorkerChannelListInstance; get statistics(): WorkerStatisticsListInstance; remove(params?: WorkerContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: WorkerInstance) => any): Promise<WorkerInstance>; update(params?: WorkerContextUpdateOptions | ((error: Error | null, item?: WorkerInstance) => any), callback?: (error: Error | null, item?: WorkerInstance) => any): Promise<WorkerInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkerContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkerPayload extends TwilioResponsePayload { workers: WorkerResource[]; } interface WorkerResource { account_sid: string; activity_name: string; activity_sid: string; attributes: string; available: boolean; date_created: Date; date_status_changed: Date; date_updated: Date; friendly_name: string; sid: string; workspace_sid: string; url: string; links: Record<string, string>; } export declare class WorkerInstance { protected _version: V1; protected _solution: WorkerContextSolution; protected _context?: WorkerContext; constructor(_version: V1, payload: WorkerResource, workspaceSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. */ accountSid: string; /** * The `friendly_name` of the Worker\'s current Activity. */ activityName: string; /** * The SID of the Worker\'s current Activity. */ activitySid: string; /** * The JSON string that describes the Worker. For example: `{ \"email\": \"Bob@example.com\", \"phone\": \"+5095551234\" }`. **Note** If this property has been assigned a value, it will only be displayed in FETCH actions that return a single resource. Otherwise, this property will be null, even if it has a value. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. */ attributes: string; /** * Whether the Worker is available to perform tasks. */ available: boolean; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT of the last change to the Worker\'s activity specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Used to calculate Workflow statistics. */ dateStatusChanged: 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 string that you assigned to describe the resource. Friendly names are case insensitive, and unique within the TaskRouter Workspace. */ friendlyName: string; /** * The unique string that we created to identify the Worker resource. */ sid: string; /** * The SID of the Workspace that contains the Worker. */ workspaceSid: string; /** * The absolute URL of the Worker resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a WorkerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a WorkerInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ remove(params: WorkerContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WorkerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ fetch(callback?: (error: Error | null, item?: WorkerInstance) => any): Promise<WorkerInstance>; /** * Update a WorkerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ update(callback?: (error: Error | null, item?: WorkerInstance) => any): Promise<WorkerInstance>; /** * Update a WorkerInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ update(params: WorkerContextUpdateOptions, callback?: (error: Error | null, item?: WorkerInstance) => any): Promise<WorkerInstance>; /** * Access the reservations. */ reservations(): ReservationListInstance; /** * Access the workerChannels. */ workerChannels(): WorkerChannelListInstance; /** * Access the statistics. */ statistics(): WorkerStatisticsListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; activityName: string; activitySid: string; attributes: string; available: boolean; dateCreated: Date; dateStatusChanged: Date; dateUpdated: Date; friendlyName: string; sid: string; workspaceSid: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkerSolution { workspaceSid: string; } export interface WorkerListInstance { _version: V1; _solution: WorkerSolution; _uri: string; (sid: string): WorkerContext; get(sid: string): WorkerContext; _cumulativeStatistics?: WorkersCumulativeStatisticsListInstance; cumulativeStatistics: WorkersCumulativeStatisticsListInstance; _realTimeStatistics?: WorkersRealTimeStatisticsListInstance; realTimeStatistics: WorkersRealTimeStatisticsListInstance; _statistics?: WorkersStatisticsListInstance; statistics: WorkersStatisticsListInstance; /** * Create a WorkerInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ create(params: WorkerListInstanceCreateOptions, callback?: (error: Error | null, item?: WorkerInstance) => any): Promise<WorkerInstance>; /** * Streams WorkerInstance 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 { WorkerListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WorkerInstance, done: (err?: Error) => void) => void): void; each(params: WorkerListInstanceEachOptions, callback?: (item: WorkerInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WorkerInstance 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: WorkerPage) => any): Promise<WorkerPage>; /** * Lists WorkerInstance 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 { WorkerListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WorkerInstance[]) => any): Promise<WorkerInstance[]>; list(params: WorkerListInstanceOptions, callback?: (error: Error | null, items: WorkerInstance[]) => any): Promise<WorkerInstance[]>; /** * Retrieve a single page of WorkerInstance 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 { WorkerListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WorkerPage) => any): Promise<WorkerPage>; page(params: WorkerListInstancePageOptions, callback?: (error: Error | null, items: WorkerPage) => any): Promise<WorkerPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkerListInstance(version: V1, workspaceSid: string): WorkerListInstance; export declare class WorkerPage extends Page<V1, WorkerPayload, WorkerResource, WorkerInstance> { /** * Initialize the WorkerPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: WorkerSolution); /** * Build an instance of WorkerInstance * * @param payload - Payload response from the API */ getInstance(payload: WorkerResource): WorkerInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/workspaceRealTimeStatistics.d.ts000064400000013713151677225100020551 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; /** * Options to pass to fetch a WorkspaceRealTimeStatisticsInstance */ export interface WorkspaceRealTimeStatisticsContextFetchOptions { /** Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; } export interface WorkspaceRealTimeStatisticsContext { /** * Fetch a WorkspaceRealTimeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceRealTimeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkspaceRealTimeStatisticsInstance) => any): Promise<WorkspaceRealTimeStatisticsInstance>; /** * Fetch a WorkspaceRealTimeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceRealTimeStatisticsInstance */ fetch(params: WorkspaceRealTimeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkspaceRealTimeStatisticsInstance) => any): Promise<WorkspaceRealTimeStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkspaceRealTimeStatisticsContextSolution { workspaceSid: string; } export declare class WorkspaceRealTimeStatisticsContextImpl implements WorkspaceRealTimeStatisticsContext { protected _version: V1; protected _solution: WorkspaceRealTimeStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string); fetch(params?: WorkspaceRealTimeStatisticsContextFetchOptions | ((error: Error | null, item?: WorkspaceRealTimeStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkspaceRealTimeStatisticsInstance) => any): Promise<WorkspaceRealTimeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkspaceRealTimeStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkspaceRealTimeStatisticsResource { account_sid: string; activity_statistics: Array<any>; longest_task_waiting_age: number; longest_task_waiting_sid: string; tasks_by_priority: any; tasks_by_status: any; total_tasks: number; total_workers: number; workspace_sid: string; url: string; } export declare class WorkspaceRealTimeStatisticsInstance { protected _version: V1; protected _solution: WorkspaceRealTimeStatisticsContextSolution; protected _context?: WorkspaceRealTimeStatisticsContext; constructor(_version: V1, payload: WorkspaceRealTimeStatisticsResource, workspaceSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. */ accountSid: string; /** * The number of current Workers by Activity. */ activityStatistics: Array<any>; /** * The age of the longest waiting Task. */ longestTaskWaitingAge: number; /** * The SID of the longest waiting Task. */ longestTaskWaitingSid: string; /** * The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. */ tasksByPriority: any; /** * The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. */ tasksByStatus: any; /** * The total number of Tasks. */ totalTasks: number; /** * The total number of Workers in the Workspace. */ totalWorkers: number; /** * The SID of the Workspace. */ workspaceSid: string; /** * The absolute URL of the Workspace statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkspaceRealTimeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceRealTimeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkspaceRealTimeStatisticsInstance) => any): Promise<WorkspaceRealTimeStatisticsInstance>; /** * Fetch a WorkspaceRealTimeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceRealTimeStatisticsInstance */ fetch(params: WorkspaceRealTimeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkspaceRealTimeStatisticsInstance) => any): Promise<WorkspaceRealTimeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; activityStatistics: any[]; longestTaskWaitingAge: number; longestTaskWaitingSid: string; tasksByPriority: any; tasksByStatus: any; totalTasks: number; totalWorkers: number; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkspaceRealTimeStatisticsSolution { workspaceSid: string; } export interface WorkspaceRealTimeStatisticsListInstance { _version: V1; _solution: WorkspaceRealTimeStatisticsSolution; _uri: string; (): WorkspaceRealTimeStatisticsContext; get(): WorkspaceRealTimeStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkspaceRealTimeStatisticsListInstance(version: V1, workspaceSid: string): WorkspaceRealTimeStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/event.js000064400000021455151677225100013744 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.EventPage = exports.EventListInstance = exports.EventInstance = exports.EventContextImpl = void 0; 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 EventContextImpl { constructor(_version, workspaceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, sid }; this._uri = `/Workspaces/${workspaceSid}/Events/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EventInstance(operationVersion, payload, instance._solution.workspaceSid, 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.EventContextImpl = EventContextImpl; class EventInstance { constructor(_version, payload, workspaceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.actorSid = payload.actor_sid; this.actorType = payload.actor_type; this.actorUrl = payload.actor_url; this.description = payload.description; this.eventData = payload.event_data; this.eventDate = deserialize.iso8601DateTime(payload.event_date); this.eventDateMs = payload.event_date_ms; this.eventType = payload.event_type; this.resourceSid = payload.resource_sid; this.resourceType = payload.resource_type; this.resourceUrl = payload.resource_url; this.sid = payload.sid; this.source = payload.source; this.sourceIpAddress = payload.source_ip_address; this.url = payload.url; this.workspaceSid = payload.workspace_sid; this._solution = { workspaceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new EventContextImpl(this._version, this._solution.workspaceSid, this._solution.sid); return this._context; } /** * Fetch a EventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EventInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, actorSid: this.actorSid, actorType: this.actorType, actorUrl: this.actorUrl, description: this.description, eventData: this.eventData, eventDate: this.eventDate, eventDateMs: this.eventDateMs, eventType: this.eventType, resourceSid: this.resourceSid, resourceType: this.resourceType, resourceUrl: this.resourceUrl, sid: this.sid, source: this.source, sourceIpAddress: this.sourceIpAddress, url: this.url, workspaceSid: this.workspaceSid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventInstance = EventInstance; function EventListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EventContextImpl(version, workspaceSid, sid); }; instance._version = version; instance._solution = { workspaceSid }; instance._uri = `/Workspaces/${workspaceSid}/Events`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["eventType"] !== undefined) data["EventType"] = params["eventType"]; if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["reservationSid"] !== undefined) data["ReservationSid"] = params["reservationSid"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["taskQueueSid"] !== undefined) data["TaskQueueSid"] = params["taskQueueSid"]; if (params["taskSid"] !== undefined) data["TaskSid"] = params["taskSid"]; if (params["workerSid"] !== undefined) data["WorkerSid"] = params["workerSid"]; if (params["workflowSid"] !== undefined) data["WorkflowSid"] = params["workflowSid"]; if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["sid"] !== undefined) data["Sid"] = params["sid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EventPage(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 EventPage(instance._version, payload, 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; } exports.EventListInstance = EventListInstance; class EventPage extends Page_1.default { /** * Initialize the EventPage * * @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 EventInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EventInstance(this._version, payload, this._solution.workspaceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventPage = EventPage; rest/taskrouter/v1/workspace/workflow.d.ts000064400000037606151677225100014736 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { WorkflowCumulativeStatisticsListInstance } from "./workflow/workflowCumulativeStatistics"; import { WorkflowRealTimeStatisticsListInstance } from "./workflow/workflowRealTimeStatistics"; import { WorkflowStatisticsListInstance } from "./workflow/workflowStatistics"; /** * Options to pass to update a WorkflowInstance */ export interface WorkflowContextUpdateOptions { /** A descriptive string that you create to describe the Workflow resource. For example, `Inbound Call Workflow` or `2014 Outbound Campaign`. */ friendlyName?: string; /** The URL from your application that will process task assignment events. See [Handling Task Assignment Callback](https://www.twilio.com/docs/taskrouter/handle-assignment-callbacks) for more details. */ assignmentCallbackUrl?: string; /** The URL that we should call when a call to the `assignment_callback_url` fails. */ fallbackAssignmentCallbackUrl?: string; /** A JSON string that contains the rules to apply to the Workflow. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. */ configuration?: string; /** How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. */ taskReservationTimeout?: number; /** Whether or not to re-evaluate Tasks. The default is `false`, which means Tasks in the Workflow will not be processed through the assignment loop again. */ reEvaluateTasks?: string; } /** * Options to pass to create a WorkflowInstance */ export interface WorkflowListInstanceCreateOptions { /** A descriptive string that you create to describe the Workflow resource. For example, `Inbound Call Workflow` or `2014 Outbound Campaign`. */ friendlyName: string; /** A JSON string that contains the rules to apply to the Workflow. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. */ configuration: string; /** The URL from your application that will process task assignment events. See [Handling Task Assignment Callback](https://www.twilio.com/docs/taskrouter/handle-assignment-callbacks) for more details. */ assignmentCallbackUrl?: string; /** The URL that we should call when a call to the `assignment_callback_url` fails. */ fallbackAssignmentCallbackUrl?: string; /** How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. */ taskReservationTimeout?: number; } /** * Options to pass to each */ export interface WorkflowListInstanceEachOptions { /** The `friendly_name` of the Workflow resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: WorkflowInstance, 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 WorkflowListInstanceOptions { /** The `friendly_name` of the Workflow resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface WorkflowListInstancePageOptions { /** The `friendly_name` of the Workflow resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface WorkflowContext { cumulativeStatistics: WorkflowCumulativeStatisticsListInstance; realTimeStatistics: WorkflowRealTimeStatisticsListInstance; statistics: WorkflowStatisticsListInstance; /** * Remove a WorkflowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WorkflowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowInstance */ fetch(callback?: (error: Error | null, item?: WorkflowInstance) => any): Promise<WorkflowInstance>; /** * Update a WorkflowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowInstance */ update(callback?: (error: Error | null, item?: WorkflowInstance) => any): Promise<WorkflowInstance>; /** * Update a WorkflowInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowInstance */ update(params: WorkflowContextUpdateOptions, callback?: (error: Error | null, item?: WorkflowInstance) => any): Promise<WorkflowInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkflowContextSolution { workspaceSid: string; sid: string; } export declare class WorkflowContextImpl implements WorkflowContext { protected _version: V1; protected _solution: WorkflowContextSolution; protected _uri: string; protected _cumulativeStatistics?: WorkflowCumulativeStatisticsListInstance; protected _realTimeStatistics?: WorkflowRealTimeStatisticsListInstance; protected _statistics?: WorkflowStatisticsListInstance; constructor(_version: V1, workspaceSid: string, sid: string); get cumulativeStatistics(): WorkflowCumulativeStatisticsListInstance; get realTimeStatistics(): WorkflowRealTimeStatisticsListInstance; get statistics(): WorkflowStatisticsListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: WorkflowInstance) => any): Promise<WorkflowInstance>; update(params?: WorkflowContextUpdateOptions | ((error: Error | null, item?: WorkflowInstance) => any), callback?: (error: Error | null, item?: WorkflowInstance) => any): Promise<WorkflowInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkflowContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkflowPayload extends TwilioResponsePayload { workflows: WorkflowResource[]; } interface WorkflowResource { account_sid: string; assignment_callback_url: string; configuration: string; date_created: Date; date_updated: Date; document_content_type: string; fallback_assignment_callback_url: string; friendly_name: string; sid: string; task_reservation_timeout: number; workspace_sid: string; url: string; links: Record<string, string>; } export declare class WorkflowInstance { protected _version: V1; protected _solution: WorkflowContextSolution; protected _context?: WorkflowContext; constructor(_version: V1, payload: WorkflowResource, workspaceSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. */ accountSid: string; /** * The URL that we call when a task managed by the Workflow is assigned to a Worker. See Assignment Callback URL for more information. */ assignmentCallbackUrl: string; /** * A JSON string that contains the Workflow\'s configuration. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. */ configuration: 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 MIME type of the document. */ documentContentType: string; /** * The URL that we call when a call to the `assignment_callback_url` fails. */ fallbackAssignmentCallbackUrl: string; /** * The string that you assigned to describe the Workflow resource. For example, `Customer Support` or `2014 Election Campaign`. */ friendlyName: string; /** * The unique string that we created to identify the Workflow resource. */ sid: string; /** * How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. */ taskReservationTimeout: number; /** * The SID of the Workspace that contains the Workflow. */ workspaceSid: string; /** * The absolute URL of the Workflow resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a WorkflowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WorkflowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowInstance */ fetch(callback?: (error: Error | null, item?: WorkflowInstance) => any): Promise<WorkflowInstance>; /** * Update a WorkflowInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowInstance */ update(callback?: (error: Error | null, item?: WorkflowInstance) => any): Promise<WorkflowInstance>; /** * Update a WorkflowInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowInstance */ update(params: WorkflowContextUpdateOptions, callback?: (error: Error | null, item?: WorkflowInstance) => any): Promise<WorkflowInstance>; /** * Access the cumulativeStatistics. */ cumulativeStatistics(): WorkflowCumulativeStatisticsListInstance; /** * Access the realTimeStatistics. */ realTimeStatistics(): WorkflowRealTimeStatisticsListInstance; /** * Access the statistics. */ statistics(): WorkflowStatisticsListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; assignmentCallbackUrl: string; configuration: string; dateCreated: Date; dateUpdated: Date; documentContentType: string; fallbackAssignmentCallbackUrl: string; friendlyName: string; sid: string; taskReservationTimeout: number; workspaceSid: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkflowSolution { workspaceSid: string; } export interface WorkflowListInstance { _version: V1; _solution: WorkflowSolution; _uri: string; (sid: string): WorkflowContext; get(sid: string): WorkflowContext; /** * Create a WorkflowInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkflowInstance */ create(params: WorkflowListInstanceCreateOptions, callback?: (error: Error | null, item?: WorkflowInstance) => any): Promise<WorkflowInstance>; /** * Streams WorkflowInstance 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 { WorkflowListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WorkflowInstance, done: (err?: Error) => void) => void): void; each(params: WorkflowListInstanceEachOptions, callback?: (item: WorkflowInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WorkflowInstance 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: WorkflowPage) => any): Promise<WorkflowPage>; /** * Lists WorkflowInstance 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 { WorkflowListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WorkflowInstance[]) => any): Promise<WorkflowInstance[]>; list(params: WorkflowListInstanceOptions, callback?: (error: Error | null, items: WorkflowInstance[]) => any): Promise<WorkflowInstance[]>; /** * Retrieve a single page of WorkflowInstance 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 { WorkflowListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WorkflowPage) => any): Promise<WorkflowPage>; page(params: WorkflowListInstancePageOptions, callback?: (error: Error | null, items: WorkflowPage) => any): Promise<WorkflowPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkflowListInstance(version: V1, workspaceSid: string): WorkflowListInstance; export declare class WorkflowPage extends Page<V1, WorkflowPayload, WorkflowResource, WorkflowInstance> { /** * Initialize the WorkflowPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: WorkflowSolution); /** * Build an instance of WorkflowInstance * * @param payload - Payload response from the API */ getInstance(payload: WorkflowResource): WorkflowInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/worker.js000064400000034755151677225100014143 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkerPage = exports.WorkerListInstance = exports.WorkerInstance = exports.WorkerContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const reservation_1 = require("./worker/reservation"); const workerChannel_1 = require("./worker/workerChannel"); const workerStatistics_1 = require("./worker/workerStatistics"); const workersCumulativeStatistics_1 = require("./worker/workersCumulativeStatistics"); const workersRealTimeStatistics_1 = require("./worker/workersRealTimeStatistics"); const workersStatistics_1 = require("./worker/workersStatistics"); class WorkerContextImpl { constructor(_version, workspaceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, sid }; this._uri = `/Workspaces/${workspaceSid}/Workers/${sid}`; } get reservations() { this._reservations = this._reservations || (0, reservation_1.ReservationListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._reservations; } get workerChannels() { this._workerChannels = this._workerChannels || (0, workerChannel_1.WorkerChannelListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._workerChannels; } get statistics() { this._statistics = this._statistics || (0, workerStatistics_1.WorkerStatisticsListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._statistics; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WorkerInstance(operationVersion, payload, instance._solution.workspaceSid, 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["activitySid"] !== undefined) data["ActivitySid"] = params["activitySid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["rejectPendingReservations"] !== undefined) data["RejectPendingReservations"] = serialize.bool(params["rejectPendingReservations"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WorkerInstance(operationVersion, payload, instance._solution.workspaceSid, 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.WorkerContextImpl = WorkerContextImpl; class WorkerInstance { constructor(_version, payload, workspaceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.activityName = payload.activity_name; this.activitySid = payload.activity_sid; this.attributes = payload.attributes; this.available = payload.available; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateStatusChanged = deserialize.iso8601DateTime(payload.date_status_changed); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.sid = payload.sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this.links = payload.links; this._solution = { workspaceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WorkerContextImpl(this._version, this._solution.workspaceSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a WorkerInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the reservations. */ reservations() { return this._proxy.reservations; } /** * Access the workerChannels. */ workerChannels() { return this._proxy.workerChannels; } /** * Access the statistics. */ statistics() { return this._proxy.statistics; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, activityName: this.activityName, activitySid: this.activitySid, attributes: this.attributes, available: this.available, dateCreated: this.dateCreated, dateStatusChanged: this.dateStatusChanged, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, sid: this.sid, workspaceSid: this.workspaceSid, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkerInstance = WorkerInstance; function WorkerListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WorkerContextImpl(version, workspaceSid, sid); }; instance._version = version; instance._solution = { workspaceSid }; instance._uri = `/Workspaces/${workspaceSid}/Workers`; Object.defineProperty(instance, "cumulativeStatistics", { get: function cumulativeStatistics() { if (!instance._cumulativeStatistics) { instance._cumulativeStatistics = (0, workersCumulativeStatistics_1.WorkersCumulativeStatisticsListInstance)(instance._version, instance._solution.workspaceSid); } return instance._cumulativeStatistics; }, }); Object.defineProperty(instance, "realTimeStatistics", { get: function realTimeStatistics() { if (!instance._realTimeStatistics) { instance._realTimeStatistics = (0, workersRealTimeStatistics_1.WorkersRealTimeStatisticsListInstance)(instance._version, instance._solution.workspaceSid); } return instance._realTimeStatistics; }, }); Object.defineProperty(instance, "statistics", { get: function statistics() { if (!instance._statistics) { instance._statistics = (0, workersStatistics_1.WorkersStatisticsListInstance)(instance._version, instance._solution.workspaceSid); } return instance._statistics; }, }); instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["activitySid"] !== undefined) data["ActivitySid"] = params["activitySid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WorkerInstance(operationVersion, payload, instance._solution.workspaceSid)); 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["activityName"] !== undefined) data["ActivityName"] = params["activityName"]; if (params["activitySid"] !== undefined) data["ActivitySid"] = params["activitySid"]; if (params["available"] !== undefined) data["Available"] = params["available"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["targetWorkersExpression"] !== undefined) data["TargetWorkersExpression"] = params["targetWorkersExpression"]; if (params["taskQueueName"] !== undefined) data["TaskQueueName"] = params["taskQueueName"]; if (params["taskQueueSid"] !== undefined) data["TaskQueueSid"] = params["taskQueueSid"]; if (params["ordering"] !== undefined) data["Ordering"] = params["ordering"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkerPage(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 WorkerPage(instance._version, payload, 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; } exports.WorkerListInstance = WorkerListInstance; class WorkerPage extends Page_1.default { /** * Initialize the WorkerPage * * @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 WorkerInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WorkerInstance(this._version, payload, this._solution.workspaceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkerPage = WorkerPage; rest/taskrouter/v1/workspace/taskQueue.d.ts000064400000043517151677225100015031 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { TaskQueueBulkRealTimeStatisticsListInstance } from "./taskQueue/taskQueueBulkRealTimeStatistics"; import { TaskQueueCumulativeStatisticsListInstance } from "./taskQueue/taskQueueCumulativeStatistics"; import { TaskQueueRealTimeStatisticsListInstance } from "./taskQueue/taskQueueRealTimeStatistics"; import { TaskQueueStatisticsListInstance } from "./taskQueue/taskQueueStatistics"; import { TaskQueuesStatisticsListInstance } from "./taskQueue/taskQueuesStatistics"; export type TaskQueueTaskOrder = "FIFO" | "LIFO"; /** * Options to pass to update a TaskQueueInstance */ export interface TaskQueueContextUpdateOptions { /** A descriptive string that you create to describe the TaskQueue. For example `Support-Tier 1`, `Sales`, or `Escalation`. */ friendlyName?: string; /** A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example \\\'\\\"language\\\" == \\\"spanish\\\"\\\' If no TargetWorkers parameter is provided, Tasks will wait in the queue until they are either deleted or moved to another queue. Additional examples on how to describing Worker selection criteria below. */ targetWorkers?: string; /** The SID of the Activity to assign Workers when a task is reserved for them. */ reservationActivitySid?: string; /** The SID of the Activity to assign Workers when a task is assigned for them. */ assignmentActivitySid?: string; /** The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. */ maxReservedWorkers?: number; /** */ taskOrder?: TaskQueueTaskOrder; } /** * Options to pass to create a TaskQueueInstance */ export interface TaskQueueListInstanceCreateOptions { /** A descriptive string that you create to describe the TaskQueue. For example `Support-Tier 1`, `Sales`, or `Escalation`. */ friendlyName: string; /** A string that describes the Worker selection criteria for any Tasks that enter the TaskQueue. For example, `\\\'\\\"language\\\" == \\\"spanish\\\"\\\'`. The default value is `1==1`. If this value is empty, Tasks will wait in the TaskQueue until they are deleted or moved to another TaskQueue. For more information about Worker selection, see [Describing Worker selection criteria](https://www.twilio.com/docs/taskrouter/api/taskqueues#target-workers). */ targetWorkers?: string; /** The maximum number of Workers to reserve for the assignment of a Task in the queue. Can be an integer between 1 and 50, inclusive and defaults to 1. */ maxReservedWorkers?: number; /** */ taskOrder?: TaskQueueTaskOrder; /** The SID of the Activity to assign Workers when a task is reserved for them. */ reservationActivitySid?: string; /** The SID of the Activity to assign Workers when a task is assigned to them. */ assignmentActivitySid?: string; } /** * Options to pass to each */ export interface TaskQueueListInstanceEachOptions { /** The `friendly_name` of the TaskQueue resources to read. */ friendlyName?: string; /** The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. */ evaluateWorkerAttributes?: string; /** The SID of the Worker with the TaskQueue resources to read. */ workerSid?: string; /** Sorting parameter for TaskQueues */ ordering?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: TaskQueueInstance, 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 TaskQueueListInstanceOptions { /** The `friendly_name` of the TaskQueue resources to read. */ friendlyName?: string; /** The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. */ evaluateWorkerAttributes?: string; /** The SID of the Worker with the TaskQueue resources to read. */ workerSid?: string; /** Sorting parameter for TaskQueues */ ordering?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface TaskQueueListInstancePageOptions { /** The `friendly_name` of the TaskQueue resources to read. */ friendlyName?: string; /** The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. */ evaluateWorkerAttributes?: string; /** The SID of the Worker with the TaskQueue resources to read. */ workerSid?: string; /** Sorting parameter for TaskQueues */ ordering?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface TaskQueueContext { cumulativeStatistics: TaskQueueCumulativeStatisticsListInstance; realTimeStatistics: TaskQueueRealTimeStatisticsListInstance; statistics: TaskQueueStatisticsListInstance; /** * Remove a TaskQueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TaskQueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueInstance */ fetch(callback?: (error: Error | null, item?: TaskQueueInstance) => any): Promise<TaskQueueInstance>; /** * Update a TaskQueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueInstance */ update(callback?: (error: Error | null, item?: TaskQueueInstance) => any): Promise<TaskQueueInstance>; /** * Update a TaskQueueInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueInstance */ update(params: TaskQueueContextUpdateOptions, callback?: (error: Error | null, item?: TaskQueueInstance) => any): Promise<TaskQueueInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TaskQueueContextSolution { workspaceSid: string; sid: string; } export declare class TaskQueueContextImpl implements TaskQueueContext { protected _version: V1; protected _solution: TaskQueueContextSolution; protected _uri: string; protected _cumulativeStatistics?: TaskQueueCumulativeStatisticsListInstance; protected _realTimeStatistics?: TaskQueueRealTimeStatisticsListInstance; protected _statistics?: TaskQueueStatisticsListInstance; constructor(_version: V1, workspaceSid: string, sid: string); get cumulativeStatistics(): TaskQueueCumulativeStatisticsListInstance; get realTimeStatistics(): TaskQueueRealTimeStatisticsListInstance; get statistics(): TaskQueueStatisticsListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TaskQueueInstance) => any): Promise<TaskQueueInstance>; update(params?: TaskQueueContextUpdateOptions | ((error: Error | null, item?: TaskQueueInstance) => any), callback?: (error: Error | null, item?: TaskQueueInstance) => any): Promise<TaskQueueInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TaskQueueContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TaskQueuePayload extends TwilioResponsePayload { task_queues: TaskQueueResource[]; } interface TaskQueueResource { account_sid: string; assignment_activity_sid: string; assignment_activity_name: string; date_created: Date; date_updated: Date; friendly_name: string; max_reserved_workers: number; reservation_activity_sid: string; reservation_activity_name: string; sid: string; target_workers: string; task_order: TaskQueueTaskOrder; url: string; workspace_sid: string; links: Record<string, string>; } export declare class TaskQueueInstance { protected _version: V1; protected _solution: TaskQueueContextSolution; protected _context?: TaskQueueContext; constructor(_version: V1, payload: TaskQueueResource, workspaceSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. */ accountSid: string; /** * The SID of the Activity to assign Workers when a task is assigned for them. */ assignmentActivitySid: string; /** * The name of the Activity to assign Workers when a task is assigned for them. */ assignmentActivityName: 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 string that you assigned to describe the resource. */ friendlyName: string; /** * The maximum number of Workers to reserve for the assignment of a task in the queue. Can be an integer between 1 and 50, inclusive and defaults to 1. */ maxReservedWorkers: number; /** * The SID of the Activity to assign Workers once a task is reserved for them. */ reservationActivitySid: string; /** * The name of the Activity to assign Workers once a task is reserved for them. */ reservationActivityName: string; /** * The unique string that we created to identify the TaskQueue resource. */ sid: string; /** * A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example `\'\"language\" == \"spanish\"\'` If no TargetWorkers parameter is provided, Tasks will wait in the TaskQueue until they are either deleted or moved to another TaskQueue. Additional examples on how to describing Worker selection criteria below. Defaults to 1==1. */ targetWorkers: string; taskOrder: TaskQueueTaskOrder; /** * The absolute URL of the TaskQueue resource. */ url: string; /** * The SID of the Workspace that contains the TaskQueue. */ workspaceSid: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a TaskQueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TaskQueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueInstance */ fetch(callback?: (error: Error | null, item?: TaskQueueInstance) => any): Promise<TaskQueueInstance>; /** * Update a TaskQueueInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueInstance */ update(callback?: (error: Error | null, item?: TaskQueueInstance) => any): Promise<TaskQueueInstance>; /** * Update a TaskQueueInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueInstance */ update(params: TaskQueueContextUpdateOptions, callback?: (error: Error | null, item?: TaskQueueInstance) => any): Promise<TaskQueueInstance>; /** * Access the cumulativeStatistics. */ cumulativeStatistics(): TaskQueueCumulativeStatisticsListInstance; /** * Access the realTimeStatistics. */ realTimeStatistics(): TaskQueueRealTimeStatisticsListInstance; /** * Access the statistics. */ statistics(): TaskQueueStatisticsListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; assignmentActivitySid: string; assignmentActivityName: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; maxReservedWorkers: number; reservationActivitySid: string; reservationActivityName: string; sid: string; targetWorkers: string; taskOrder: TaskQueueTaskOrder; url: string; workspaceSid: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TaskQueueSolution { workspaceSid: string; } export interface TaskQueueListInstance { _version: V1; _solution: TaskQueueSolution; _uri: string; (sid: string): TaskQueueContext; get(sid: string): TaskQueueContext; _bulkRealTimeStatistics?: TaskQueueBulkRealTimeStatisticsListInstance; bulkRealTimeStatistics: TaskQueueBulkRealTimeStatisticsListInstance; _statistics?: TaskQueuesStatisticsListInstance; statistics: TaskQueuesStatisticsListInstance; /** * Create a TaskQueueInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskQueueInstance */ create(params: TaskQueueListInstanceCreateOptions, callback?: (error: Error | null, item?: TaskQueueInstance) => any): Promise<TaskQueueInstance>; /** * Streams TaskQueueInstance 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 { TaskQueueListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TaskQueueInstance, done: (err?: Error) => void) => void): void; each(params: TaskQueueListInstanceEachOptions, callback?: (item: TaskQueueInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TaskQueueInstance 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: TaskQueuePage) => any): Promise<TaskQueuePage>; /** * Lists TaskQueueInstance 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 { TaskQueueListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TaskQueueInstance[]) => any): Promise<TaskQueueInstance[]>; list(params: TaskQueueListInstanceOptions, callback?: (error: Error | null, items: TaskQueueInstance[]) => any): Promise<TaskQueueInstance[]>; /** * Retrieve a single page of TaskQueueInstance 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 { TaskQueueListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TaskQueuePage) => any): Promise<TaskQueuePage>; page(params: TaskQueueListInstancePageOptions, callback?: (error: Error | null, items: TaskQueuePage) => any): Promise<TaskQueuePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TaskQueueListInstance(version: V1, workspaceSid: string): TaskQueueListInstance; export declare class TaskQueuePage extends Page<V1, TaskQueuePayload, TaskQueueResource, TaskQueueInstance> { /** * Initialize the TaskQueuePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TaskQueueSolution); /** * Build an instance of TaskQueueInstance * * @param payload - Payload response from the API */ getInstance(payload: TaskQueueResource): TaskQueueInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/task.js000064400000034523151677225100013565 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.TaskPage = exports.TaskListInstance = exports.TaskInstance = exports.TaskContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const reservation_1 = require("./task/reservation"); class TaskContextImpl { constructor(_version, workspaceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, sid }; this._uri = `/Workspaces/${workspaceSid}/Tasks/${sid}`; } get reservations() { this._reservations = this._reservations || (0, reservation_1.ReservationListInstance)(this._version, this._solution.workspaceSid, this._solution.sid); return this._reservations; } remove(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; const headers = {}; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", params: data, headers, }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TaskInstance(operationVersion, payload, instance._solution.workspaceSid, 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["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["assignmentStatus"] !== undefined) data["AssignmentStatus"] = params["assignmentStatus"]; if (params["reason"] !== undefined) data["Reason"] = params["reason"]; if (params["priority"] !== undefined) data["Priority"] = params["priority"]; if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["virtualStartTime"] !== undefined) data["VirtualStartTime"] = serialize.iso8601DateTime(params["virtualStartTime"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TaskInstance(operationVersion, payload, instance._solution.workspaceSid, 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.TaskContextImpl = TaskContextImpl; class TaskInstance { constructor(_version, payload, workspaceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.age = deserialize.integer(payload.age); this.assignmentStatus = payload.assignment_status; this.attributes = payload.attributes; this.addons = payload.addons; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.taskQueueEnteredDate = deserialize.iso8601DateTime(payload.task_queue_entered_date); this.priority = deserialize.integer(payload.priority); this.reason = payload.reason; this.sid = payload.sid; this.taskQueueSid = payload.task_queue_sid; this.taskQueueFriendlyName = payload.task_queue_friendly_name; this.taskChannelSid = payload.task_channel_sid; this.taskChannelUniqueName = payload.task_channel_unique_name; this.timeout = deserialize.integer(payload.timeout); this.workflowSid = payload.workflow_sid; this.workflowFriendlyName = payload.workflow_friendly_name; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this.links = payload.links; this.virtualStartTime = deserialize.iso8601DateTime(payload.virtual_start_time); this.ignoreCapacity = payload.ignore_capacity; this.routingTarget = payload.routing_target; this._solution = { workspaceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TaskContextImpl(this._version, this._solution.workspaceSid, this._solution.sid); return this._context; } remove(params, callback) { return this._proxy.remove(params, callback); } /** * Fetch a TaskInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the reservations. */ reservations() { return this._proxy.reservations; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, age: this.age, assignmentStatus: this.assignmentStatus, attributes: this.attributes, addons: this.addons, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, taskQueueEnteredDate: this.taskQueueEnteredDate, priority: this.priority, reason: this.reason, sid: this.sid, taskQueueSid: this.taskQueueSid, taskQueueFriendlyName: this.taskQueueFriendlyName, taskChannelSid: this.taskChannelSid, taskChannelUniqueName: this.taskChannelUniqueName, timeout: this.timeout, workflowSid: this.workflowSid, workflowFriendlyName: this.workflowFriendlyName, workspaceSid: this.workspaceSid, url: this.url, links: this.links, virtualStartTime: this.virtualStartTime, ignoreCapacity: this.ignoreCapacity, routingTarget: this.routingTarget, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskInstance = TaskInstance; function TaskListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TaskContextImpl(version, workspaceSid, sid); }; instance._version = version; instance._solution = { workspaceSid }; instance._uri = `/Workspaces/${workspaceSid}/Tasks`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["timeout"] !== undefined) data["Timeout"] = params["timeout"]; if (params["priority"] !== undefined) data["Priority"] = params["priority"]; if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["workflowSid"] !== undefined) data["WorkflowSid"] = params["workflowSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; if (params["virtualStartTime"] !== undefined) data["VirtualStartTime"] = serialize.iso8601DateTime(params["virtualStartTime"]); if (params["routingTarget"] !== undefined) data["RoutingTarget"] = params["routingTarget"]; if (params["ignoreCapacity"] !== undefined) data["IgnoreCapacity"] = params["ignoreCapacity"]; if (params["taskQueueSid"] !== undefined) data["TaskQueueSid"] = params["taskQueueSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TaskInstance(operationVersion, payload, instance._solution.workspaceSid)); 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["priority"] !== undefined) data["Priority"] = params["priority"]; if (params["assignmentStatus"] !== undefined) data["AssignmentStatus"] = serialize.map(params["assignmentStatus"], (e) => e); if (params["workflowSid"] !== undefined) data["WorkflowSid"] = params["workflowSid"]; if (params["workflowName"] !== undefined) data["WorkflowName"] = params["workflowName"]; if (params["taskQueueSid"] !== undefined) data["TaskQueueSid"] = params["taskQueueSid"]; if (params["taskQueueName"] !== undefined) data["TaskQueueName"] = params["taskQueueName"]; if (params["evaluateTaskAttributes"] !== undefined) data["EvaluateTaskAttributes"] = params["evaluateTaskAttributes"]; if (params["routingTarget"] !== undefined) data["RoutingTarget"] = params["routingTarget"]; if (params["ordering"] !== undefined) data["Ordering"] = params["ordering"]; if (params["hasAddons"] !== undefined) data["HasAddons"] = serialize.bool(params["hasAddons"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TaskPage(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 TaskPage(instance._version, payload, 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; } exports.TaskListInstance = TaskListInstance; class TaskPage extends Page_1.default { /** * Initialize the TaskPage * * @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 TaskInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TaskInstance(this._version, payload, this._solution.workspaceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskPage = TaskPage; rest/taskrouter/v1/workspace/taskChannel.js000064400000024756151677225100015065 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.TaskChannelPage = exports.TaskChannelListInstance = exports.TaskChannelInstance = exports.TaskChannelContextImpl = void 0; 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 TaskChannelContextImpl { constructor(_version, workspaceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, sid }; this._uri = `/Workspaces/${workspaceSid}/TaskChannels/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TaskChannelInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["channelOptimizedRouting"] !== undefined) data["ChannelOptimizedRouting"] = serialize.bool(params["channelOptimizedRouting"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TaskChannelInstance(operationVersion, payload, instance._solution.workspaceSid, 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.TaskChannelContextImpl = TaskChannelContextImpl; class TaskChannelInstance { constructor(_version, payload, workspaceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.workspaceSid = payload.workspace_sid; this.channelOptimizedRouting = payload.channel_optimized_routing; this.url = payload.url; this.links = payload.links; this._solution = { workspaceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TaskChannelContextImpl(this._version, this._solution.workspaceSid, this._solution.sid); return this._context; } /** * Remove a TaskChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TaskChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, sid: this.sid, uniqueName: this.uniqueName, workspaceSid: this.workspaceSid, channelOptimizedRouting: this.channelOptimizedRouting, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskChannelInstance = TaskChannelInstance; function TaskChannelListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TaskChannelContextImpl(version, workspaceSid, sid); }; instance._version = version; instance._solution = { workspaceSid }; instance._uri = `/Workspaces/${workspaceSid}/TaskChannels`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["uniqueName"] === null || params["uniqueName"] === undefined) { throw new Error("Required parameter \"params['uniqueName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["UniqueName"] = params["uniqueName"]; if (params["channelOptimizedRouting"] !== undefined) data["ChannelOptimizedRouting"] = serialize.bool(params["channelOptimizedRouting"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TaskChannelInstance(operationVersion, payload, instance._solution.workspaceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TaskChannelPage(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 TaskChannelPage(instance._version, payload, 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; } exports.TaskChannelListInstance = TaskChannelListInstance; class TaskChannelPage extends Page_1.default { /** * Initialize the TaskChannelPage * * @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 TaskChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TaskChannelInstance(this._version, payload, this._solution.workspaceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TaskChannelPage = TaskChannelPage; rest/taskrouter/v1/workspace/task.d.ts000064400000061702151677225100014020 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { ReservationListInstance } from "./task/reservation"; export type TaskStatus = "pending" | "reserved" | "assigned" | "canceled" | "completed" | "wrapping"; /** * Options to pass to remove a TaskInstance */ export interface TaskContextRemoveOptions { /** If provided, deletes this Task if (and only if) the [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header of the Task matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). */ ifMatch?: string; } /** * Options to pass to update a TaskInstance */ export interface TaskContextUpdateOptions { /** If provided, applies this mutation if (and only if) the [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header of the Task matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). */ ifMatch?: string; /** The JSON string that describes the custom attributes of the task. */ attributes?: string; /** */ assignmentStatus?: TaskStatus; /** The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. */ reason?: string; /** The Task\\\'s new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). */ priority?: number; /** When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel\\\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** The task\\\'s new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can\\\'t be in the future. */ virtualStartTime?: Date; } /** * Options to pass to create a TaskInstance */ export interface TaskListInstanceCreateOptions { /** The amount of time in seconds the new task can live before being assigned. Can be up to a maximum of 2 weeks (1,209,600 seconds). The default value is 24 hours (86,400 seconds). On timeout, the `task.canceled` event will fire with description `Task TTL Exceeded`. */ timeout?: number; /** The priority to assign the new task and override the default. When supplied, the new Task will have this priority unless it matches a Workflow Target with a Priority set. When not supplied, the new Task will have the priority of the matching Workflow Target. Value can be 0 to 2^31^ (2,147,483,647). */ priority?: number; /** When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. */ taskChannel?: string; /** The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. */ workflowSid?: string; /** A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow\\\'s `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. */ attributes?: string; /** The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can\\\'t be in the future. */ virtualStartTime?: Date; /** A SID of a Worker, Queue, or Workflow to route a Task to */ routingTarget?: string; /** A boolean indicating if a new task should respect a worker\\\'s capacity during assignment */ ignoreCapacity?: string; /** The SID of the TaskQueue in which the Task belongs */ taskQueueSid?: string; } /** * Options to pass to each */ export interface TaskListInstanceEachOptions { /** The priority value of the Tasks to read. Returns the list of all Tasks in the Workspace with the specified priority. */ priority?: number; /** The `assignment_status` of the Tasks you want to read. Can be: `pending`, `reserved`, `assigned`, `canceled`, `wrapping`, or `completed`. Returns all Tasks in the Workspace with the specified `assignment_status`. */ assignmentStatus?: Array<string>; /** The SID of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this SID. */ workflowSid?: string; /** The friendly name of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this friendly name. */ workflowName?: string; /** The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. */ taskQueueSid?: string; /** The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. */ taskQueueName?: string; /** The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. */ evaluateTaskAttributes?: string; /** A SID of a Worker, Queue, or Workflow to route a Task to */ routingTarget?: string; /** How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. */ ordering?: string; /** Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. */ hasAddons?: boolean; /** 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: TaskInstance, 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 TaskListInstanceOptions { /** The priority value of the Tasks to read. Returns the list of all Tasks in the Workspace with the specified priority. */ priority?: number; /** The `assignment_status` of the Tasks you want to read. Can be: `pending`, `reserved`, `assigned`, `canceled`, `wrapping`, or `completed`. Returns all Tasks in the Workspace with the specified `assignment_status`. */ assignmentStatus?: Array<string>; /** The SID of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this SID. */ workflowSid?: string; /** The friendly name of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this friendly name. */ workflowName?: string; /** The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. */ taskQueueSid?: string; /** The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. */ taskQueueName?: string; /** The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. */ evaluateTaskAttributes?: string; /** A SID of a Worker, Queue, or Workflow to route a Task to */ routingTarget?: string; /** How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. */ ordering?: string; /** Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. */ hasAddons?: boolean; /** 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 TaskListInstancePageOptions { /** The priority value of the Tasks to read. Returns the list of all Tasks in the Workspace with the specified priority. */ priority?: number; /** The `assignment_status` of the Tasks you want to read. Can be: `pending`, `reserved`, `assigned`, `canceled`, `wrapping`, or `completed`. Returns all Tasks in the Workspace with the specified `assignment_status`. */ assignmentStatus?: Array<string>; /** The SID of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this SID. */ workflowSid?: string; /** The friendly name of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this friendly name. */ workflowName?: string; /** The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. */ taskQueueSid?: string; /** The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. */ taskQueueName?: string; /** The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. */ evaluateTaskAttributes?: string; /** A SID of a Worker, Queue, or Workflow to route a Task to */ routingTarget?: string; /** How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. */ ordering?: string; /** Whether to read Tasks with Add-ons. If `true`, returns only Tasks with Add-ons. If `false`, returns only Tasks without Add-ons. */ hasAddons?: boolean; /** 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 TaskContext { reservations: ReservationListInstance; /** * Remove a TaskInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a TaskInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ remove(params: TaskContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TaskInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ fetch(callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; /** * Update a TaskInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ update(callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; /** * Update a TaskInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ update(params: TaskContextUpdateOptions, callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TaskContextSolution { workspaceSid: string; sid: string; } export declare class TaskContextImpl implements TaskContext { protected _version: V1; protected _solution: TaskContextSolution; protected _uri: string; protected _reservations?: ReservationListInstance; constructor(_version: V1, workspaceSid: string, sid: string); get reservations(): ReservationListInstance; remove(params?: TaskContextRemoveOptions | ((error: Error | null, item?: boolean) => any), callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; update(params?: TaskContextUpdateOptions | ((error: Error | null, item?: TaskInstance) => any), callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TaskContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TaskPayload extends TwilioResponsePayload { tasks: TaskResource[]; } interface TaskResource { account_sid: string; age: number; assignment_status: TaskStatus; attributes: string; addons: string; date_created: Date; date_updated: Date; task_queue_entered_date: Date; priority: number; reason: string; sid: string; task_queue_sid: string; task_queue_friendly_name: string; task_channel_sid: string; task_channel_unique_name: string; timeout: number; workflow_sid: string; workflow_friendly_name: string; workspace_sid: string; url: string; links: Record<string, string>; virtual_start_time: Date; ignore_capacity: boolean; routing_target: string; } export declare class TaskInstance { protected _version: V1; protected _solution: TaskContextSolution; protected _context?: TaskContext; constructor(_version: V1, payload: TaskResource, workspaceSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. */ accountSid: string; /** * The number of seconds since the Task was created. */ age: number; assignmentStatus: TaskStatus; /** * The JSON string with custom attributes of the work. **Note** If this property has been assigned a value, it will only be displayed in FETCH action that returns a single resource. Otherwise, it will be null. */ attributes: string; /** * An object that contains the [Add-on](https://www.twilio.com/docs/add-ons) data for all installed Add-ons. */ addons: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The date and time in GMT when the Task entered the TaskQueue, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ taskQueueEnteredDate: Date; /** * The current priority score of the Task as assigned to a Worker by the workflow. Tasks with higher priority values will be assigned before Tasks with lower values. */ priority: number; /** * The reason the Task was canceled or completed, if applicable. */ reason: string; /** * The unique string that we created to identify the Task resource. */ sid: string; /** * The SID of the TaskQueue. */ taskQueueSid: string; /** * The friendly name of the TaskQueue. */ taskQueueFriendlyName: string; /** * The SID of the TaskChannel. */ taskChannelSid: string; /** * The unique name of the TaskChannel. */ taskChannelUniqueName: string; /** * The amount of time in seconds that the Task can live before being assigned. */ timeout: number; /** * The SID of the Workflow that is controlling the Task. */ workflowSid: string; /** * The friendly name of the Workflow that is controlling the Task. */ workflowFriendlyName: string; /** * The SID of the Workspace that contains the Task. */ workspaceSid: string; /** * The absolute URL of the Task resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; /** * The date and time in GMT indicating the ordering for routing of the Task specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ virtualStartTime: Date; /** * A boolean indicating if a new task should respect a worker\'s capacity during assignment */ ignoreCapacity: boolean; /** * A SID of a Worker, Queue, or Workflow to route a Task to */ routingTarget: string; private get _proxy(); /** * Remove a TaskInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Remove a TaskInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ remove(params: TaskContextRemoveOptions, callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TaskInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ fetch(callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; /** * Update a TaskInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ update(callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; /** * Update a TaskInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ update(params: TaskContextUpdateOptions, callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; /** * Access the reservations. */ reservations(): ReservationListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; age: number; assignmentStatus: TaskStatus; attributes: string; addons: string; dateCreated: Date; dateUpdated: Date; taskQueueEnteredDate: Date; priority: number; reason: string; sid: string; taskQueueSid: string; taskQueueFriendlyName: string; taskChannelSid: string; taskChannelUniqueName: string; timeout: number; workflowSid: string; workflowFriendlyName: string; workspaceSid: string; url: string; links: Record<string, string>; virtualStartTime: Date; ignoreCapacity: boolean; routingTarget: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TaskSolution { workspaceSid: string; } export interface TaskListInstance { _version: V1; _solution: TaskSolution; _uri: string; (sid: string): TaskContext; get(sid: string): TaskContext; /** * Create a TaskInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ create(callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; /** * Create a TaskInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskInstance */ create(params: TaskListInstanceCreateOptions, callback?: (error: Error | null, item?: TaskInstance) => any): Promise<TaskInstance>; /** * Streams TaskInstance 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 { TaskListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TaskInstance, done: (err?: Error) => void) => void): void; each(params: TaskListInstanceEachOptions, callback?: (item: TaskInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TaskInstance 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: TaskPage) => any): Promise<TaskPage>; /** * Lists TaskInstance 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 { TaskListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TaskInstance[]) => any): Promise<TaskInstance[]>; list(params: TaskListInstanceOptions, callback?: (error: Error | null, items: TaskInstance[]) => any): Promise<TaskInstance[]>; /** * Retrieve a single page of TaskInstance 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 { TaskListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TaskPage) => any): Promise<TaskPage>; page(params: TaskListInstancePageOptions, callback?: (error: Error | null, items: TaskPage) => any): Promise<TaskPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TaskListInstance(version: V1, workspaceSid: string): TaskListInstance; export declare class TaskPage extends Page<V1, TaskPayload, TaskResource, TaskInstance> { /** * Initialize the TaskPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TaskSolution); /** * Build an instance of TaskInstance * * @param payload - Payload response from the API */ getInstance(payload: TaskResource): TaskInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/taskChannel.d.ts000064400000031071151677225100015305 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to update a TaskChannelInstance */ export interface TaskChannelContextUpdateOptions { /** A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. */ friendlyName?: string; /** Whether the TaskChannel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. */ channelOptimizedRouting?: boolean; } /** * Options to pass to create a TaskChannelInstance */ export interface TaskChannelListInstanceCreateOptions { /** A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. */ friendlyName: string; /** An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. */ uniqueName: string; /** Whether the Task Channel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. */ channelOptimizedRouting?: boolean; } /** * Options to pass to each */ export interface TaskChannelListInstanceEachOptions { /** 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: TaskChannelInstance, 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 TaskChannelListInstanceOptions { /** 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 TaskChannelListInstancePageOptions { /** 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 TaskChannelContext { /** * Remove a TaskChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TaskChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskChannelInstance */ fetch(callback?: (error: Error | null, item?: TaskChannelInstance) => any): Promise<TaskChannelInstance>; /** * Update a TaskChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskChannelInstance */ update(callback?: (error: Error | null, item?: TaskChannelInstance) => any): Promise<TaskChannelInstance>; /** * Update a TaskChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskChannelInstance */ update(params: TaskChannelContextUpdateOptions, callback?: (error: Error | null, item?: TaskChannelInstance) => any): Promise<TaskChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TaskChannelContextSolution { workspaceSid: string; sid: string; } export declare class TaskChannelContextImpl implements TaskChannelContext { protected _version: V1; protected _solution: TaskChannelContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TaskChannelInstance) => any): Promise<TaskChannelInstance>; update(params?: TaskChannelContextUpdateOptions | ((error: Error | null, item?: TaskChannelInstance) => any), callback?: (error: Error | null, item?: TaskChannelInstance) => any): Promise<TaskChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TaskChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TaskChannelPayload extends TwilioResponsePayload { channels: TaskChannelResource[]; } interface TaskChannelResource { account_sid: string; date_created: Date; date_updated: Date; friendly_name: string; sid: string; unique_name: string; workspace_sid: string; channel_optimized_routing: boolean; url: string; links: Record<string, string>; } export declare class TaskChannelInstance { protected _version: V1; protected _solution: TaskChannelContextSolution; protected _context?: TaskChannelContext; constructor(_version: V1, payload: TaskChannelResource, workspaceSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task Channel resource. */ accountSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The unique string that we created to identify the Task Channel resource. */ sid: string; /** * An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. */ uniqueName: string; /** * The SID of the Workspace that contains the Task Channel. */ workspaceSid: string; /** * Whether the Task Channel will prioritize Workers that have been idle. When `true`, Workers that have been idle the longest are prioritized. */ channelOptimizedRouting: boolean; /** * The absolute URL of the Task Channel resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a TaskChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TaskChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskChannelInstance */ fetch(callback?: (error: Error | null, item?: TaskChannelInstance) => any): Promise<TaskChannelInstance>; /** * Update a TaskChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskChannelInstance */ update(callback?: (error: Error | null, item?: TaskChannelInstance) => any): Promise<TaskChannelInstance>; /** * Update a TaskChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskChannelInstance */ update(params: TaskChannelContextUpdateOptions, callback?: (error: Error | null, item?: TaskChannelInstance) => any): Promise<TaskChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; sid: string; uniqueName: string; workspaceSid: string; channelOptimizedRouting: boolean; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TaskChannelSolution { workspaceSid: string; } export interface TaskChannelListInstance { _version: V1; _solution: TaskChannelSolution; _uri: string; (sid: string): TaskChannelContext; get(sid: string): TaskChannelContext; /** * Create a TaskChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TaskChannelInstance */ create(params: TaskChannelListInstanceCreateOptions, callback?: (error: Error | null, item?: TaskChannelInstance) => any): Promise<TaskChannelInstance>; /** * Streams TaskChannelInstance 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 { TaskChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TaskChannelInstance, done: (err?: Error) => void) => void): void; each(params: TaskChannelListInstanceEachOptions, callback?: (item: TaskChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TaskChannelInstance 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: TaskChannelPage) => any): Promise<TaskChannelPage>; /** * Lists TaskChannelInstance 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 { TaskChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TaskChannelInstance[]) => any): Promise<TaskChannelInstance[]>; list(params: TaskChannelListInstanceOptions, callback?: (error: Error | null, items: TaskChannelInstance[]) => any): Promise<TaskChannelInstance[]>; /** * Retrieve a single page of TaskChannelInstance 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 { TaskChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TaskChannelPage) => any): Promise<TaskChannelPage>; page(params: TaskChannelListInstancePageOptions, callback?: (error: Error | null, items: TaskChannelPage) => any): Promise<TaskChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TaskChannelListInstance(version: V1, workspaceSid: string): TaskChannelListInstance; export declare class TaskChannelPage extends Page<V1, TaskChannelPayload, TaskChannelResource, TaskChannelInstance> { /** * Initialize the TaskChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TaskChannelSolution); /** * Build an instance of TaskChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: TaskChannelResource): TaskChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/workspaceRealTimeStatistics.js000064400000012246151677225100020315 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkspaceRealTimeStatisticsListInstance = exports.WorkspaceRealTimeStatisticsInstance = exports.WorkspaceRealTimeStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class WorkspaceRealTimeStatisticsContextImpl { constructor(_version, workspaceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } this._solution = { workspaceSid }; this._uri = `/Workspaces/${workspaceSid}/RealTimeStatistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkspaceRealTimeStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid)); 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.WorkspaceRealTimeStatisticsContextImpl = WorkspaceRealTimeStatisticsContextImpl; class WorkspaceRealTimeStatisticsInstance { constructor(_version, payload, workspaceSid) { this._version = _version; this.accountSid = payload.account_sid; this.activityStatistics = payload.activity_statistics; this.longestTaskWaitingAge = deserialize.integer(payload.longest_task_waiting_age); this.longestTaskWaitingSid = payload.longest_task_waiting_sid; this.tasksByPriority = payload.tasks_by_priority; this.tasksByStatus = payload.tasks_by_status; this.totalTasks = deserialize.integer(payload.total_tasks); this.totalWorkers = deserialize.integer(payload.total_workers); this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid }; } get _proxy() { this._context = this._context || new WorkspaceRealTimeStatisticsContextImpl(this._version, this._solution.workspaceSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, activityStatistics: this.activityStatistics, longestTaskWaitingAge: this.longestTaskWaitingAge, longestTaskWaitingSid: this.longestTaskWaitingSid, tasksByPriority: this.tasksByPriority, tasksByStatus: this.tasksByStatus, totalTasks: this.totalTasks, totalWorkers: this.totalWorkers, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkspaceRealTimeStatisticsInstance = WorkspaceRealTimeStatisticsInstance; function WorkspaceRealTimeStatisticsListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkspaceRealTimeStatisticsContextImpl(version, workspaceSid); }; instance._version = version; instance._solution = { workspaceSid }; 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; } exports.WorkspaceRealTimeStatisticsListInstance = WorkspaceRealTimeStatisticsListInstance; rest/taskrouter/v1/workspace/event.d.ts000064400000034734151677225100014204 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to each */ export interface EventListInstanceEachOptions { /** Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** The type of Events to read. Returns only Events of the type specified. */ eventType?: string; /** The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted. */ minutes?: number; /** The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation. */ reservationSid?: string; /** Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted. */ startDate?: Date; /** The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue. */ taskQueueSid?: string; /** The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task. */ taskSid?: string; /** The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker. */ workerSid?: string; /** The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow. */ workflowSid?: string; /** The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel. */ taskChannel?: string; /** The SID of the Event resource to read. */ sid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: EventInstance, 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 EventListInstanceOptions { /** Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** The type of Events to read. Returns only Events of the type specified. */ eventType?: string; /** The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted. */ minutes?: number; /** The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation. */ reservationSid?: string; /** Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted. */ startDate?: Date; /** The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue. */ taskQueueSid?: string; /** The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task. */ taskSid?: string; /** The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker. */ workerSid?: string; /** The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow. */ workflowSid?: string; /** The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel. */ taskChannel?: string; /** The SID of the Event resource to read. */ sid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface EventListInstancePageOptions { /** Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** The type of Events to read. Returns only Events of the type specified. */ eventType?: string; /** The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted. */ minutes?: number; /** The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation. */ reservationSid?: string; /** Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted. */ startDate?: Date; /** The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue. */ taskQueueSid?: string; /** The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task. */ taskSid?: string; /** The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker. */ workerSid?: string; /** The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow. */ workflowSid?: string; /** The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel. */ taskChannel?: string; /** The SID of the Event resource to read. */ sid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface EventContext { /** * Fetch a EventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EventInstance */ fetch(callback?: (error: Error | null, item?: EventInstance) => any): Promise<EventInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EventContextSolution { workspaceSid: string; sid: string; } export declare class EventContextImpl implements EventContext { protected _version: V1; protected _solution: EventContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, sid: string); fetch(callback?: (error: Error | null, item?: EventInstance) => any): Promise<EventInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EventContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EventPayload extends TwilioResponsePayload { events: EventResource[]; } interface EventResource { account_sid: string; actor_sid: string; actor_type: string; actor_url: string; description: string; event_data: any; event_date: Date; event_date_ms: number; event_type: string; resource_sid: string; resource_type: string; resource_url: string; sid: string; source: string; source_ip_address: string; url: string; workspace_sid: string; } export declare class EventInstance { protected _version: V1; protected _solution: EventContextSolution; protected _context?: EventContext; constructor(_version: V1, payload: EventResource, workspaceSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. */ accountSid: string; /** * The SID of the resource that triggered the event. */ actorSid: string; /** * The type of resource that triggered the event. */ actorType: string; /** * The absolute URL of the resource that triggered the event. */ actorUrl: string; /** * A description of the event. */ description: string; /** * Data about the event. For more information, see [Event types](https://www.twilio.com/docs/taskrouter/api/event#event-types). */ eventData: any; /** * The time the event was sent, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ eventDate: Date; /** * The time the event was sent in milliseconds. */ eventDateMs: number; /** * The identifier for the event. */ eventType: string; /** * The SID of the object the event is most relevant to, such as a TaskSid, ReservationSid, or a WorkerSid. */ resourceSid: string; /** * The type of object the event is most relevant to, such as a Task, Reservation, or a Worker). */ resourceType: string; /** * The URL of the resource the event is most relevant to. */ resourceUrl: string; /** * The unique string that we created to identify the Event resource. */ sid: string; /** * Where the Event originated. */ source: string; /** * The IP from which the Event originated. */ sourceIpAddress: string; /** * The absolute URL of the Event resource. */ url: string; /** * The SID of the Workspace that contains the Event. */ workspaceSid: string; private get _proxy(); /** * Fetch a EventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EventInstance */ fetch(callback?: (error: Error | null, item?: EventInstance) => any): Promise<EventInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; actorSid: string; actorType: string; actorUrl: string; description: string; eventData: any; eventDate: Date; eventDateMs: number; eventType: string; resourceSid: string; resourceType: string; resourceUrl: string; sid: string; source: string; sourceIpAddress: string; url: string; workspaceSid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EventSolution { workspaceSid: string; } export interface EventListInstance { _version: V1; _solution: EventSolution; _uri: string; (sid: string): EventContext; get(sid: string): EventContext; /** * Streams EventInstance 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 { EventListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EventInstance, done: (err?: Error) => void) => void): void; each(params: EventListInstanceEachOptions, callback?: (item: EventInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EventInstance 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: EventPage) => any): Promise<EventPage>; /** * Lists EventInstance 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 { EventListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>; list(params: EventListInstanceOptions, callback?: (error: Error | null, items: EventInstance[]) => any): Promise<EventInstance[]>; /** * Retrieve a single page of EventInstance 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 { EventListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>; page(params: EventListInstancePageOptions, callback?: (error: Error | null, items: EventPage) => any): Promise<EventPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EventListInstance(version: V1, workspaceSid: string): EventListInstance; export declare class EventPage extends Page<V1, EventPayload, EventResource, EventInstance> { /** * Initialize the EventPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: EventSolution); /** * Build an instance of EventInstance * * @param payload - Payload response from the API */ getInstance(payload: EventResource): EventInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.js000064400000016304151677225100020730 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkspaceCumulativeStatisticsListInstance = exports.WorkspaceCumulativeStatisticsInstance = exports.WorkspaceCumulativeStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class WorkspaceCumulativeStatisticsContextImpl { constructor(_version, workspaceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } this._solution = { workspaceSid }; this._uri = `/Workspaces/${workspaceSid}/CumulativeStatistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; if (params["splitByWaitTime"] !== undefined) data["SplitByWaitTime"] = params["splitByWaitTime"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkspaceCumulativeStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid)); 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.WorkspaceCumulativeStatisticsContextImpl = WorkspaceCumulativeStatisticsContextImpl; class WorkspaceCumulativeStatisticsInstance { constructor(_version, payload, workspaceSid) { this._version = _version; this.accountSid = payload.account_sid; this.avgTaskAcceptanceTime = deserialize.integer(payload.avg_task_acceptance_time); this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.reservationsCreated = deserialize.integer(payload.reservations_created); this.reservationsAccepted = deserialize.integer(payload.reservations_accepted); this.reservationsRejected = deserialize.integer(payload.reservations_rejected); this.reservationsTimedOut = deserialize.integer(payload.reservations_timed_out); this.reservationsCanceled = deserialize.integer(payload.reservations_canceled); this.reservationsRescinded = deserialize.integer(payload.reservations_rescinded); this.splitByWaitTime = payload.split_by_wait_time; this.waitDurationUntilAccepted = payload.wait_duration_until_accepted; this.waitDurationUntilCanceled = payload.wait_duration_until_canceled; this.tasksCanceled = deserialize.integer(payload.tasks_canceled); this.tasksCompleted = deserialize.integer(payload.tasks_completed); this.tasksCreated = deserialize.integer(payload.tasks_created); this.tasksDeleted = deserialize.integer(payload.tasks_deleted); this.tasksMoved = deserialize.integer(payload.tasks_moved); this.tasksTimedOutInWorkflow = deserialize.integer(payload.tasks_timed_out_in_workflow); this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid }; } get _proxy() { this._context = this._context || new WorkspaceCumulativeStatisticsContextImpl(this._version, this._solution.workspaceSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, avgTaskAcceptanceTime: this.avgTaskAcceptanceTime, startTime: this.startTime, endTime: this.endTime, reservationsCreated: this.reservationsCreated, reservationsAccepted: this.reservationsAccepted, reservationsRejected: this.reservationsRejected, reservationsTimedOut: this.reservationsTimedOut, reservationsCanceled: this.reservationsCanceled, reservationsRescinded: this.reservationsRescinded, splitByWaitTime: this.splitByWaitTime, waitDurationUntilAccepted: this.waitDurationUntilAccepted, waitDurationUntilCanceled: this.waitDurationUntilCanceled, tasksCanceled: this.tasksCanceled, tasksCompleted: this.tasksCompleted, tasksCreated: this.tasksCreated, tasksDeleted: this.tasksDeleted, tasksMoved: this.tasksMoved, tasksTimedOutInWorkflow: this.tasksTimedOutInWorkflow, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkspaceCumulativeStatisticsInstance = WorkspaceCumulativeStatisticsInstance; function WorkspaceCumulativeStatisticsListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkspaceCumulativeStatisticsContextImpl(version, workspaceSid); }; instance._version = version; instance._solution = { workspaceSid }; 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; } exports.WorkspaceCumulativeStatisticsListInstance = WorkspaceCumulativeStatisticsListInstance; rest/taskrouter/v1/workspace/worker/workerStatistics.d.ts000064400000012377151677225100017757 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a WorkerStatisticsInstance */ export interface WorkerStatisticsContextFetchOptions { /** Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** Only calculate statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; } export interface WorkerStatisticsContext { /** * Fetch a WorkerStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkerStatisticsInstance) => any): Promise<WorkerStatisticsInstance>; /** * Fetch a WorkerStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerStatisticsInstance */ fetch(params: WorkerStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkerStatisticsInstance) => any): Promise<WorkerStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkerStatisticsContextSolution { workspaceSid: string; workerSid: string; } export declare class WorkerStatisticsContextImpl implements WorkerStatisticsContext { protected _version: V1; protected _solution: WorkerStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, workerSid: string); fetch(params?: WorkerStatisticsContextFetchOptions | ((error: Error | null, item?: WorkerStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkerStatisticsInstance) => any): Promise<WorkerStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkerStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkerStatisticsResource { account_sid: string; cumulative: any; worker_sid: string; workspace_sid: string; url: string; } export declare class WorkerStatisticsInstance { protected _version: V1; protected _solution: WorkerStatisticsContextSolution; protected _context?: WorkerStatisticsContext; constructor(_version: V1, payload: WorkerStatisticsResource, workspaceSid: string, workerSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. */ accountSid: string; /** * An object that contains the cumulative statistics for the Worker. */ cumulative: any; /** * The SID of the Worker that contains the WorkerChannel. */ workerSid: string; /** * The SID of the Workspace that contains the WorkerChannel. */ workspaceSid: string; /** * The absolute URL of the WorkerChannel statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkerStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkerStatisticsInstance) => any): Promise<WorkerStatisticsInstance>; /** * Fetch a WorkerStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerStatisticsInstance */ fetch(params: WorkerStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkerStatisticsInstance) => any): Promise<WorkerStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; cumulative: any; workerSid: string; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkerStatisticsSolution { workspaceSid: string; workerSid: string; } export interface WorkerStatisticsListInstance { _version: V1; _solution: WorkerStatisticsSolution; _uri: string; (): WorkerStatisticsContext; get(): WorkerStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkerStatisticsListInstance(version: V1, workspaceSid: string, workerSid: string): WorkerStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/worker/workersStatistics.d.ts000064400000013000151677225100020122 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a WorkersStatisticsInstance */ export interface WorkersStatisticsContextFetchOptions { /** Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** The SID of the TaskQueue for which to fetch Worker statistics. */ taskQueueSid?: string; /** The `friendly_name` of the TaskQueue for which to fetch Worker statistics. */ taskQueueName?: string; /** Only include Workers with `friendly_name` values that match this parameter. */ friendlyName?: string; /** Only calculate statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; } export interface WorkersStatisticsContext { /** * Fetch a WorkersStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkersStatisticsInstance) => any): Promise<WorkersStatisticsInstance>; /** * Fetch a WorkersStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersStatisticsInstance */ fetch(params: WorkersStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkersStatisticsInstance) => any): Promise<WorkersStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkersStatisticsContextSolution { workspaceSid: string; } export declare class WorkersStatisticsContextImpl implements WorkersStatisticsContext { protected _version: V1; protected _solution: WorkersStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string); fetch(params?: WorkersStatisticsContextFetchOptions | ((error: Error | null, item?: WorkersStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkersStatisticsInstance) => any): Promise<WorkersStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkersStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkersStatisticsResource { realtime: any; cumulative: any; account_sid: string; workspace_sid: string; url: string; } export declare class WorkersStatisticsInstance { protected _version: V1; protected _solution: WorkersStatisticsContextSolution; protected _context?: WorkersStatisticsContext; constructor(_version: V1, payload: WorkersStatisticsResource, workspaceSid: string); /** * An object that contains the real-time statistics for the Worker. */ realtime: any; /** * An object that contains the cumulative statistics for the Worker. */ cumulative: any; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. */ accountSid: string; /** * The SID of the Workspace that contains the Worker. */ workspaceSid: string; /** * The absolute URL of the Worker statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkersStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkersStatisticsInstance) => any): Promise<WorkersStatisticsInstance>; /** * Fetch a WorkersStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersStatisticsInstance */ fetch(params: WorkersStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkersStatisticsInstance) => any): Promise<WorkersStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { realtime: any; cumulative: any; accountSid: string; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkersStatisticsSolution { workspaceSid: string; } export interface WorkersStatisticsListInstance { _version: V1; _solution: WorkersStatisticsSolution; _uri: string; (): WorkersStatisticsContext; get(): WorkersStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkersStatisticsListInstance(version: V1, workspaceSid: string): WorkersStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/worker/workersRealTimeStatistics.d.ts000064400000011703151677225100021555 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a WorkersRealTimeStatisticsInstance */ export interface WorkersRealTimeStatisticsContextFetchOptions { /** Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; } export interface WorkersRealTimeStatisticsContext { /** * Fetch a WorkersRealTimeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersRealTimeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkersRealTimeStatisticsInstance) => any): Promise<WorkersRealTimeStatisticsInstance>; /** * Fetch a WorkersRealTimeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersRealTimeStatisticsInstance */ fetch(params: WorkersRealTimeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkersRealTimeStatisticsInstance) => any): Promise<WorkersRealTimeStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkersRealTimeStatisticsContextSolution { workspaceSid: string; } export declare class WorkersRealTimeStatisticsContextImpl implements WorkersRealTimeStatisticsContext { protected _version: V1; protected _solution: WorkersRealTimeStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string); fetch(params?: WorkersRealTimeStatisticsContextFetchOptions | ((error: Error | null, item?: WorkersRealTimeStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkersRealTimeStatisticsInstance) => any): Promise<WorkersRealTimeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkersRealTimeStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkersRealTimeStatisticsResource { account_sid: string; activity_statistics: Array<any>; total_workers: number; workspace_sid: string; url: string; } export declare class WorkersRealTimeStatisticsInstance { protected _version: V1; protected _solution: WorkersRealTimeStatisticsContextSolution; protected _context?: WorkersRealTimeStatisticsContext; constructor(_version: V1, payload: WorkersRealTimeStatisticsResource, workspaceSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. */ accountSid: string; /** * The number of current Workers by Activity. */ activityStatistics: Array<any>; /** * The total number of Workers. */ totalWorkers: number; /** * The SID of the Workspace that contains the Workers. */ workspaceSid: string; /** * The absolute URL of the Workers statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkersRealTimeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersRealTimeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkersRealTimeStatisticsInstance) => any): Promise<WorkersRealTimeStatisticsInstance>; /** * Fetch a WorkersRealTimeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersRealTimeStatisticsInstance */ fetch(params: WorkersRealTimeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkersRealTimeStatisticsInstance) => any): Promise<WorkersRealTimeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; activityStatistics: any[]; totalWorkers: number; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkersRealTimeStatisticsSolution { workspaceSid: string; } export interface WorkersRealTimeStatisticsListInstance { _version: V1; _solution: WorkersRealTimeStatisticsSolution; _uri: string; (): WorkersRealTimeStatisticsContext; get(): WorkersRealTimeStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkersRealTimeStatisticsListInstance(version: V1, workspaceSid: string): WorkersRealTimeStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/worker/reservation.js000064400000036572151677225100016503 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.ReservationPage = exports.ReservationListInstance = exports.ReservationInstance = exports.ReservationContextImpl = void 0; 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 ReservationContextImpl { constructor(_version, workspaceSid, workerSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workerSid)) { throw new Error("Parameter 'workerSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, workerSid, sid }; this._uri = `/Workspaces/${workspaceSid}/Workers/${workerSid}/Reservations/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ReservationInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.workerSid, 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["reservationStatus"] !== undefined) data["ReservationStatus"] = params["reservationStatus"]; if (params["workerActivitySid"] !== undefined) data["WorkerActivitySid"] = params["workerActivitySid"]; if (params["instruction"] !== undefined) data["Instruction"] = params["instruction"]; if (params["dequeuePostWorkActivitySid"] !== undefined) data["DequeuePostWorkActivitySid"] = params["dequeuePostWorkActivitySid"]; if (params["dequeueFrom"] !== undefined) data["DequeueFrom"] = params["dequeueFrom"]; if (params["dequeueRecord"] !== undefined) data["DequeueRecord"] = params["dequeueRecord"]; if (params["dequeueTimeout"] !== undefined) data["DequeueTimeout"] = params["dequeueTimeout"]; if (params["dequeueTo"] !== undefined) data["DequeueTo"] = params["dequeueTo"]; if (params["dequeueStatusCallbackUrl"] !== undefined) data["DequeueStatusCallbackUrl"] = params["dequeueStatusCallbackUrl"]; if (params["callFrom"] !== undefined) data["CallFrom"] = params["callFrom"]; if (params["callRecord"] !== undefined) data["CallRecord"] = params["callRecord"]; if (params["callTimeout"] !== undefined) data["CallTimeout"] = params["callTimeout"]; if (params["callTo"] !== undefined) data["CallTo"] = params["callTo"]; if (params["callUrl"] !== undefined) data["CallUrl"] = params["callUrl"]; if (params["callStatusCallbackUrl"] !== undefined) data["CallStatusCallbackUrl"] = params["callStatusCallbackUrl"]; if (params["callAccept"] !== undefined) data["CallAccept"] = serialize.bool(params["callAccept"]); if (params["redirectCallSid"] !== undefined) data["RedirectCallSid"] = params["redirectCallSid"]; if (params["redirectAccept"] !== undefined) data["RedirectAccept"] = serialize.bool(params["redirectAccept"]); if (params["redirectUrl"] !== undefined) data["RedirectUrl"] = params["redirectUrl"]; if (params["to"] !== undefined) data["To"] = params["to"]; if (params["from"] !== undefined) data["From"] = params["from"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["statusCallbackMethod"] !== undefined) data["StatusCallbackMethod"] = params["statusCallbackMethod"]; if (params["statusCallbackEvent"] !== undefined) data["StatusCallbackEvent"] = serialize.map(params["statusCallbackEvent"], (e) => e); if (params["timeout"] !== undefined) data["Timeout"] = params["timeout"]; if (params["record"] !== undefined) data["Record"] = serialize.bool(params["record"]); if (params["muted"] !== undefined) data["Muted"] = serialize.bool(params["muted"]); if (params["beep"] !== undefined) data["Beep"] = params["beep"]; if (params["startConferenceOnEnter"] !== undefined) data["StartConferenceOnEnter"] = serialize.bool(params["startConferenceOnEnter"]); if (params["endConferenceOnExit"] !== undefined) data["EndConferenceOnExit"] = serialize.bool(params["endConferenceOnExit"]); if (params["waitUrl"] !== undefined) data["WaitUrl"] = params["waitUrl"]; if (params["waitMethod"] !== undefined) data["WaitMethod"] = params["waitMethod"]; if (params["earlyMedia"] !== undefined) data["EarlyMedia"] = serialize.bool(params["earlyMedia"]); if (params["maxParticipants"] !== undefined) data["MaxParticipants"] = params["maxParticipants"]; if (params["conferenceStatusCallback"] !== undefined) data["ConferenceStatusCallback"] = params["conferenceStatusCallback"]; if (params["conferenceStatusCallbackMethod"] !== undefined) data["ConferenceStatusCallbackMethod"] = params["conferenceStatusCallbackMethod"]; if (params["conferenceStatusCallbackEvent"] !== undefined) data["ConferenceStatusCallbackEvent"] = serialize.map(params["conferenceStatusCallbackEvent"], (e) => e); if (params["conferenceRecord"] !== undefined) data["ConferenceRecord"] = params["conferenceRecord"]; if (params["conferenceTrim"] !== undefined) data["ConferenceTrim"] = params["conferenceTrim"]; if (params["recordingChannels"] !== undefined) data["RecordingChannels"] = params["recordingChannels"]; if (params["recordingStatusCallback"] !== undefined) data["RecordingStatusCallback"] = params["recordingStatusCallback"]; if (params["recordingStatusCallbackMethod"] !== undefined) data["RecordingStatusCallbackMethod"] = params["recordingStatusCallbackMethod"]; if (params["conferenceRecordingStatusCallback"] !== undefined) data["ConferenceRecordingStatusCallback"] = params["conferenceRecordingStatusCallback"]; if (params["conferenceRecordingStatusCallbackMethod"] !== undefined) data["ConferenceRecordingStatusCallbackMethod"] = params["conferenceRecordingStatusCallbackMethod"]; if (params["region"] !== undefined) data["Region"] = params["region"]; if (params["sipAuthUsername"] !== undefined) data["SipAuthUsername"] = params["sipAuthUsername"]; if (params["sipAuthPassword"] !== undefined) data["SipAuthPassword"] = params["sipAuthPassword"]; if (params["dequeueStatusCallbackEvent"] !== undefined) data["DequeueStatusCallbackEvent"] = serialize.map(params["dequeueStatusCallbackEvent"], (e) => e); if (params["postWorkActivitySid"] !== undefined) data["PostWorkActivitySid"] = params["postWorkActivitySid"]; if (params["endConferenceOnCustomerExit"] !== undefined) data["EndConferenceOnCustomerExit"] = serialize.bool(params["endConferenceOnCustomerExit"]); if (params["beepOnCustomerEntrance"] !== undefined) data["BeepOnCustomerEntrance"] = serialize.bool(params["beepOnCustomerEntrance"]); if (params["jitterBufferSize"] !== undefined) data["JitterBufferSize"] = params["jitterBufferSize"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ReservationInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.workerSid, 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.ReservationContextImpl = ReservationContextImpl; class ReservationInstance { constructor(_version, payload, workspaceSid, workerSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.reservationStatus = payload.reservation_status; this.sid = payload.sid; this.taskSid = payload.task_sid; this.workerName = payload.worker_name; this.workerSid = payload.worker_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this.links = payload.links; this._solution = { workspaceSid, workerSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ReservationContextImpl(this._version, this._solution.workspaceSid, this._solution.workerSid, this._solution.sid); return this._context; } /** * Fetch a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, reservationStatus: this.reservationStatus, sid: this.sid, taskSid: this.taskSid, workerName: this.workerName, workerSid: this.workerSid, workspaceSid: this.workspaceSid, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ReservationInstance = ReservationInstance; function ReservationListInstance(version, workspaceSid, workerSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workerSid)) { throw new Error("Parameter 'workerSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ReservationContextImpl(version, workspaceSid, workerSid, sid); }; instance._version = version; instance._solution = { workspaceSid, workerSid }; instance._uri = `/Workspaces/${workspaceSid}/Workers/${workerSid}/Reservations`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["reservationStatus"] !== undefined) data["ReservationStatus"] = params["reservationStatus"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ReservationPage(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 ReservationPage(instance._version, payload, 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; } exports.ReservationListInstance = ReservationListInstance; class ReservationPage extends Page_1.default { /** * Initialize the ReservationPage * * @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 ReservationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ReservationInstance(this._version, payload, this._solution.workspaceSid, this._solution.workerSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ReservationPage = ReservationPage; rest/taskrouter/v1/workspace/worker/workerStatistics.js000064400000012126151677225100017513 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkerStatisticsListInstance = exports.WorkerStatisticsInstance = exports.WorkerStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class WorkerStatisticsContextImpl { constructor(_version, workspaceSid, workerSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workerSid)) { throw new Error("Parameter 'workerSid' is not valid."); } this._solution = { workspaceSid, workerSid }; this._uri = `/Workspaces/${workspaceSid}/Workers/${workerSid}/Statistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkerStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.workerSid)); 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.WorkerStatisticsContextImpl = WorkerStatisticsContextImpl; class WorkerStatisticsInstance { constructor(_version, payload, workspaceSid, workerSid) { this._version = _version; this.accountSid = payload.account_sid; this.cumulative = payload.cumulative; this.workerSid = payload.worker_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid, workerSid }; } get _proxy() { this._context = this._context || new WorkerStatisticsContextImpl(this._version, this._solution.workspaceSid, this._solution.workerSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, cumulative: this.cumulative, workerSid: this.workerSid, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkerStatisticsInstance = WorkerStatisticsInstance; function WorkerStatisticsListInstance(version, workspaceSid, workerSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workerSid)) { throw new Error("Parameter 'workerSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkerStatisticsContextImpl(version, workspaceSid, workerSid); }; instance._version = version; instance._solution = { workspaceSid, workerSid }; 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; } exports.WorkerStatisticsListInstance = WorkerStatisticsListInstance; rest/taskrouter/v1/workspace/worker/workerChannel.d.ts000064400000030171151677225100017165 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to update a WorkerChannelInstance */ export interface WorkerChannelContextUpdateOptions { /** The total number of Tasks that the Worker should handle for the TaskChannel type. TaskRouter creates reservations for Tasks of this TaskChannel type up to the specified capacity. If the capacity is 0, no new reservations will be created. */ capacity?: number; /** Whether the WorkerChannel is available. Set to `false` to prevent the Worker from receiving any new Tasks of this TaskChannel type. */ available?: boolean; } /** * Options to pass to each */ export interface WorkerChannelListInstanceEachOptions { /** 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: WorkerChannelInstance, 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 WorkerChannelListInstanceOptions { /** 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 WorkerChannelListInstancePageOptions { /** 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 WorkerChannelContext { /** * Fetch a WorkerChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerChannelInstance */ fetch(callback?: (error: Error | null, item?: WorkerChannelInstance) => any): Promise<WorkerChannelInstance>; /** * Update a WorkerChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerChannelInstance */ update(callback?: (error: Error | null, item?: WorkerChannelInstance) => any): Promise<WorkerChannelInstance>; /** * Update a WorkerChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerChannelInstance */ update(params: WorkerChannelContextUpdateOptions, callback?: (error: Error | null, item?: WorkerChannelInstance) => any): Promise<WorkerChannelInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkerChannelContextSolution { workspaceSid: string; workerSid: string; sid: string; } export declare class WorkerChannelContextImpl implements WorkerChannelContext { protected _version: V1; protected _solution: WorkerChannelContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, workerSid: string, sid: string); fetch(callback?: (error: Error | null, item?: WorkerChannelInstance) => any): Promise<WorkerChannelInstance>; update(params?: WorkerChannelContextUpdateOptions | ((error: Error | null, item?: WorkerChannelInstance) => any), callback?: (error: Error | null, item?: WorkerChannelInstance) => any): Promise<WorkerChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkerChannelContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkerChannelPayload extends TwilioResponsePayload { channels: WorkerChannelResource[]; } interface WorkerChannelResource { account_sid: string; assigned_tasks: number; available: boolean; available_capacity_percentage: number; configured_capacity: number; date_created: Date; date_updated: Date; sid: string; task_channel_sid: string; task_channel_unique_name: string; worker_sid: string; workspace_sid: string; url: string; } export declare class WorkerChannelInstance { protected _version: V1; protected _solution: WorkerChannelContextSolution; protected _context?: WorkerChannelContext; constructor(_version: V1, payload: WorkerChannelResource, workspaceSid: string, workerSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. */ accountSid: string; /** * The total number of Tasks assigned to Worker for the TaskChannel type. */ assignedTasks: number; /** * Whether the Worker should receive Tasks of the TaskChannel type. */ available: boolean; /** * The current percentage of capacity the TaskChannel has available. Can be a number between `0` and `100`. A value of `0` indicates that TaskChannel has no capacity available and a value of `100` means the Worker is available to receive any Tasks of this TaskChannel type. */ availableCapacityPercentage: number; /** * The current configured capacity for the WorkerChannel. TaskRouter will not create any reservations after the assigned Tasks for the Worker reaches the value. */ configuredCapacity: number; /** * 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 unique string that we created to identify the WorkerChannel resource. */ sid: string; /** * The SID of the TaskChannel. */ taskChannelSid: string; /** * The unique name of the TaskChannel, such as `voice` or `sms`. */ taskChannelUniqueName: string; /** * The SID of the Worker that contains the WorkerChannel. */ workerSid: string; /** * The SID of the Workspace that contains the WorkerChannel. */ workspaceSid: string; /** * The absolute URL of the WorkerChannel resource. */ url: string; private get _proxy(); /** * Fetch a WorkerChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerChannelInstance */ fetch(callback?: (error: Error | null, item?: WorkerChannelInstance) => any): Promise<WorkerChannelInstance>; /** * Update a WorkerChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerChannelInstance */ update(callback?: (error: Error | null, item?: WorkerChannelInstance) => any): Promise<WorkerChannelInstance>; /** * Update a WorkerChannelInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerChannelInstance */ update(params: WorkerChannelContextUpdateOptions, callback?: (error: Error | null, item?: WorkerChannelInstance) => any): Promise<WorkerChannelInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; assignedTasks: number; available: boolean; availableCapacityPercentage: number; configuredCapacity: number; dateCreated: Date; dateUpdated: Date; sid: string; taskChannelSid: string; taskChannelUniqueName: string; workerSid: string; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkerChannelSolution { workspaceSid: string; workerSid: string; } export interface WorkerChannelListInstance { _version: V1; _solution: WorkerChannelSolution; _uri: string; (sid: string): WorkerChannelContext; get(sid: string): WorkerChannelContext; /** * Streams WorkerChannelInstance 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 { WorkerChannelListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WorkerChannelInstance, done: (err?: Error) => void) => void): void; each(params: WorkerChannelListInstanceEachOptions, callback?: (item: WorkerChannelInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WorkerChannelInstance 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: WorkerChannelPage) => any): Promise<WorkerChannelPage>; /** * Lists WorkerChannelInstance 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 { WorkerChannelListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WorkerChannelInstance[]) => any): Promise<WorkerChannelInstance[]>; list(params: WorkerChannelListInstanceOptions, callback?: (error: Error | null, items: WorkerChannelInstance[]) => any): Promise<WorkerChannelInstance[]>; /** * Retrieve a single page of WorkerChannelInstance 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 { WorkerChannelListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WorkerChannelPage) => any): Promise<WorkerChannelPage>; page(params: WorkerChannelListInstancePageOptions, callback?: (error: Error | null, items: WorkerChannelPage) => any): Promise<WorkerChannelPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkerChannelListInstance(version: V1, workspaceSid: string, workerSid: string): WorkerChannelListInstance; export declare class WorkerChannelPage extends Page<V1, WorkerChannelPayload, WorkerChannelResource, WorkerChannelInstance> { /** * Initialize the WorkerChannelPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: WorkerChannelSolution); /** * Build an instance of WorkerChannelInstance * * @param payload - Payload response from the API */ getInstance(payload: WorkerChannelResource): WorkerChannelInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/worker/reservation.d.ts000064400000047544151677225100016740 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type ReservationCallStatus = "initiated" | "ringing" | "answered" | "completed"; export type ReservationConferenceEvent = "start" | "end" | "join" | "leave" | "mute" | "hold" | "speaker"; export type ReservationStatus = "pending" | "accepted" | "rejected" | "timeout" | "canceled" | "rescinded" | "wrapping" | "completed"; /** * Options to pass to update a ReservationInstance */ export interface ReservationContextUpdateOptions { /** The If-Match HTTP request header */ ifMatch?: string; /** */ reservationStatus?: ReservationStatus; /** The new worker activity SID if rejecting a reservation. */ workerActivitySid?: string; /** The assignment instruction for the reservation. */ instruction?: string; /** The SID of the Activity resource to start after executing a Dequeue instruction. */ dequeuePostWorkActivitySid?: string; /** The caller ID of the call to the worker when executing a Dequeue instruction. */ dequeueFrom?: string; /** Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. */ dequeueRecord?: string; /** The timeout for call when executing a Dequeue instruction. */ dequeueTimeout?: number; /** The contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. */ dequeueTo?: string; /** The callback URL for completed call event when executing a Dequeue instruction. */ dequeueStatusCallbackUrl?: string; /** The Caller ID of the outbound call when executing a Call instruction. */ callFrom?: string; /** Whether to record both legs of a call when executing a Call instruction. */ callRecord?: string; /** The timeout for a call when executing a Call instruction. */ callTimeout?: number; /** The contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. */ callTo?: string; /** TwiML URI executed on answering the worker\\\'s leg as a result of the Call instruction. */ callUrl?: string; /** The URL to call for the completed call event when executing a Call instruction. */ callStatusCallbackUrl?: string; /** Whether to accept a reservation when executing a Call instruction. */ callAccept?: boolean; /** The Call SID of the call parked in the queue when executing a Redirect instruction. */ redirectCallSid?: string; /** Whether the reservation should be accepted when executing a Redirect instruction. */ redirectAccept?: boolean; /** TwiML URI to redirect the call to when executing the Redirect instruction. */ redirectUrl?: string; /** The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. */ to?: string; /** The caller ID of the call to the worker when executing a Conference instruction. */ from?: string; /** The URL we should call using the `status_callback_method` to send status information to your application. */ statusCallback?: string; /** The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. */ statusCallbackMethod?: string; /** The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. */ statusCallbackEvent?: Array<ReservationCallStatus>; /** The timeout for a call when executing a Conference instruction. */ timeout?: number; /** Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`. */ record?: boolean; /** Whether the agent is muted in the conference. Defaults to `false`. */ muted?: boolean; /** Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. */ beep?: string; /** Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. */ startConferenceOnEnter?: boolean; /** Whether to end the conference when the agent leaves. */ endConferenceOnExit?: boolean; /** The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). */ waitUrl?: string; /** The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. */ waitMethod?: string; /** Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. */ earlyMedia?: boolean; /** The maximum number of participants allowed in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. */ maxParticipants?: number; /** The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. */ conferenceStatusCallback?: string; /** The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ conferenceStatusCallbackMethod?: string; /** The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. */ conferenceStatusCallbackEvent?: Array<ReservationConferenceEvent>; /** Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. */ conferenceRecord?: string; /** Whether to trim leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. */ conferenceTrim?: string; /** The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. */ recordingChannels?: string; /** The URL that we should call using the `recording_status_callback_method` when the recording status changes. */ recordingStatusCallback?: string; /** The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ recordingStatusCallbackMethod?: string; /** The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. */ conferenceRecordingStatusCallback?: string; /** The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. */ conferenceRecordingStatusCallbackMethod?: string; /** The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. */ region?: string; /** The SIP username used for authentication. */ sipAuthUsername?: string; /** The SIP password for authentication. */ sipAuthPassword?: string; /** The call progress events sent via webhooks as a result of a Dequeue instruction. */ dequeueStatusCallbackEvent?: Array<string>; /** The new worker activity SID after executing a Conference instruction. */ postWorkActivitySid?: string; /** Whether to end the conference when the customer leaves. */ endConferenceOnCustomerExit?: boolean; /** Whether to play a notification beep when the customer joins. */ beepOnCustomerEntrance?: boolean; /** The jitter buffer size for conference. Can be: `small`, `medium`, `large`, `off`. */ jitterBufferSize?: string; } /** * Options to pass to each */ export interface ReservationListInstanceEachOptions { /** Returns the list of reservations for a worker with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`. */ reservationStatus?: ReservationStatus; /** 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: ReservationInstance, 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 ReservationListInstanceOptions { /** Returns the list of reservations for a worker with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`. */ reservationStatus?: ReservationStatus; /** 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 ReservationListInstancePageOptions { /** Returns the list of reservations for a worker with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`. */ reservationStatus?: ReservationStatus; /** 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 ReservationContext { /** * Fetch a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ fetch(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Update a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ update(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Update a ReservationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ update(params: ReservationContextUpdateOptions, callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ReservationContextSolution { workspaceSid: string; workerSid: string; sid: string; } export declare class ReservationContextImpl implements ReservationContext { protected _version: V1; protected _solution: ReservationContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string, workerSid: string, sid: string); fetch(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; update(params?: ReservationContextUpdateOptions | ((error: Error | null, item?: ReservationInstance) => any), callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ReservationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ReservationPayload extends TwilioResponsePayload { reservations: ReservationResource[]; } interface ReservationResource { account_sid: string; date_created: Date; date_updated: Date; reservation_status: ReservationStatus; sid: string; task_sid: string; worker_name: string; worker_sid: string; workspace_sid: string; url: string; links: Record<string, string>; } export declare class ReservationInstance { protected _version: V1; protected _solution: ReservationContextSolution; protected _context?: ReservationContext; constructor(_version: V1, payload: ReservationResource, workspaceSid: string, workerSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WorkerReservation resource. */ accountSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; reservationStatus: ReservationStatus; /** * The unique string that we created to identify the WorkerReservation resource. */ sid: string; /** * The SID of the reserved Task resource. */ taskSid: string; /** * The `friendly_name` of the Worker that is reserved. */ workerName: string; /** * The SID of the reserved Worker resource. */ workerSid: string; /** * The SID of the Workspace that this worker is contained within. */ workspaceSid: string; /** * The absolute URL of the WorkerReservation resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Fetch a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ fetch(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Update a ReservationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ update(callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Update a ReservationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ReservationInstance */ update(params: ReservationContextUpdateOptions, callback?: (error: Error | null, item?: ReservationInstance) => any): Promise<ReservationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; dateCreated: Date; dateUpdated: Date; reservationStatus: ReservationStatus; sid: string; taskSid: string; workerName: string; workerSid: string; workspaceSid: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ReservationSolution { workspaceSid: string; workerSid: string; } export interface ReservationListInstance { _version: V1; _solution: ReservationSolution; _uri: string; (sid: string): ReservationContext; get(sid: string): ReservationContext; /** * Streams ReservationInstance 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 { ReservationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ReservationInstance, done: (err?: Error) => void) => void): void; each(params: ReservationListInstanceEachOptions, callback?: (item: ReservationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ReservationInstance 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: ReservationPage) => any): Promise<ReservationPage>; /** * Lists ReservationInstance 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 { ReservationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ReservationInstance[]) => any): Promise<ReservationInstance[]>; list(params: ReservationListInstanceOptions, callback?: (error: Error | null, items: ReservationInstance[]) => any): Promise<ReservationInstance[]>; /** * Retrieve a single page of ReservationInstance 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 { ReservationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ReservationPage) => any): Promise<ReservationPage>; page(params: ReservationListInstancePageOptions, callback?: (error: Error | null, items: ReservationPage) => any): Promise<ReservationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ReservationListInstance(version: V1, workspaceSid: string, workerSid: string): ReservationListInstance; export declare class ReservationPage extends Page<V1, ReservationPayload, ReservationResource, ReservationInstance> { /** * Initialize the ReservationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ReservationSolution); /** * Build an instance of ReservationInstance * * @param payload - Payload response from the API */ getInstance(payload: ReservationResource): ReservationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/taskrouter/v1/workspace/worker/workersRealTimeStatistics.js000064400000011071151677225100021317 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkersRealTimeStatisticsListInstance = exports.WorkersRealTimeStatisticsInstance = exports.WorkersRealTimeStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class WorkersRealTimeStatisticsContextImpl { constructor(_version, workspaceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } this._solution = { workspaceSid }; this._uri = `/Workspaces/${workspaceSid}/Workers/RealTimeStatistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkersRealTimeStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid)); 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.WorkersRealTimeStatisticsContextImpl = WorkersRealTimeStatisticsContextImpl; class WorkersRealTimeStatisticsInstance { constructor(_version, payload, workspaceSid) { this._version = _version; this.accountSid = payload.account_sid; this.activityStatistics = payload.activity_statistics; this.totalWorkers = deserialize.integer(payload.total_workers); this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid }; } get _proxy() { this._context = this._context || new WorkersRealTimeStatisticsContextImpl(this._version, this._solution.workspaceSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, activityStatistics: this.activityStatistics, totalWorkers: this.totalWorkers, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkersRealTimeStatisticsInstance = WorkersRealTimeStatisticsInstance; function WorkersRealTimeStatisticsListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkersRealTimeStatisticsContextImpl(version, workspaceSid); }; instance._version = version; instance._solution = { workspaceSid }; 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; } exports.WorkersRealTimeStatisticsListInstance = WorkersRealTimeStatisticsListInstance; rest/taskrouter/v1/workspace/worker/workersStatistics.js000064400000012022151677225100017671 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkersStatisticsListInstance = exports.WorkersStatisticsInstance = exports.WorkersStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class WorkersStatisticsContextImpl { constructor(_version, workspaceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } this._solution = { workspaceSid }; this._uri = `/Workspaces/${workspaceSid}/Workers/Statistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["taskQueueSid"] !== undefined) data["TaskQueueSid"] = params["taskQueueSid"]; if (params["taskQueueName"] !== undefined) data["TaskQueueName"] = params["taskQueueName"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkersStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid)); 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.WorkersStatisticsContextImpl = WorkersStatisticsContextImpl; class WorkersStatisticsInstance { constructor(_version, payload, workspaceSid) { this._version = _version; this.realtime = payload.realtime; this.cumulative = payload.cumulative; this.accountSid = payload.account_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid }; } get _proxy() { this._context = this._context || new WorkersStatisticsContextImpl(this._version, this._solution.workspaceSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { realtime: this.realtime, cumulative: this.cumulative, accountSid: this.accountSid, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkersStatisticsInstance = WorkersStatisticsInstance; function WorkersStatisticsListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkersStatisticsContextImpl(version, workspaceSid); }; instance._version = version; instance._solution = { workspaceSid }; 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; } exports.WorkersStatisticsListInstance = WorkersStatisticsListInstance; rest/taskrouter/v1/workspace/worker/workersCumulativeStatistics.d.ts000064400000016026151677225100022174 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; /** * Options to pass to fetch a WorkersCumulativeStatisticsInstance */ export interface WorkersCumulativeStatisticsContextFetchOptions { /** Only calculate statistics from this date and time and earlier, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ endDate?: Date; /** Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; } export interface WorkersCumulativeStatisticsContext { /** * Fetch a WorkersCumulativeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersCumulativeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkersCumulativeStatisticsInstance) => any): Promise<WorkersCumulativeStatisticsInstance>; /** * Fetch a WorkersCumulativeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersCumulativeStatisticsInstance */ fetch(params: WorkersCumulativeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkersCumulativeStatisticsInstance) => any): Promise<WorkersCumulativeStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkersCumulativeStatisticsContextSolution { workspaceSid: string; } export declare class WorkersCumulativeStatisticsContextImpl implements WorkersCumulativeStatisticsContext { protected _version: V1; protected _solution: WorkersCumulativeStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string); fetch(params?: WorkersCumulativeStatisticsContextFetchOptions | ((error: Error | null, item?: WorkersCumulativeStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkersCumulativeStatisticsInstance) => any): Promise<WorkersCumulativeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkersCumulativeStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkersCumulativeStatisticsResource { account_sid: string; start_time: Date; end_time: Date; activity_durations: Array<any>; reservations_created: number; reservations_accepted: number; reservations_rejected: number; reservations_timed_out: number; reservations_canceled: number; reservations_rescinded: number; workspace_sid: string; url: string; } export declare class WorkersCumulativeStatisticsInstance { protected _version: V1; protected _solution: WorkersCumulativeStatisticsContextSolution; protected _context?: WorkersCumulativeStatisticsContext; constructor(_version: V1, payload: WorkersCumulativeStatisticsResource, workspaceSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. */ accountSid: string; /** * The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startTime: Date; /** * The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ endTime: Date; /** * The minimum, average, maximum, and total time (in seconds) that Workers spent in each Activity. */ activityDurations: Array<any>; /** * The total number of Reservations that were created. */ reservationsCreated: number; /** * The total number of Reservations that were accepted. */ reservationsAccepted: number; /** * The total number of Reservations that were rejected. */ reservationsRejected: number; /** * The total number of Reservations that were timed out. */ reservationsTimedOut: number; /** * The total number of Reservations that were canceled. */ reservationsCanceled: number; /** * The total number of Reservations that were rescinded. */ reservationsRescinded: number; /** * The SID of the Workspace that contains the Workers. */ workspaceSid: string; /** * The absolute URL of the Workers statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkersCumulativeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersCumulativeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkersCumulativeStatisticsInstance) => any): Promise<WorkersCumulativeStatisticsInstance>; /** * Fetch a WorkersCumulativeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkersCumulativeStatisticsInstance */ fetch(params: WorkersCumulativeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkersCumulativeStatisticsInstance) => any): Promise<WorkersCumulativeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; startTime: Date; endTime: Date; activityDurations: any[]; reservationsCreated: number; reservationsAccepted: number; reservationsRejected: number; reservationsTimedOut: number; reservationsCanceled: number; reservationsRescinded: number; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkersCumulativeStatisticsSolution { workspaceSid: string; } export interface WorkersCumulativeStatisticsListInstance { _version: V1; _solution: WorkersCumulativeStatisticsSolution; _uri: string; (): WorkersCumulativeStatisticsContext; get(): WorkersCumulativeStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkersCumulativeStatisticsListInstance(version: V1, workspaceSid: string): WorkersCumulativeStatisticsListInstance; export {}; rest/taskrouter/v1/workspace/worker/workersCumulativeStatistics.js000064400000013617151677225100021743 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkersCumulativeStatisticsListInstance = exports.WorkersCumulativeStatisticsInstance = exports.WorkersCumulativeStatisticsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class WorkersCumulativeStatisticsContextImpl { constructor(_version, workspaceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } this._solution = { workspaceSid }; this._uri = `/Workspaces/${workspaceSid}/Workers/CumulativeStatistics`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); if (params["minutes"] !== undefined) data["Minutes"] = params["minutes"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["taskChannel"] !== undefined) data["TaskChannel"] = params["taskChannel"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkersCumulativeStatisticsInstance(operationVersion, payload, instance._solution.workspaceSid)); 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.WorkersCumulativeStatisticsContextImpl = WorkersCumulativeStatisticsContextImpl; class WorkersCumulativeStatisticsInstance { constructor(_version, payload, workspaceSid) { this._version = _version; this.accountSid = payload.account_sid; this.startTime = deserialize.iso8601DateTime(payload.start_time); this.endTime = deserialize.iso8601DateTime(payload.end_time); this.activityDurations = payload.activity_durations; this.reservationsCreated = deserialize.integer(payload.reservations_created); this.reservationsAccepted = deserialize.integer(payload.reservations_accepted); this.reservationsRejected = deserialize.integer(payload.reservations_rejected); this.reservationsTimedOut = deserialize.integer(payload.reservations_timed_out); this.reservationsCanceled = deserialize.integer(payload.reservations_canceled); this.reservationsRescinded = deserialize.integer(payload.reservations_rescinded); this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid }; } get _proxy() { this._context = this._context || new WorkersCumulativeStatisticsContextImpl(this._version, this._solution.workspaceSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, startTime: this.startTime, endTime: this.endTime, activityDurations: this.activityDurations, reservationsCreated: this.reservationsCreated, reservationsAccepted: this.reservationsAccepted, reservationsRejected: this.reservationsRejected, reservationsTimedOut: this.reservationsTimedOut, reservationsCanceled: this.reservationsCanceled, reservationsRescinded: this.reservationsRescinded, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkersCumulativeStatisticsInstance = WorkersCumulativeStatisticsInstance; function WorkersCumulativeStatisticsListInstance(version, workspaceSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new WorkersCumulativeStatisticsContextImpl(version, workspaceSid); }; instance._version = version; instance._solution = { workspaceSid }; 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; } exports.WorkersCumulativeStatisticsListInstance = WorkersCumulativeStatisticsListInstance; rest/taskrouter/v1/workspace/worker/workerChannel.js000064400000022666151677225100016743 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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.WorkerChannelPage = exports.WorkerChannelListInstance = exports.WorkerChannelInstance = exports.WorkerChannelContextImpl = void 0; 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 WorkerChannelContextImpl { constructor(_version, workspaceSid, workerSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workerSid)) { throw new Error("Parameter 'workerSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { workspaceSid, workerSid, sid }; this._uri = `/Workspaces/${workspaceSid}/Workers/${workerSid}/Channels/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WorkerChannelInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.workerSid, 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["capacity"] !== undefined) data["Capacity"] = params["capacity"]; if (params["available"] !== undefined) data["Available"] = serialize.bool(params["available"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WorkerChannelInstance(operationVersion, payload, instance._solution.workspaceSid, instance._solution.workerSid, 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.WorkerChannelContextImpl = WorkerChannelContextImpl; class WorkerChannelInstance { constructor(_version, payload, workspaceSid, workerSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.assignedTasks = deserialize.integer(payload.assigned_tasks); this.available = payload.available; this.availableCapacityPercentage = deserialize.integer(payload.available_capacity_percentage); this.configuredCapacity = deserialize.integer(payload.configured_capacity); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sid = payload.sid; this.taskChannelSid = payload.task_channel_sid; this.taskChannelUniqueName = payload.task_channel_unique_name; this.workerSid = payload.worker_sid; this.workspaceSid = payload.workspace_sid; this.url = payload.url; this._solution = { workspaceSid, workerSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WorkerChannelContextImpl(this._version, this._solution.workspaceSid, this._solution.workerSid, this._solution.sid); return this._context; } /** * Fetch a WorkerChannelInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkerChannelInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, assignedTasks: this.assignedTasks, available: this.available, availableCapacityPercentage: this.availableCapacityPercentage, configuredCapacity: this.configuredCapacity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sid: this.sid, taskChannelSid: this.taskChannelSid, taskChannelUniqueName: this.taskChannelUniqueName, workerSid: this.workerSid, workspaceSid: this.workspaceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkerChannelInstance = WorkerChannelInstance; function WorkerChannelListInstance(version, workspaceSid, workerSid) { if (!(0, utility_1.isValidPathParam)(workspaceSid)) { throw new Error("Parameter 'workspaceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(workerSid)) { throw new Error("Parameter 'workerSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WorkerChannelContextImpl(version, workspaceSid, workerSid, sid); }; instance._version = version; instance._solution = { workspaceSid, workerSid }; instance._uri = `/Workspaces/${workspaceSid}/Workers/${workerSid}/Channels`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WorkerChannelPage(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 WorkerChannelPage(instance._version, payload, 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; } exports.WorkerChannelListInstance = WorkerChannelListInstance; class WorkerChannelPage extends Page_1.default { /** * Initialize the WorkerChannelPage * * @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 WorkerChannelInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WorkerChannelInstance(this._version, payload, this._solution.workspaceSid, this._solution.workerSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WorkerChannelPage = WorkerChannelPage; rest/taskrouter/v1/workspace/workspaceCumulativeStatistics.d.ts000064400000022516151677225100021166 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; /** * Options to pass to fetch a WorkspaceCumulativeStatisticsInstance */ export interface WorkspaceCumulativeStatisticsContextFetchOptions { /** Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. */ endDate?: Date; /** Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. */ minutes?: number; /** Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startDate?: Date; /** Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel\'s SID or its `unique_name`, such as `voice`, `sms`, or `default`. */ taskChannel?: string; /** A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. TaskRouter will calculate statistics on up to 10,000 Tasks for any given threshold. */ splitByWaitTime?: string; } export interface WorkspaceCumulativeStatisticsContext { /** * Fetch a WorkspaceCumulativeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceCumulativeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkspaceCumulativeStatisticsInstance) => any): Promise<WorkspaceCumulativeStatisticsInstance>; /** * Fetch a WorkspaceCumulativeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceCumulativeStatisticsInstance */ fetch(params: WorkspaceCumulativeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkspaceCumulativeStatisticsInstance) => any): Promise<WorkspaceCumulativeStatisticsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WorkspaceCumulativeStatisticsContextSolution { workspaceSid: string; } export declare class WorkspaceCumulativeStatisticsContextImpl implements WorkspaceCumulativeStatisticsContext { protected _version: V1; protected _solution: WorkspaceCumulativeStatisticsContextSolution; protected _uri: string; constructor(_version: V1, workspaceSid: string); fetch(params?: WorkspaceCumulativeStatisticsContextFetchOptions | ((error: Error | null, item?: WorkspaceCumulativeStatisticsInstance) => any), callback?: (error: Error | null, item?: WorkspaceCumulativeStatisticsInstance) => any): Promise<WorkspaceCumulativeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WorkspaceCumulativeStatisticsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WorkspaceCumulativeStatisticsResource { account_sid: string; avg_task_acceptance_time: number; start_time: Date; end_time: Date; reservations_created: number; reservations_accepted: number; reservations_rejected: number; reservations_timed_out: number; reservations_canceled: number; reservations_rescinded: number; split_by_wait_time: any; wait_duration_until_accepted: any; wait_duration_until_canceled: any; tasks_canceled: number; tasks_completed: number; tasks_created: number; tasks_deleted: number; tasks_moved: number; tasks_timed_out_in_workflow: number; workspace_sid: string; url: string; } export declare class WorkspaceCumulativeStatisticsInstance { protected _version: V1; protected _solution: WorkspaceCumulativeStatisticsContextSolution; protected _context?: WorkspaceCumulativeStatisticsContext; constructor(_version: V1, payload: WorkspaceCumulativeStatisticsResource, workspaceSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. */ accountSid: string; /** * The average time in seconds between Task creation and acceptance. */ avgTaskAcceptanceTime: number; /** * The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ startTime: Date; /** * The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ endTime: Date; /** * The total number of Reservations that were created for Workers. */ reservationsCreated: number; /** * The total number of Reservations accepted by Workers. */ reservationsAccepted: number; /** * The total number of Reservations that were rejected. */ reservationsRejected: number; /** * The total number of Reservations that were timed out. */ reservationsTimedOut: number; /** * The total number of Reservations that were canceled. */ reservationsCanceled: number; /** * The total number of Reservations that were rescinded. */ reservationsRescinded: number; /** * A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. */ splitByWaitTime: any; /** * The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. */ waitDurationUntilAccepted: any; /** * The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. */ waitDurationUntilCanceled: any; /** * The total number of Tasks that were canceled. */ tasksCanceled: number; /** * The total number of Tasks that were completed. */ tasksCompleted: number; /** * The total number of Tasks created. */ tasksCreated: number; /** * The total number of Tasks that were deleted. */ tasksDeleted: number; /** * The total number of Tasks that were moved from one queue to another. */ tasksMoved: number; /** * The total number of Tasks that were timed out of their Workflows (and deleted). */ tasksTimedOutInWorkflow: number; /** * The SID of the Workspace. */ workspaceSid: string; /** * The absolute URL of the Workspace statistics resource. */ url: string; private get _proxy(); /** * Fetch a WorkspaceCumulativeStatisticsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceCumulativeStatisticsInstance */ fetch(callback?: (error: Error | null, item?: WorkspaceCumulativeStatisticsInstance) => any): Promise<WorkspaceCumulativeStatisticsInstance>; /** * Fetch a WorkspaceCumulativeStatisticsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WorkspaceCumulativeStatisticsInstance */ fetch(params: WorkspaceCumulativeStatisticsContextFetchOptions, callback?: (error: Error | null, item?: WorkspaceCumulativeStatisticsInstance) => any): Promise<WorkspaceCumulativeStatisticsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; avgTaskAcceptanceTime: number; startTime: Date; endTime: Date; reservationsCreated: number; reservationsAccepted: number; reservationsRejected: number; reservationsTimedOut: number; reservationsCanceled: number; reservationsRescinded: number; splitByWaitTime: any; waitDurationUntilAccepted: any; waitDurationUntilCanceled: any; tasksCanceled: number; tasksCompleted: number; tasksCreated: number; tasksDeleted: number; tasksMoved: number; tasksTimedOutInWorkflow: number; workspaceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WorkspaceCumulativeStatisticsSolution { workspaceSid: string; } export interface WorkspaceCumulativeStatisticsListInstance { _version: V1; _solution: WorkspaceCumulativeStatisticsSolution; _uri: string; (): WorkspaceCumulativeStatisticsContext; get(): WorkspaceCumulativeStatisticsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WorkspaceCumulativeStatisticsListInstance(version: V1, workspaceSid: string): WorkspaceCumulativeStatisticsListInstance; export {}; rest/taskrouter/V1.js000064400000002374151677225100010564 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Taskrouter * 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 workspace_1 = require("./v1/workspace"); class V1 extends Version_1.default { /** * Initialize the V1 version of Taskrouter * * @param domain - The Twilio (Twilio.Taskrouter) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for workspaces resource */ get workspaces() { this._workspaces = this._workspaces || (0, workspace_1.WorkspaceListInstance)(this); return this._workspaces; } } exports.default = V1; rest/Voice.js000064400000003140151677225100007130 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const VoiceBase_1 = __importDefault(require("./VoiceBase")); class Voice extends VoiceBase_1.default { /** * @deprecated - Use v1.archivedCalls instead */ get archivedCalls() { console.warn("archivedCalls is deprecated. Use v1.archivedCalls instead."); return this.v1.archivedCalls; } /** * @deprecated - Use v1.byocTrunks instead */ get byocTrunks() { console.warn("byocTrunks is deprecated. Use v1.byocTrunks instead."); return this.v1.byocTrunks; } /** * @deprecated - Use v1.connectionPolicies instead */ get connectionPolicies() { console.warn("connectionPolicies is deprecated. Use v1.connectionPolicies instead."); return this.v1.connectionPolicies; } /** * @deprecated - Use v1.dialingPermissions instead */ get dialingPermissions() { console.warn("dialingPermissions is deprecated. Use v1.dialingPermissions instead."); return this.v1.dialingPermissions; } /** * @deprecated - Use v1.ipRecords instead */ get ipRecords() { console.warn("ipRecords is deprecated. Use v1.ipRecords instead."); return this.v1.ipRecords; } /** * @deprecated - Use v1.sourceIpMappings instead */ get sourceIpMappings() { console.warn("sourceIpMappings is deprecated. Use v1.sourceIpMappings instead."); return this.v1.sourceIpMappings; } } module.exports = Voice; rest/trunking/V1.d.ts000064400000001024151677225100010445 0ustar00import TrunkingBase from "../TrunkingBase"; import Version from "../../base/Version"; import { TrunkListInstance } from "./v1/trunk"; export default class V1 extends Version { /** * Initialize the V1 version of Trunking * * @param domain - The Twilio (Twilio.Trunking) domain */ constructor(domain: TrunkingBase); /** trunks - { Twilio.Trunking.V1.TrunkListInstance } resource */ protected _trunks?: TrunkListInstance; /** Getter for trunks resource */ get trunks(): TrunkListInstance; } rest/trunking/v1/trunk.js000064400000032707151677225100011430 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trunking * 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.TrunkPage = exports.TrunkListInstance = exports.TrunkInstance = exports.TrunkContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const credentialList_1 = require("./trunk/credentialList"); const ipAccessControlList_1 = require("./trunk/ipAccessControlList"); const originationUrl_1 = require("./trunk/originationUrl"); const phoneNumber_1 = require("./trunk/phoneNumber"); const recording_1 = require("./trunk/recording"); class TrunkContextImpl { 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 = `/Trunks/${sid}`; } get credentialsLists() { this._credentialsLists = this._credentialsLists || (0, credentialList_1.CredentialListListInstance)(this._version, this._solution.sid); return this._credentialsLists; } get ipAccessControlLists() { this._ipAccessControlLists = this._ipAccessControlLists || (0, ipAccessControlList_1.IpAccessControlListListInstance)(this._version, this._solution.sid); return this._ipAccessControlLists; } get originationUrls() { this._originationUrls = this._originationUrls || (0, originationUrl_1.OriginationUrlListInstance)(this._version, this._solution.sid); return this._originationUrls; } get phoneNumbers() { this._phoneNumbers = this._phoneNumbers || (0, phoneNumber_1.PhoneNumberListInstance)(this._version, this._solution.sid); return this._phoneNumbers; } get recordings() { this._recordings = this._recordings || (0, recording_1.RecordingListInstance)(this._version, this._solution.sid); return this._recordings; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TrunkInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["domainName"] !== undefined) data["DomainName"] = params["domainName"]; if (params["disasterRecoveryUrl"] !== undefined) data["DisasterRecoveryUrl"] = params["disasterRecoveryUrl"]; if (params["disasterRecoveryMethod"] !== undefined) data["DisasterRecoveryMethod"] = params["disasterRecoveryMethod"]; if (params["transferMode"] !== undefined) data["TransferMode"] = params["transferMode"]; if (params["secure"] !== undefined) data["Secure"] = serialize.bool(params["secure"]); if (params["cnamLookupEnabled"] !== undefined) data["CnamLookupEnabled"] = serialize.bool(params["cnamLookupEnabled"]); if (params["transferCallerId"] !== undefined) data["TransferCallerId"] = params["transferCallerId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TrunkInstance(operationVersion, payload, 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.TrunkContextImpl = TrunkContextImpl; class TrunkInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.domainName = payload.domain_name; this.disasterRecoveryMethod = payload.disaster_recovery_method; this.disasterRecoveryUrl = payload.disaster_recovery_url; this.friendlyName = payload.friendly_name; this.secure = payload.secure; this.recording = payload.recording; this.transferMode = payload.transfer_mode; this.transferCallerId = payload.transfer_caller_id; this.cnamLookupEnabled = payload.cnam_lookup_enabled; this.authType = payload.auth_type; this.authTypeSet = payload.auth_type_set; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sid = payload.sid; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TrunkContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the credentialsLists. */ credentialsLists() { return this._proxy.credentialsLists; } /** * Access the ipAccessControlLists. */ ipAccessControlLists() { return this._proxy.ipAccessControlLists; } /** * Access the originationUrls. */ originationUrls() { return this._proxy.originationUrls; } /** * Access the phoneNumbers. */ phoneNumbers() { return this._proxy.phoneNumbers; } /** * Access the recordings. */ recordings() { return this._proxy.recordings; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, domainName: this.domainName, disasterRecoveryMethod: this.disasterRecoveryMethod, disasterRecoveryUrl: this.disasterRecoveryUrl, friendlyName: this.friendlyName, secure: this.secure, recording: this.recording, transferMode: this.transferMode, transferCallerId: this.transferCallerId, cnamLookupEnabled: this.cnamLookupEnabled, authType: this.authType, authTypeSet: this.authTypeSet, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sid: this.sid, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrunkInstance = TrunkInstance; function TrunkListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TrunkContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Trunks`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["domainName"] !== undefined) data["DomainName"] = params["domainName"]; if (params["disasterRecoveryUrl"] !== undefined) data["DisasterRecoveryUrl"] = params["disasterRecoveryUrl"]; if (params["disasterRecoveryMethod"] !== undefined) data["DisasterRecoveryMethod"] = params["disasterRecoveryMethod"]; if (params["transferMode"] !== undefined) data["TransferMode"] = params["transferMode"]; if (params["secure"] !== undefined) data["Secure"] = serialize.bool(params["secure"]); if (params["cnamLookupEnabled"] !== undefined) data["CnamLookupEnabled"] = serialize.bool(params["cnamLookupEnabled"]); if (params["transferCallerId"] !== undefined) data["TransferCallerId"] = params["transferCallerId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TrunkInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TrunkPage(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 TrunkPage(instance._version, payload, 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; } exports.TrunkListInstance = TrunkListInstance; class TrunkPage extends Page_1.default { /** * Initialize the TrunkPage * * @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 TrunkInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TrunkInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrunkPage = TrunkPage; rest/trunking/v1/trunk.d.ts000064400000046004151677225100011657 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { CredentialListListInstance } from "./trunk/credentialList"; import { IpAccessControlListListInstance } from "./trunk/ipAccessControlList"; import { OriginationUrlListInstance } from "./trunk/originationUrl"; import { PhoneNumberListInstance } from "./trunk/phoneNumber"; import { RecordingListInstance } from "./trunk/recording"; export type TrunkTransferCallerId = "from-transferee" | "from-transferor"; export type TrunkTransferSetting = "disable-all" | "enable-all" | "sip-only"; /** * Options to pass to update a TrunkInstance */ export interface TrunkContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. */ domainName?: string; /** The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. */ disasterRecoveryUrl?: string; /** The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. */ disasterRecoveryMethod?: string; /** */ transferMode?: TrunkTransferSetting; /** Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. */ secure?: boolean; /** Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. */ cnamLookupEnabled?: boolean; /** */ transferCallerId?: TrunkTransferCallerId; } /** * Options to pass to create a TrunkInstance */ export interface TrunkListInstanceCreateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. */ domainName?: string; /** The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. */ disasterRecoveryUrl?: string; /** The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. */ disasterRecoveryMethod?: string; /** */ transferMode?: TrunkTransferSetting; /** Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. */ secure?: boolean; /** Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. */ cnamLookupEnabled?: boolean; /** */ transferCallerId?: TrunkTransferCallerId; } /** * Options to pass to each */ export interface TrunkListInstanceEachOptions { /** 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: TrunkInstance, 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 TrunkListInstanceOptions { /** 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 TrunkListInstancePageOptions { /** 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 TrunkContext { credentialsLists: CredentialListListInstance; ipAccessControlLists: IpAccessControlListListInstance; originationUrls: OriginationUrlListInstance; phoneNumbers: PhoneNumberListInstance; recordings: RecordingListInstance; /** * Remove a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ fetch(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Update a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ update(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Update a TrunkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ update(params: TrunkContextUpdateOptions, callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TrunkContextSolution { sid: string; } export declare class TrunkContextImpl implements TrunkContext { protected _version: V1; protected _solution: TrunkContextSolution; protected _uri: string; protected _credentialsLists?: CredentialListListInstance; protected _ipAccessControlLists?: IpAccessControlListListInstance; protected _originationUrls?: OriginationUrlListInstance; protected _phoneNumbers?: PhoneNumberListInstance; protected _recordings?: RecordingListInstance; constructor(_version: V1, sid: string); get credentialsLists(): CredentialListListInstance; get ipAccessControlLists(): IpAccessControlListListInstance; get originationUrls(): OriginationUrlListInstance; get phoneNumbers(): PhoneNumberListInstance; get recordings(): RecordingListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; update(params?: TrunkContextUpdateOptions | ((error: Error | null, item?: TrunkInstance) => any), callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TrunkContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TrunkPayload extends TwilioResponsePayload { trunks: TrunkResource[]; } interface TrunkResource { account_sid: string; domain_name: string; disaster_recovery_method: string; disaster_recovery_url: string; friendly_name: string; secure: boolean; recording: any; transfer_mode: TrunkTransferSetting; transfer_caller_id: TrunkTransferCallerId; cnam_lookup_enabled: boolean; auth_type: string; auth_type_set: Array<string>; date_created: Date; date_updated: Date; sid: string; url: string; links: Record<string, string>; } export declare class TrunkInstance { protected _version: V1; protected _solution: TrunkContextSolution; protected _context?: TrunkContext; constructor(_version: V1, payload: TrunkResource, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Trunk resource. */ accountSid: string; /** * The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. */ domainName: string; /** * The HTTP method we use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. */ disasterRecoveryMethod: string; /** * The URL we call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. */ disasterRecoveryUrl: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. */ secure: boolean; /** * The recording settings for the trunk. Can be: `do-not-record`, `record-from-ringing`, `record-from-answer`. If set to `record-from-ringing` or `record-from-answer`, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g.`/Trunks/[Trunk_SID]/Recording -XPOST -d\'Mode=record-from-answer\'`. See [Recording](https://www.twilio.com/docs/sip-trunking#recording) for more information. */ recording: any; transferMode: TrunkTransferSetting; transferCallerId: TrunkTransferCallerId; /** * Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. */ cnamLookupEnabled: boolean; /** * The types of authentication mapped to the domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic. */ authType: string; /** * Reserved. */ authTypeSet: Array<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 unique string that we created to identify the Trunk resource. */ sid: string; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ fetch(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Update a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ update(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Update a TrunkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ update(params: TrunkContextUpdateOptions, callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Access the credentialsLists. */ credentialsLists(): CredentialListListInstance; /** * Access the ipAccessControlLists. */ ipAccessControlLists(): IpAccessControlListListInstance; /** * Access the originationUrls. */ originationUrls(): OriginationUrlListInstance; /** * Access the phoneNumbers. */ phoneNumbers(): PhoneNumberListInstance; /** * Access the recordings. */ recordings(): RecordingListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; domainName: string; disasterRecoveryMethod: string; disasterRecoveryUrl: string; friendlyName: string; secure: boolean; recording: any; transferMode: TrunkTransferSetting; transferCallerId: TrunkTransferCallerId; cnamLookupEnabled: boolean; authType: string; authTypeSet: string[]; dateCreated: Date; dateUpdated: Date; sid: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TrunkSolution { } export interface TrunkListInstance { _version: V1; _solution: TrunkSolution; _uri: string; (sid: string): TrunkContext; get(sid: string): TrunkContext; /** * Create a TrunkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ create(callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Create a TrunkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrunkInstance */ create(params: TrunkListInstanceCreateOptions, callback?: (error: Error | null, item?: TrunkInstance) => any): Promise<TrunkInstance>; /** * Streams TrunkInstance 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 { TrunkListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TrunkInstance, done: (err?: Error) => void) => void): void; each(params: TrunkListInstanceEachOptions, callback?: (item: TrunkInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TrunkInstance 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: TrunkPage) => any): Promise<TrunkPage>; /** * Lists TrunkInstance 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 { TrunkListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TrunkInstance[]) => any): Promise<TrunkInstance[]>; list(params: TrunkListInstanceOptions, callback?: (error: Error | null, items: TrunkInstance[]) => any): Promise<TrunkInstance[]>; /** * Retrieve a single page of TrunkInstance 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 { TrunkListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TrunkPage) => any): Promise<TrunkPage>; page(params: TrunkListInstancePageOptions, callback?: (error: Error | null, items: TrunkPage) => any): Promise<TrunkPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TrunkListInstance(version: V1): TrunkListInstance; export declare class TrunkPage extends Page<V1, TrunkPayload, TrunkResource, TrunkInstance> { /** * Initialize the TrunkPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TrunkSolution); /** * Build an instance of TrunkInstance * * @param payload - Payload response from the API */ getInstance(payload: TrunkResource): TrunkInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trunking/v1/trunk/phoneNumber.js000064400000024652151677225100013712 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trunking * 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.PhoneNumberPage = exports.PhoneNumberListInstance = exports.PhoneNumberInstance = exports.PhoneNumberContextImpl = void 0; 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 PhoneNumberContextImpl { constructor(_version, trunkSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { trunkSid, sid }; this._uri = `/Trunks/${trunkSid}/PhoneNumbers/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.trunkSid, 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.PhoneNumberContextImpl = PhoneNumberContextImpl; class PhoneNumberInstance { constructor(_version, payload, trunkSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.addressRequirements = payload.address_requirements; this.apiVersion = payload.api_version; this.beta = payload.beta; this.capabilities = payload.capabilities; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.links = payload.links; this.phoneNumber = payload.phone_number; this.sid = payload.sid; this.smsApplicationSid = payload.sms_application_sid; this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsUrl = payload.sms_url; this.statusCallback = payload.status_callback; this.statusCallbackMethod = payload.status_callback_method; this.trunkSid = payload.trunk_sid; this.url = payload.url; this.voiceApplicationSid = payload.voice_application_sid; this.voiceCallerIdLookup = payload.voice_caller_id_lookup; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceMethod = payload.voice_method; this.voiceUrl = payload.voice_url; this._solution = { trunkSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PhoneNumberContextImpl(this._version, this._solution.trunkSid, this._solution.sid); return this._context; } /** * Remove a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, addressRequirements: this.addressRequirements, apiVersion: this.apiVersion, beta: this.beta, capabilities: this.capabilities, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, links: this.links, phoneNumber: this.phoneNumber, sid: this.sid, smsApplicationSid: this.smsApplicationSid, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsUrl: this.smsUrl, statusCallback: this.statusCallback, statusCallbackMethod: this.statusCallbackMethod, trunkSid: this.trunkSid, url: this.url, voiceApplicationSid: this.voiceApplicationSid, voiceCallerIdLookup: this.voiceCallerIdLookup, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceMethod: this.voiceMethod, voiceUrl: this.voiceUrl, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberInstance = PhoneNumberInstance; function PhoneNumberListInstance(version, trunkSid) { if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PhoneNumberContextImpl(version, trunkSid, sid); }; instance._version = version; instance._solution = { trunkSid }; instance._uri = `/Trunks/${trunkSid}/PhoneNumbers`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["phoneNumberSid"] === null || params["phoneNumberSid"] === undefined) { throw new Error("Required parameter \"params['phoneNumberSid']\" missing."); } let data = {}; data["PhoneNumberSid"] = params["phoneNumberSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.trunkSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberPage(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 PhoneNumberPage(instance._version, payload, 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; } exports.PhoneNumberListInstance = PhoneNumberListInstance; class PhoneNumberPage extends Page_1.default { /** * Initialize the PhoneNumberPage * * @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 PhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PhoneNumberInstance(this._version, payload, this._solution.trunkSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberPage = PhoneNumberPage; rest/trunking/v1/trunk/originationUrl.d.ts000064400000034051151677225100014663 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to update a OriginationUrlInstance */ export interface OriginationUrlContextUpdateOptions { /** The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. */ weight?: number; /** The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. */ priority?: number; /** Whether the URL is enabled. The default is `true`. */ enabled?: boolean; /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. `sips` is NOT supported. */ sipUrl?: string; } /** * Options to pass to create a OriginationUrlInstance */ export interface OriginationUrlListInstanceCreateOptions { /** The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. */ weight: number; /** The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. */ priority: number; /** Whether the URL is enabled. The default is `true`. */ enabled: boolean; /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName: string; /** The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. */ sipUrl: string; } /** * Options to pass to each */ export interface OriginationUrlListInstanceEachOptions { /** 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: OriginationUrlInstance, 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 OriginationUrlListInstanceOptions { /** 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 OriginationUrlListInstancePageOptions { /** 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 OriginationUrlContext { /** * Remove a OriginationUrlInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a OriginationUrlInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OriginationUrlInstance */ fetch(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>; /** * Update a OriginationUrlInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OriginationUrlInstance */ update(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>; /** * Update a OriginationUrlInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed OriginationUrlInstance */ update(params: OriginationUrlContextUpdateOptions, callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface OriginationUrlContextSolution { trunkSid: string; sid: string; } export declare class OriginationUrlContextImpl implements OriginationUrlContext { protected _version: V1; protected _solution: OriginationUrlContextSolution; protected _uri: string; constructor(_version: V1, trunkSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>; update(params?: OriginationUrlContextUpdateOptions | ((error: Error | null, item?: OriginationUrlInstance) => any), callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): OriginationUrlContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface OriginationUrlPayload extends TwilioResponsePayload { origination_urls: OriginationUrlResource[]; } interface OriginationUrlResource { account_sid: string; sid: string; trunk_sid: string; weight: number; enabled: boolean; sip_url: string; friendly_name: string; priority: number; date_created: Date; date_updated: Date; url: string; } export declare class OriginationUrlInstance { protected _version: V1; protected _solution: OriginationUrlContextSolution; protected _context?: OriginationUrlContext; constructor(_version: V1, payload: OriginationUrlResource, trunkSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OriginationUrl resource. */ accountSid: string; /** * The unique string that we created to identify the OriginationUrl resource. */ sid: string; /** * The SID of the Trunk that owns the Origination URL. */ trunkSid: string; /** * The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. */ weight: number; /** * Whether the URL is enabled. The default is `true`. */ enabled: boolean; /** * The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. */ sipUrl: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. */ priority: number; /** * 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 absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a OriginationUrlInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a OriginationUrlInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OriginationUrlInstance */ fetch(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>; /** * Update a OriginationUrlInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OriginationUrlInstance */ update(callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>; /** * Update a OriginationUrlInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed OriginationUrlInstance */ update(params: OriginationUrlContextUpdateOptions, callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; trunkSid: string; weight: number; enabled: boolean; sipUrl: string; friendlyName: string; priority: number; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface OriginationUrlSolution { trunkSid: string; } export interface OriginationUrlListInstance { _version: V1; _solution: OriginationUrlSolution; _uri: string; (sid: string): OriginationUrlContext; get(sid: string): OriginationUrlContext; /** * Create a OriginationUrlInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed OriginationUrlInstance */ create(params: OriginationUrlListInstanceCreateOptions, callback?: (error: Error | null, item?: OriginationUrlInstance) => any): Promise<OriginationUrlInstance>; /** * Streams OriginationUrlInstance 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 { OriginationUrlListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: OriginationUrlInstance, done: (err?: Error) => void) => void): void; each(params: OriginationUrlListInstanceEachOptions, callback?: (item: OriginationUrlInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of OriginationUrlInstance 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: OriginationUrlPage) => any): Promise<OriginationUrlPage>; /** * Lists OriginationUrlInstance 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 { OriginationUrlListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: OriginationUrlInstance[]) => any): Promise<OriginationUrlInstance[]>; list(params: OriginationUrlListInstanceOptions, callback?: (error: Error | null, items: OriginationUrlInstance[]) => any): Promise<OriginationUrlInstance[]>; /** * Retrieve a single page of OriginationUrlInstance 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 { OriginationUrlListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: OriginationUrlPage) => any): Promise<OriginationUrlPage>; page(params: OriginationUrlListInstancePageOptions, callback?: (error: Error | null, items: OriginationUrlPage) => any): Promise<OriginationUrlPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function OriginationUrlListInstance(version: V1, trunkSid: string): OriginationUrlListInstance; export declare class OriginationUrlPage extends Page<V1, OriginationUrlPayload, OriginationUrlResource, OriginationUrlInstance> { /** * Initialize the OriginationUrlPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: OriginationUrlSolution); /** * Build an instance of OriginationUrlInstance * * @param payload - Payload response from the API */ getInstance(payload: OriginationUrlResource): OriginationUrlInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trunking/v1/trunk/phoneNumber.d.ts000064400000034236151677225100014145 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type PhoneNumberAddressRequirement = "none" | "any" | "local" | "foreign"; /** * Options to pass to create a PhoneNumberInstance */ export interface PhoneNumberListInstanceCreateOptions { /** The SID of the [Incoming Phone Number](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) that you want to associate with the trunk. */ phoneNumberSid: string; } /** * Options to pass to each */ export interface PhoneNumberListInstanceEachOptions { /** 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: PhoneNumberInstance, 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 PhoneNumberListInstanceOptions { /** 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 PhoneNumberListInstancePageOptions { /** 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 PhoneNumberContext { /** * Remove a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PhoneNumberContextSolution { trunkSid: string; sid: string; } export declare class PhoneNumberContextImpl implements PhoneNumberContext { protected _version: V1; protected _solution: PhoneNumberContextSolution; protected _uri: string; constructor(_version: V1, trunkSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PhoneNumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PhoneNumberPayload extends TwilioResponsePayload { phone_numbers: PhoneNumberResource[]; } interface PhoneNumberResource { account_sid: string; address_requirements: PhoneNumberAddressRequirement; api_version: string; beta: boolean; capabilities: Record<string, string>; date_created: Date; date_updated: Date; friendly_name: string; links: Record<string, string>; phone_number: string; sid: string; sms_application_sid: string; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_url: string; status_callback: string; status_callback_method: string; trunk_sid: string; url: string; voice_application_sid: string; voice_caller_id_lookup: boolean; voice_fallback_method: string; voice_fallback_url: string; voice_method: string; voice_url: string; } export declare class PhoneNumberInstance { protected _version: V1; protected _solution: PhoneNumberContextSolution; protected _context?: PhoneNumberContext; constructor(_version: V1, payload: PhoneNumberResource, trunkSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. */ accountSid: string; addressRequirements: PhoneNumberAddressRequirement; /** * The API version used to start a new TwiML session. */ apiVersion: string; /** * Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. */ beta: boolean; /** * The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. */ capabilities: Record<string, 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 string that you assigned to describe the resource. */ friendlyName: string; /** * The URLs of related resources. */ links: Record<string, string>; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The unique string that we created to identify the PhoneNumber resource. */ sid: string; /** * The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. */ smsApplicationSid: string; /** * The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. */ smsFallbackMethod: string; /** * The URL that we call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML from `sms_url`. */ smsFallbackUrl: string; /** * The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. */ smsMethod: string; /** * The URL we call using the `sms_method` when the phone number receives an incoming SMS message. */ smsUrl: string; /** * The URL we call using the `status_callback_method` to send status information to your application. */ statusCallback: string; /** * The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. */ statusCallbackMethod: string; /** * The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice URLs and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. */ trunkSid: string; /** * The absolute URL of the resource. */ url: string; /** * The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice URLs and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. */ voiceApplicationSid: string; /** * Whether we look up the caller\'s caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. */ voiceCallerIdLookup: boolean; /** * The HTTP method that we use to call `voice_fallback_url`. Can be: `GET` or `POST`. */ voiceFallbackMethod: string; /** * The URL that we call using the `voice_fallback_method` when an error occurs retrieving or executing the TwiML requested by `url`. */ voiceFallbackUrl: string; /** * The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. */ voiceMethod: string; /** * The URL we call using the `voice_method` when the phone number receives a call. The `voice_url` is not be used if a `voice_application_sid` or a `trunk_sid` is set. */ voiceUrl: string; private get _proxy(); /** * Remove a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; addressRequirements: PhoneNumberAddressRequirement; apiVersion: string; beta: boolean; capabilities: Record<string, string>; dateCreated: Date; dateUpdated: Date; friendlyName: string; links: Record<string, string>; phoneNumber: string; sid: string; smsApplicationSid: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; statusCallback: string; statusCallbackMethod: string; trunkSid: string; url: string; voiceApplicationSid: string; voiceCallerIdLookup: boolean; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceUrl: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PhoneNumberSolution { trunkSid: string; } export interface PhoneNumberListInstance { _version: V1; _solution: PhoneNumberSolution; _uri: string; (sid: string): PhoneNumberContext; get(sid: string): PhoneNumberContext; /** * Create a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ create(params: PhoneNumberListInstanceCreateOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Streams PhoneNumberInstance 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 { PhoneNumberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void; each(params: PhoneNumberListInstanceEachOptions, callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PhoneNumberInstance 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: PhoneNumberPage) => any): Promise<PhoneNumberPage>; /** * Lists PhoneNumberInstance 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 { PhoneNumberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>; list(params: PhoneNumberListInstanceOptions, callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>; /** * Retrieve a single page of PhoneNumberInstance 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 { PhoneNumberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>; page(params: PhoneNumberListInstancePageOptions, callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PhoneNumberListInstance(version: V1, trunkSid: string): PhoneNumberListInstance; export declare class PhoneNumberPage extends Page<V1, PhoneNumberPayload, PhoneNumberResource, PhoneNumberInstance> { /** * Initialize the PhoneNumberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: PhoneNumberSolution); /** * Build an instance of PhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload: PhoneNumberResource): PhoneNumberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trunking/v1/trunk/originationUrl.js000064400000026333151677225100014433 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trunking * 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.OriginationUrlPage = exports.OriginationUrlListInstance = exports.OriginationUrlInstance = exports.OriginationUrlContextImpl = void 0; 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 OriginationUrlContextImpl { constructor(_version, trunkSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { trunkSid, sid }; this._uri = `/Trunks/${trunkSid}/OriginationUrls/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new OriginationUrlInstance(operationVersion, payload, instance._solution.trunkSid, 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["weight"] !== undefined) data["Weight"] = params["weight"]; if (params["priority"] !== undefined) data["Priority"] = params["priority"]; if (params["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["sipUrl"] !== undefined) data["SipUrl"] = params["sipUrl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new OriginationUrlInstance(operationVersion, payload, instance._solution.trunkSid, 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.OriginationUrlContextImpl = OriginationUrlContextImpl; class OriginationUrlInstance { constructor(_version, payload, trunkSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.trunkSid = payload.trunk_sid; this.weight = deserialize.integer(payload.weight); this.enabled = payload.enabled; this.sipUrl = payload.sip_url; this.friendlyName = payload.friendly_name; this.priority = deserialize.integer(payload.priority); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { trunkSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new OriginationUrlContextImpl(this._version, this._solution.trunkSid, this._solution.sid); return this._context; } /** * Remove a OriginationUrlInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a OriginationUrlInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OriginationUrlInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, trunkSid: this.trunkSid, weight: this.weight, enabled: this.enabled, sipUrl: this.sipUrl, friendlyName: this.friendlyName, priority: this.priority, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OriginationUrlInstance = OriginationUrlInstance; function OriginationUrlListInstance(version, trunkSid) { if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new OriginationUrlContextImpl(version, trunkSid, sid); }; instance._version = version; instance._solution = { trunkSid }; instance._uri = `/Trunks/${trunkSid}/OriginationUrls`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["weight"] === null || params["weight"] === undefined) { throw new Error("Required parameter \"params['weight']\" missing."); } if (params["priority"] === null || params["priority"] === undefined) { throw new Error("Required parameter \"params['priority']\" missing."); } if (params["enabled"] === null || params["enabled"] === undefined) { throw new Error("Required parameter \"params['enabled']\" missing."); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["sipUrl"] === null || params["sipUrl"] === undefined) { throw new Error("Required parameter \"params['sipUrl']\" missing."); } let data = {}; data["Weight"] = params["weight"]; data["Priority"] = params["priority"]; data["Enabled"] = serialize.bool(params["enabled"]); data["FriendlyName"] = params["friendlyName"]; data["SipUrl"] = params["sipUrl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new OriginationUrlInstance(operationVersion, payload, instance._solution.trunkSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new OriginationUrlPage(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 OriginationUrlPage(instance._version, payload, 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; } exports.OriginationUrlListInstance = OriginationUrlListInstance; class OriginationUrlPage extends Page_1.default { /** * Initialize the OriginationUrlPage * * @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 OriginationUrlInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new OriginationUrlInstance(this._version, payload, this._solution.trunkSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OriginationUrlPage = OriginationUrlPage; rest/trunking/v1/trunk/ipAccessControlList.js000064400000021504151677225100015350 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trunking * 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.IpAccessControlListPage = exports.IpAccessControlListListInstance = exports.IpAccessControlListInstance = exports.IpAccessControlListContextImpl = void 0; 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 IpAccessControlListContextImpl { constructor(_version, trunkSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { trunkSid, sid }; this._uri = `/Trunks/${trunkSid}/IpAccessControlLists/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new IpAccessControlListInstance(operationVersion, payload, instance._solution.trunkSid, 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.IpAccessControlListContextImpl = IpAccessControlListContextImpl; class IpAccessControlListInstance { constructor(_version, payload, trunkSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.trunkSid = payload.trunk_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 = { trunkSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new IpAccessControlListContextImpl(this._version, this._solution.trunkSid, this._solution.sid); return this._context; } /** * Remove a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, trunkSid: this.trunkSid, 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.IpAccessControlListInstance = IpAccessControlListInstance; function IpAccessControlListListInstance(version, trunkSid) { if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new IpAccessControlListContextImpl(version, trunkSid, sid); }; instance._version = version; instance._solution = { trunkSid }; instance._uri = `/Trunks/${trunkSid}/IpAccessControlLists`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["ipAccessControlListSid"] === null || params["ipAccessControlListSid"] === undefined) { throw new Error("Required parameter \"params['ipAccessControlListSid']\" missing."); } let data = {}; data["IpAccessControlListSid"] = params["ipAccessControlListSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new IpAccessControlListInstance(operationVersion, payload, instance._solution.trunkSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new IpAccessControlListPage(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 IpAccessControlListPage(instance._version, payload, 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; } exports.IpAccessControlListListInstance = IpAccessControlListListInstance; class IpAccessControlListPage extends Page_1.default { /** * Initialize the IpAccessControlListPage * * @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 IpAccessControlListInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new IpAccessControlListInstance(this._version, payload, this._solution.trunkSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.IpAccessControlListPage = IpAccessControlListPage; rest/trunking/v1/trunk/credentialList.d.ts000064400000023717151677225100014633 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a CredentialListInstance */ export interface CredentialListListInstanceCreateOptions { /** The SID of the [Credential List](https://www.twilio.com/docs/voice/sip/api/sip-credentiallist-resource) that you want to associate with the trunk. Once associated, we will authenticate access to the trunk against this list. */ credentialListSid: string; } /** * Options to pass to each */ export interface CredentialListListInstanceEachOptions { /** 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: CredentialListInstance, 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 CredentialListListInstanceOptions { /** 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 CredentialListListInstancePageOptions { /** 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 CredentialListContext { /** * Remove a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ fetch(callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialListContextSolution { trunkSid: string; sid: string; } export declare class CredentialListContextImpl implements CredentialListContext { protected _version: V1; protected _solution: CredentialListContextSolution; protected _uri: string; constructor(_version: V1, trunkSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialListContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialListPayload extends TwilioResponsePayload { credential_lists: CredentialListResource[]; } interface CredentialListResource { account_sid: string; sid: string; trunk_sid: string; friendly_name: string; date_created: Date; date_updated: Date; url: string; } export declare class CredentialListInstance { protected _version: V1; protected _solution: CredentialListContextSolution; protected _context?: CredentialListContext; constructor(_version: V1, payload: CredentialListResource, trunkSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialList resource. */ accountSid: string; /** * The unique string that we created to identify the CredentialList resource. */ sid: string; /** * The SID of the Trunk the credential list in associated with. */ trunkSid: 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 absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ fetch(callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; trunkSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialListSolution { trunkSid: string; } export interface CredentialListListInstance { _version: V1; _solution: CredentialListSolution; _uri: string; (sid: string): CredentialListContext; get(sid: string): CredentialListContext; /** * Create a CredentialListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ create(params: CredentialListListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialListInstance) => any): Promise<CredentialListInstance>; /** * Streams CredentialListInstance 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 { CredentialListListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialListInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListListInstanceEachOptions, callback?: (item: CredentialListInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialListInstance 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: CredentialListPage) => any): Promise<CredentialListPage>; /** * Lists CredentialListInstance 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 { CredentialListListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialListInstance[]) => any): Promise<CredentialListInstance[]>; list(params: CredentialListListInstanceOptions, callback?: (error: Error | null, items: CredentialListInstance[]) => any): Promise<CredentialListInstance[]>; /** * Retrieve a single page of CredentialListInstance 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 { CredentialListListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialListPage) => any): Promise<CredentialListPage>; page(params: CredentialListListInstancePageOptions, callback?: (error: Error | null, items: CredentialListPage) => any): Promise<CredentialListPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListListInstance(version: V1, trunkSid: string): CredentialListListInstance; export declare class CredentialListPage extends Page<V1, CredentialListPayload, CredentialListResource, CredentialListInstance> { /** * Initialize the CredentialListPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CredentialListSolution); /** * Build an instance of CredentialListInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialListResource): CredentialListInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trunking/v1/trunk/ipAccessControlList.d.ts000064400000024417151677225100015612 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a IpAccessControlListInstance */ export interface IpAccessControlListListInstanceCreateOptions { /** The SID of the [IP Access Control List](https://www.twilio.com/docs/voice/sip/api/sip-ipaccesscontrollist-resource) that you want to associate with the trunk. */ ipAccessControlListSid: string; } /** * Options to pass to each */ export interface IpAccessControlListListInstanceEachOptions { /** 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: IpAccessControlListInstance, 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 IpAccessControlListListInstanceOptions { /** 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 IpAccessControlListListInstancePageOptions { /** 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 IpAccessControlListContext { /** * Remove a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ fetch(callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface IpAccessControlListContextSolution { trunkSid: string; sid: string; } export declare class IpAccessControlListContextImpl implements IpAccessControlListContext { protected _version: V1; protected _solution: IpAccessControlListContextSolution; protected _uri: string; constructor(_version: V1, trunkSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): IpAccessControlListContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface IpAccessControlListPayload extends TwilioResponsePayload { ip_access_control_lists: IpAccessControlListResource[]; } interface IpAccessControlListResource { account_sid: string; sid: string; trunk_sid: string; friendly_name: string; date_created: Date; date_updated: Date; url: string; } export declare class IpAccessControlListInstance { protected _version: V1; protected _solution: IpAccessControlListContextSolution; protected _context?: IpAccessControlListContext; constructor(_version: V1, payload: IpAccessControlListResource, trunkSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlList resource. */ accountSid: string; /** * The unique string that we created to identify the IpAccessControlList resource. */ sid: string; /** * The SID of the Trunk the resource is associated with. */ trunkSid: 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 absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a IpAccessControlListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ fetch(callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; trunkSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface IpAccessControlListSolution { trunkSid: string; } export interface IpAccessControlListListInstance { _version: V1; _solution: IpAccessControlListSolution; _uri: string; (sid: string): IpAccessControlListContext; get(sid: string): IpAccessControlListContext; /** * Create a IpAccessControlListInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed IpAccessControlListInstance */ create(params: IpAccessControlListListInstanceCreateOptions, callback?: (error: Error | null, item?: IpAccessControlListInstance) => any): Promise<IpAccessControlListInstance>; /** * Streams IpAccessControlListInstance 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 { IpAccessControlListListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: IpAccessControlListInstance, done: (err?: Error) => void) => void): void; each(params: IpAccessControlListListInstanceEachOptions, callback?: (item: IpAccessControlListInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of IpAccessControlListInstance 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: IpAccessControlListPage) => any): Promise<IpAccessControlListPage>; /** * Lists IpAccessControlListInstance 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 { IpAccessControlListListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: IpAccessControlListInstance[]) => any): Promise<IpAccessControlListInstance[]>; list(params: IpAccessControlListListInstanceOptions, callback?: (error: Error | null, items: IpAccessControlListInstance[]) => any): Promise<IpAccessControlListInstance[]>; /** * Retrieve a single page of IpAccessControlListInstance 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 { IpAccessControlListListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: IpAccessControlListPage) => any): Promise<IpAccessControlListPage>; page(params: IpAccessControlListListInstancePageOptions, callback?: (error: Error | null, items: IpAccessControlListPage) => any): Promise<IpAccessControlListPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function IpAccessControlListListInstance(version: V1, trunkSid: string): IpAccessControlListListInstance; export declare class IpAccessControlListPage extends Page<V1, IpAccessControlListPayload, IpAccessControlListResource, IpAccessControlListInstance> { /** * Initialize the IpAccessControlListPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: IpAccessControlListSolution); /** * Build an instance of IpAccessControlListInstance * * @param payload - Payload response from the API */ getInstance(payload: IpAccessControlListResource): IpAccessControlListInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trunking/v1/trunk/recording.js000064400000011373151677225100013400 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trunking * 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.RecordingListInstance = exports.RecordingInstance = exports.RecordingContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class RecordingContextImpl { constructor(_version, trunkSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } this._solution = { trunkSid }; this._uri = `/Trunks/${trunkSid}/Recording`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.trunkSid)); 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["mode"] !== undefined) data["Mode"] = params["mode"]; if (params["trim"] !== undefined) data["Trim"] = params["trim"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RecordingInstance(operationVersion, payload, instance._solution.trunkSid)); 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.RecordingContextImpl = RecordingContextImpl; class RecordingInstance { constructor(_version, payload, trunkSid) { this._version = _version; this.mode = payload.mode; this.trim = payload.trim; this._solution = { trunkSid }; } get _proxy() { this._context = this._context || new RecordingContextImpl(this._version, this._solution.trunkSid); return this._context; } /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { mode: this.mode, trim: this.trim, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RecordingInstance = RecordingInstance; function RecordingListInstance(version, trunkSid) { if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new RecordingContextImpl(version, trunkSid); }; instance._version = version; instance._solution = { trunkSid }; 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; } exports.RecordingListInstance = RecordingListInstance; rest/trunking/v1/trunk/credentialList.js000064400000021225151677225100014367 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trunking * 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.CredentialListPage = exports.CredentialListListInstance = exports.CredentialListInstance = exports.CredentialListContextImpl = void 0; 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 CredentialListContextImpl { constructor(_version, trunkSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { trunkSid, sid }; this._uri = `/Trunks/${trunkSid}/CredentialLists/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialListInstance(operationVersion, payload, instance._solution.trunkSid, 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.CredentialListContextImpl = CredentialListContextImpl; class CredentialListInstance { constructor(_version, payload, trunkSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.trunkSid = payload.trunk_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 = { trunkSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CredentialListContextImpl(this._version, this._solution.trunkSid, this._solution.sid); return this._context; } /** * Remove a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialListInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialListInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, trunkSid: this.trunkSid, 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.CredentialListInstance = CredentialListInstance; function CredentialListListInstance(version, trunkSid) { if (!(0, utility_1.isValidPathParam)(trunkSid)) { throw new Error("Parameter 'trunkSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialListContextImpl(version, trunkSid, sid); }; instance._version = version; instance._solution = { trunkSid }; instance._uri = `/Trunks/${trunkSid}/CredentialLists`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["credentialListSid"] === null || params["credentialListSid"] === undefined) { throw new Error("Required parameter \"params['credentialListSid']\" missing."); } let data = {}; data["CredentialListSid"] = params["credentialListSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialListInstance(operationVersion, payload, instance._solution.trunkSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialListPage(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 CredentialListPage(instance._version, payload, 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; } exports.CredentialListListInstance = CredentialListListInstance; class CredentialListPage extends Page_1.default { /** * Initialize the CredentialListPage * * @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 CredentialListInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialListInstance(this._version, payload, this._solution.trunkSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialListPage = CredentialListPage; rest/trunking/v1/trunk/recording.d.ts000064400000010773151677225100013637 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export type RecordingRecordingMode = "do-not-record" | "record-from-ringing" | "record-from-answer" | "record-from-ringing-dual" | "record-from-answer-dual"; export type RecordingRecordingTrim = "trim-silence" | "do-not-trim"; /** * Options to pass to update a RecordingInstance */ export interface RecordingContextUpdateOptions { /** */ mode?: RecordingRecordingMode; /** */ trim?: RecordingRecordingTrim; } export interface RecordingContext { /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Update a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ update(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Update a RecordingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RecordingContextSolution { trunkSid: string; } export declare class RecordingContextImpl implements RecordingContext { protected _version: V1; protected _solution: RecordingContextSolution; protected _uri: string; constructor(_version: V1, trunkSid: string); fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; update(params?: RecordingContextUpdateOptions | ((error: Error | null, item?: RecordingInstance) => any), callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RecordingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RecordingResource { mode: RecordingRecordingMode; trim: RecordingRecordingTrim; } export declare class RecordingInstance { protected _version: V1; protected _solution: RecordingContextSolution; protected _context?: RecordingContext; constructor(_version: V1, payload: RecordingResource, trunkSid: string); mode: RecordingRecordingMode; trim: RecordingRecordingTrim; private get _proxy(); /** * Fetch a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ fetch(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Update a RecordingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ update(callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Update a RecordingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RecordingInstance */ update(params: RecordingContextUpdateOptions, callback?: (error: Error | null, item?: RecordingInstance) => any): Promise<RecordingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { mode: RecordingRecordingMode; trim: RecordingRecordingTrim; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RecordingSolution { trunkSid: string; } export interface RecordingListInstance { _version: V1; _solution: RecordingSolution; _uri: string; (): RecordingContext; get(): RecordingContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RecordingListInstance(version: V1, trunkSid: string): RecordingListInstance; export {}; rest/trunking/V1.js000064400000002322151677225100010213 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trunking * 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 trunk_1 = require("./v1/trunk"); class V1 extends Version_1.default { /** * Initialize the V1 version of Trunking * * @param domain - The Twilio (Twilio.Trunking) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for trunks resource */ get trunks() { this._trunks = this._trunks || (0, trunk_1.TrunkListInstance)(this); return this._trunks; } } exports.default = V1; rest/VideoBase.d.ts000064400000000436151677225100010165 0ustar00import Domain from "../base/Domain"; import V1 from "./video/V1"; declare class VideoBase extends Domain { _v1?: V1; /** * Initialize video domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = VideoBase; rest/Video.d.ts000064400000002300151677225100007362 0ustar00import { CompositionListInstance } from "./video/v1/composition"; import { CompositionHookListInstance } from "./video/v1/compositionHook"; import { CompositionSettingsListInstance } from "./video/v1/compositionSettings"; import { RecordingListInstance } from "./video/v1/recording"; import { RecordingSettingsListInstance } from "./video/v1/recordingSettings"; import { RoomListInstance } from "./video/v1/room"; import VideoBase from "./VideoBase"; declare class Video extends VideoBase { /** * @deprecated - Use v1.compositions instead */ get compositions(): CompositionListInstance; /** * @deprecated - Use v1.compositionHooks instead */ get compositionHooks(): CompositionHookListInstance; /** * @deprecated - Use v1.compositionSettings instead */ get compositionSettings(): CompositionSettingsListInstance; /** * @deprecated - Use v1.recordings instead */ get recordings(): RecordingListInstance; /** * @deprecated - Use v1.recordingSettings instead */ get recordingSettings(): RecordingSettingsListInstance; /** * @deprecated - Use v1.rooms instead */ get rooms(): RoomListInstance; } export = Video; rest/verify/V2.d.ts000064400000004025151677225100010115 0ustar00import VerifyBase from "../VerifyBase"; import Version from "../../base/Version"; import { FormListInstance } from "./v2/form"; import { SafelistListInstance } from "./v2/safelist"; import { ServiceListInstance } from "./v2/service"; import { TemplateListInstance } from "./v2/template"; import { VerificationAttemptListInstance } from "./v2/verificationAttempt"; import { VerificationAttemptsSummaryListInstance } from "./v2/verificationAttemptsSummary"; export default class V2 extends Version { /** * Initialize the V2 version of Verify * * @param domain - The Twilio (Twilio.Verify) domain */ constructor(domain: VerifyBase); /** forms - { Twilio.Verify.V2.FormListInstance } resource */ protected _forms?: FormListInstance; /** safelist - { Twilio.Verify.V2.SafelistListInstance } resource */ protected _safelist?: SafelistListInstance; /** services - { Twilio.Verify.V2.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** templates - { Twilio.Verify.V2.TemplateListInstance } resource */ protected _templates?: TemplateListInstance; /** verificationAttempts - { Twilio.Verify.V2.VerificationAttemptListInstance } resource */ protected _verificationAttempts?: VerificationAttemptListInstance; /** verificationAttemptsSummary - { Twilio.Verify.V2.VerificationAttemptsSummaryListInstance } resource */ protected _verificationAttemptsSummary?: VerificationAttemptsSummaryListInstance; /** Getter for forms resource */ get forms(): FormListInstance; /** Getter for safelist resource */ get safelist(): SafelistListInstance; /** Getter for services resource */ get services(): ServiceListInstance; /** Getter for templates resource */ get templates(): TemplateListInstance; /** Getter for verificationAttempts resource */ get verificationAttempts(): VerificationAttemptListInstance; /** Getter for verificationAttemptsSummary resource */ get verificationAttemptsSummary(): VerificationAttemptsSummaryListInstance; } rest/verify/V2.js000064400000005175151677225100007670 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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 form_1 = require("./v2/form"); const safelist_1 = require("./v2/safelist"); const service_1 = require("./v2/service"); const template_1 = require("./v2/template"); const verificationAttempt_1 = require("./v2/verificationAttempt"); const verificationAttemptsSummary_1 = require("./v2/verificationAttemptsSummary"); class V2 extends Version_1.default { /** * Initialize the V2 version of Verify * * @param domain - The Twilio (Twilio.Verify) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for forms resource */ get forms() { this._forms = this._forms || (0, form_1.FormListInstance)(this); return this._forms; } /** Getter for safelist resource */ get safelist() { this._safelist = this._safelist || (0, safelist_1.SafelistListInstance)(this); return this._safelist; } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } /** Getter for templates resource */ get templates() { this._templates = this._templates || (0, template_1.TemplateListInstance)(this); return this._templates; } /** Getter for verificationAttempts resource */ get verificationAttempts() { this._verificationAttempts = this._verificationAttempts || (0, verificationAttempt_1.VerificationAttemptListInstance)(this); return this._verificationAttempts; } /** Getter for verificationAttemptsSummary resource */ get verificationAttemptsSummary() { this._verificationAttemptsSummary = this._verificationAttemptsSummary || (0, verificationAttemptsSummary_1.VerificationAttemptsSummaryListInstance)(this); return this._verificationAttemptsSummary; } } exports.default = V2; rest/verify/v2/verificationAttempt.d.ts000064400000034033151677225100014200 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; export type VerificationAttemptChannels = "sms" | "call" | "email" | "whatsapp"; export type VerificationAttemptConversionStatus = "converted" | "unconverted"; /** * Options to pass to each */ export interface VerificationAttemptListInstanceEachOptions { /** Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd\'T\'HH:mm:ss\'Z. */ dateCreatedAfter?: Date; /** Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd\'T\'HH:mm:ss\'Z. */ dateCreatedBefore?: Date; /** Destination of a verification. It is phone number in E.164 format. */ "channelData.to"?: string; /** Filter used to query Verification Attempts sent to the specified destination country. */ country?: string; /** Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` */ channel?: VerificationAttemptChannels; /** Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. */ verifyServiceSid?: string; /** Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. */ verificationSid?: string; /** Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. */ status?: VerificationAttemptConversionStatus; /** 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: VerificationAttemptInstance, 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 VerificationAttemptListInstanceOptions { /** Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd\'T\'HH:mm:ss\'Z. */ dateCreatedAfter?: Date; /** Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd\'T\'HH:mm:ss\'Z. */ dateCreatedBefore?: Date; /** Destination of a verification. It is phone number in E.164 format. */ "channelData.to"?: string; /** Filter used to query Verification Attempts sent to the specified destination country. */ country?: string; /** Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` */ channel?: VerificationAttemptChannels; /** Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. */ verifyServiceSid?: string; /** Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. */ verificationSid?: string; /** Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. */ status?: VerificationAttemptConversionStatus; /** 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 VerificationAttemptListInstancePageOptions { /** Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd\'T\'HH:mm:ss\'Z. */ dateCreatedAfter?: Date; /** Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd\'T\'HH:mm:ss\'Z. */ dateCreatedBefore?: Date; /** Destination of a verification. It is phone number in E.164 format. */ "channelData.to"?: string; /** Filter used to query Verification Attempts sent to the specified destination country. */ country?: string; /** Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` */ channel?: VerificationAttemptChannels; /** Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. */ verifyServiceSid?: string; /** Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. */ verificationSid?: string; /** Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. */ status?: VerificationAttemptConversionStatus; /** 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 VerificationAttemptContext { /** * Fetch a VerificationAttemptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationAttemptInstance */ fetch(callback?: (error: Error | null, item?: VerificationAttemptInstance) => any): Promise<VerificationAttemptInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface VerificationAttemptContextSolution { sid: string; } export declare class VerificationAttemptContextImpl implements VerificationAttemptContext { protected _version: V2; protected _solution: VerificationAttemptContextSolution; protected _uri: string; constructor(_version: V2, sid: string); fetch(callback?: (error: Error | null, item?: VerificationAttemptInstance) => any): Promise<VerificationAttemptInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): VerificationAttemptContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface VerificationAttemptPayload extends TwilioResponsePayload { attempts: VerificationAttemptResource[]; } interface VerificationAttemptResource { sid: string; account_sid: string; service_sid: string; verification_sid: string; date_created: Date; date_updated: Date; conversion_status: VerificationAttemptConversionStatus; channel: VerificationAttemptChannels; price: any; channel_data: any; url: string; } export declare class VerificationAttemptInstance { protected _version: V2; protected _solution: VerificationAttemptContextSolution; protected _context?: VerificationAttemptContext; constructor(_version: V2, payload: VerificationAttemptResource, sid?: string); /** * The SID that uniquely identifies the verification attempt resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/verify/api/service) used to generate the attempt. */ serviceSid: string; /** * The SID of the [Verification](https://www.twilio.com/docs/verify/api/verification) that generated the attempt. */ verificationSid: string; /** * The date that this Attempt was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date that this Attempt was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; conversionStatus: VerificationAttemptConversionStatus; channel: VerificationAttemptChannels; /** * An object containing the charge for this verification attempt related to the channel costs and the currency used. The costs related to the succeeded verifications are not included. May not be immediately available. More information on pricing is available [here](https://www.twilio.com/en-us/verify/pricing). */ price: any; /** * An object containing the channel specific information for an attempt. */ channelData: any; url: string; private get _proxy(); /** * Fetch a VerificationAttemptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationAttemptInstance */ fetch(callback?: (error: Error | null, item?: VerificationAttemptInstance) => any): Promise<VerificationAttemptInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; verificationSid: string; dateCreated: Date; dateUpdated: Date; conversionStatus: VerificationAttemptConversionStatus; channel: VerificationAttemptChannels; price: any; channelData: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface VerificationAttemptSolution { } export interface VerificationAttemptListInstance { _version: V2; _solution: VerificationAttemptSolution; _uri: string; (sid: string): VerificationAttemptContext; get(sid: string): VerificationAttemptContext; /** * Streams VerificationAttemptInstance 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 { VerificationAttemptListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: VerificationAttemptInstance, done: (err?: Error) => void) => void): void; each(params: VerificationAttemptListInstanceEachOptions, callback?: (item: VerificationAttemptInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of VerificationAttemptInstance 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: VerificationAttemptPage) => any): Promise<VerificationAttemptPage>; /** * Lists VerificationAttemptInstance 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 { VerificationAttemptListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: VerificationAttemptInstance[]) => any): Promise<VerificationAttemptInstance[]>; list(params: VerificationAttemptListInstanceOptions, callback?: (error: Error | null, items: VerificationAttemptInstance[]) => any): Promise<VerificationAttemptInstance[]>; /** * Retrieve a single page of VerificationAttemptInstance 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 { VerificationAttemptListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: VerificationAttemptPage) => any): Promise<VerificationAttemptPage>; page(params: VerificationAttemptListInstancePageOptions, callback?: (error: Error | null, items: VerificationAttemptPage) => any): Promise<VerificationAttemptPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function VerificationAttemptListInstance(version: V2): VerificationAttemptListInstance; export declare class VerificationAttemptPage extends Page<V2, VerificationAttemptPayload, VerificationAttemptResource, VerificationAttemptInstance> { /** * Initialize the VerificationAttemptPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: VerificationAttemptSolution); /** * Build an instance of VerificationAttemptInstance * * @param payload - Payload response from the API */ getInstance(payload: VerificationAttemptResource): VerificationAttemptInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/verificationAttemptsSummary.js000064400000011417151677225100015506 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.VerificationAttemptsSummaryListInstance = exports.VerificationAttemptsSummaryInstance = exports.VerificationAttemptsSummaryContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class VerificationAttemptsSummaryContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/Attempts/Summary`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["verifyServiceSid"] !== undefined) data["VerifyServiceSid"] = params["verifyServiceSid"]; if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); if (params["country"] !== undefined) data["Country"] = params["country"]; if (params["channel"] !== undefined) data["Channel"] = params["channel"]; if (params["destinationPrefix"] !== undefined) data["DestinationPrefix"] = params["destinationPrefix"]; const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new VerificationAttemptsSummaryInstance(operationVersion, payload)); 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.VerificationAttemptsSummaryContextImpl = VerificationAttemptsSummaryContextImpl; class VerificationAttemptsSummaryInstance { constructor(_version, payload) { this._version = _version; this.totalAttempts = deserialize.integer(payload.total_attempts); this.totalConverted = deserialize.integer(payload.total_converted); this.totalUnconverted = deserialize.integer(payload.total_unconverted); this.conversionRatePercentage = payload.conversion_rate_percentage; this.url = payload.url; this._solution = {}; } get _proxy() { this._context = this._context || new VerificationAttemptsSummaryContextImpl(this._version); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { totalAttempts: this.totalAttempts, totalConverted: this.totalConverted, totalUnconverted: this.totalUnconverted, conversionRatePercentage: this.conversionRatePercentage, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.VerificationAttemptsSummaryInstance = VerificationAttemptsSummaryInstance; function VerificationAttemptsSummaryListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new VerificationAttemptsSummaryContextImpl(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; } exports.VerificationAttemptsSummaryListInstance = VerificationAttemptsSummaryListInstance; rest/verify/v2/template.d.ts000064400000015226151677225100011775 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; /** * Options to pass to each */ export interface TemplateListInstanceEachOptions { /** String filter used to query templates with a given friendly name. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: TemplateInstance, 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 TemplateListInstanceOptions { /** String filter used to query templates with a given friendly name. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface TemplateListInstancePageOptions { /** String filter used to query templates with a given friendly name. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface TemplateSolution { } export interface TemplateListInstance { _version: V2; _solution: TemplateSolution; _uri: string; /** * Streams TemplateInstance 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 { TemplateListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TemplateInstance, done: (err?: Error) => void) => void): void; each(params: TemplateListInstanceEachOptions, callback?: (item: TemplateInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TemplateInstance 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: TemplatePage) => any): Promise<TemplatePage>; /** * Lists TemplateInstance 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 { TemplateListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TemplateInstance[]) => any): Promise<TemplateInstance[]>; list(params: TemplateListInstanceOptions, callback?: (error: Error | null, items: TemplateInstance[]) => any): Promise<TemplateInstance[]>; /** * Retrieve a single page of TemplateInstance 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 { TemplateListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TemplatePage) => any): Promise<TemplatePage>; page(params: TemplateListInstancePageOptions, callback?: (error: Error | null, items: TemplatePage) => any): Promise<TemplatePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TemplateListInstance(version: V2): TemplateListInstance; interface TemplatePayload extends TwilioResponsePayload { templates: TemplateResource[]; } interface TemplateResource { sid: string; account_sid: string; friendly_name: string; channels: Array<string>; translations: any; } export declare class TemplateInstance { protected _version: V2; constructor(_version: V2, payload: TemplateResource); /** * A 34 character string that uniquely identifies a Verification Template. */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * A descriptive string that you create to describe a Template. It can be up to 32 characters long. */ friendlyName: string; /** * A list of channels that support the Template. Can include: sms, voice. */ channels: Array<string>; /** * An object that contains the different translations of the template. Every translation is identified by the language short name and contains its respective information as the approval status, text and created/modified date. */ translations: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; channels: string[]; translations: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class TemplatePage extends Page<V2, TemplatePayload, TemplateResource, TemplateInstance> { /** * Initialize the TemplatePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: TemplateSolution); /** * Build an instance of TemplateInstance * * @param payload - Payload response from the API */ getInstance(payload: TemplateResource): TemplateInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service.d.ts000064400000056357151677225100011634 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; import { AccessTokenListInstance } from "./service/accessToken"; import { EntityListInstance } from "./service/entity"; import { MessagingConfigurationListInstance } from "./service/messagingConfiguration"; import { RateLimitListInstance } from "./service/rateLimit"; import { VerificationListInstance } from "./service/verification"; import { VerificationCheckListInstance } from "./service/verificationCheck"; import { WebhookListInstance } from "./service/webhook"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** A descriptive string that you create to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.** */ friendlyName?: string; /** The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive. */ codeLength?: number; /** Whether to perform a lookup with each verification started and return info about the phone number. */ lookupEnabled?: boolean; /** Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. */ skipSmsToLandlines?: boolean; /** Whether to ask the user to press a number before delivering the verify code in a phone call. */ dtmfInputRequired?: boolean; /** The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. */ ttsName?: string; /** Whether to pass PSD2 transaction parameters when starting a verification. */ psd2Enabled?: boolean; /** Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** */ doNotShareWarningEnabled?: boolean; /** Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. */ customCodeEnabled?: boolean; /** Optional configuration for the Push factors. If true, include the date in the Challenge\\\'s response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. */ "push.includeDate"?: boolean; /** Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) */ "push.apnCredentialSid"?: string; /** Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) */ "push.fcmCredentialSid"?: string; /** Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI. */ "totp.issuer"?: string; /** Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds */ "totp.timeStep"?: number; /** Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 */ "totp.codeLength"?: number; /** Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 */ "totp.skew"?: number; /** The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. */ defaultTemplateSid?: string; /** The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) to associate with the Verification Service. */ "whatsapp.msgServiceSid"?: string; /** The WhatsApp number to use as the sender of the verification messages. This number must be associated with the WhatsApp Message Service. */ "whatsapp.from"?: string; /** Whether to allow verifications from the service to reach the stream-events sinks if configured */ verifyEventSubscriptionEnabled?: boolean; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** A descriptive string that you create to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.** */ friendlyName: string; /** The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive. */ codeLength?: number; /** Whether to perform a lookup with each verification started and return info about the phone number. */ lookupEnabled?: boolean; /** Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. */ skipSmsToLandlines?: boolean; /** Whether to ask the user to press a number before delivering the verify code in a phone call. */ dtmfInputRequired?: boolean; /** The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. */ ttsName?: string; /** Whether to pass PSD2 transaction parameters when starting a verification. */ psd2Enabled?: boolean; /** Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` */ doNotShareWarningEnabled?: boolean; /** Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. */ customCodeEnabled?: boolean; /** Optional configuration for the Push factors. If true, include the date in the Challenge\\\'s response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. This timestamp value is the same one as the one found in `date_created`, please use that one instead. */ "push.includeDate"?: boolean; /** Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) */ "push.apnCredentialSid"?: string; /** Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) */ "push.fcmCredentialSid"?: string; /** Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI. Defaults to the service friendly name if not provided. */ "totp.issuer"?: string; /** Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds */ "totp.timeStep"?: number; /** Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 */ "totp.codeLength"?: number; /** Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 */ "totp.skew"?: number; /** The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. */ defaultTemplateSid?: string; /** The SID of the Messaging Service containing WhatsApp Sender(s) that Verify will use to send WhatsApp messages to your users. */ "whatsapp.msgServiceSid"?: string; /** The number to use as the WhatsApp Sender that Verify will use to send WhatsApp messages to your users.This WhatsApp Sender must be associated with a Messaging Service SID. */ "whatsapp.from"?: string; /** Whether to allow verifications from the service to reach the stream-events sinks if configured */ verifyEventSubscriptionEnabled?: boolean; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { accessTokens: AccessTokenListInstance; entities: EntityListInstance; messagingConfigurations: MessagingConfigurationListInstance; rateLimits: RateLimitListInstance; verifications: VerificationListInstance; verificationChecks: VerificationCheckListInstance; webhooks: WebhookListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V2; protected _solution: ServiceContextSolution; protected _uri: string; protected _accessTokens?: AccessTokenListInstance; protected _entities?: EntityListInstance; protected _messagingConfigurations?: MessagingConfigurationListInstance; protected _rateLimits?: RateLimitListInstance; protected _verifications?: VerificationListInstance; protected _verificationChecks?: VerificationCheckListInstance; protected _webhooks?: WebhookListInstance; constructor(_version: V2, sid: string); get accessTokens(): AccessTokenListInstance; get entities(): EntityListInstance; get messagingConfigurations(): MessagingConfigurationListInstance; get rateLimits(): RateLimitListInstance; get verifications(): VerificationListInstance; get verificationChecks(): VerificationCheckListInstance; get webhooks(): WebhookListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; code_length: number; lookup_enabled: boolean; psd2_enabled: boolean; skip_sms_to_landlines: boolean; dtmf_input_required: boolean; tts_name: string; do_not_share_warning_enabled: boolean; custom_code_enabled: boolean; push: any; totp: any; default_template_sid: string; whatsapp: any; verify_event_subscription_enabled: boolean; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ServiceInstance { protected _version: V2; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V2, payload: ServiceResource, sid?: string); /** * The unique string that we created to identify the Service resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. */ accountSid: string; /** * The name that appears in the body of your verification messages. It can be up to 30 characters long and can include letters, numbers, spaces, dashes, underscores. Phone numbers, special characters or links are NOT allowed. **This value should not contain PII.** */ friendlyName: string; /** * The length of the verification code to generate. */ codeLength: number; /** * Whether to perform a lookup with each verification started and return info about the phone number. */ lookupEnabled: boolean; /** * Whether to pass PSD2 transaction parameters when starting a verification. */ psd2Enabled: boolean; /** * Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. */ skipSmsToLandlines: boolean; /** * Whether to ask the user to press a number before delivering the verify code in a phone call. */ dtmfInputRequired: boolean; /** * The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. */ ttsName: string; /** * Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` */ doNotShareWarningEnabled: boolean; /** * Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. */ customCodeEnabled: boolean; /** * Configurations for the Push factors (channel) created under this Service. */ push: any; /** * Configurations for the TOTP factors (channel) created under this Service. */ totp: any; defaultTemplateSid: string; whatsapp: any; /** * Whether to allow verifications from the service to reach the stream-events sinks if configured */ verifyEventSubscriptionEnabled: boolean; /** * 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 absolute URL of the resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the accessTokens. */ accessTokens(): AccessTokenListInstance; /** * Access the entities. */ entities(): EntityListInstance; /** * Access the messagingConfigurations. */ messagingConfigurations(): MessagingConfigurationListInstance; /** * Access the rateLimits. */ rateLimits(): RateLimitListInstance; /** * Access the verifications. */ verifications(): VerificationListInstance; /** * Access the verificationChecks. */ verificationChecks(): VerificationCheckListInstance; /** * Access the webhooks. */ webhooks(): WebhookListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; codeLength: number; lookupEnabled: boolean; psd2Enabled: boolean; skipSmsToLandlines: boolean; dtmfInputRequired: boolean; ttsName: string; doNotShareWarningEnabled: boolean; customCodeEnabled: boolean; push: any; totp: any; defaultTemplateSid: string; whatsapp: any; verifyEventSubscriptionEnabled: boolean; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V2; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V2): ServiceListInstance; export declare class ServicePage extends Page<V2, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service.js000064400000043453151677225100011371 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const accessToken_1 = require("./service/accessToken"); const entity_1 = require("./service/entity"); const messagingConfiguration_1 = require("./service/messagingConfiguration"); const rateLimit_1 = require("./service/rateLimit"); const verification_1 = require("./service/verification"); const verificationCheck_1 = require("./service/verificationCheck"); const webhook_1 = require("./service/webhook"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get accessTokens() { this._accessTokens = this._accessTokens || (0, accessToken_1.AccessTokenListInstance)(this._version, this._solution.sid); return this._accessTokens; } get entities() { this._entities = this._entities || (0, entity_1.EntityListInstance)(this._version, this._solution.sid); return this._entities; } get messagingConfigurations() { this._messagingConfigurations = this._messagingConfigurations || (0, messagingConfiguration_1.MessagingConfigurationListInstance)(this._version, this._solution.sid); return this._messagingConfigurations; } get rateLimits() { this._rateLimits = this._rateLimits || (0, rateLimit_1.RateLimitListInstance)(this._version, this._solution.sid); return this._rateLimits; } get verifications() { this._verifications = this._verifications || (0, verification_1.VerificationListInstance)(this._version, this._solution.sid); return this._verifications; } get verificationChecks() { this._verificationChecks = this._verificationChecks || (0, verificationCheck_1.VerificationCheckListInstance)(this._version, this._solution.sid); return this._verificationChecks; } get webhooks() { this._webhooks = this._webhooks || (0, webhook_1.WebhookListInstance)(this._version, this._solution.sid); return this._webhooks; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["codeLength"] !== undefined) data["CodeLength"] = params["codeLength"]; if (params["lookupEnabled"] !== undefined) data["LookupEnabled"] = serialize.bool(params["lookupEnabled"]); if (params["skipSmsToLandlines"] !== undefined) data["SkipSmsToLandlines"] = serialize.bool(params["skipSmsToLandlines"]); if (params["dtmfInputRequired"] !== undefined) data["DtmfInputRequired"] = serialize.bool(params["dtmfInputRequired"]); if (params["ttsName"] !== undefined) data["TtsName"] = params["ttsName"]; if (params["psd2Enabled"] !== undefined) data["Psd2Enabled"] = serialize.bool(params["psd2Enabled"]); if (params["doNotShareWarningEnabled"] !== undefined) data["DoNotShareWarningEnabled"] = serialize.bool(params["doNotShareWarningEnabled"]); if (params["customCodeEnabled"] !== undefined) data["CustomCodeEnabled"] = serialize.bool(params["customCodeEnabled"]); if (params["push.includeDate"] !== undefined) data["Push.IncludeDate"] = serialize.bool(params["push.includeDate"]); if (params["push.apnCredentialSid"] !== undefined) data["Push.ApnCredentialSid"] = params["push.apnCredentialSid"]; if (params["push.fcmCredentialSid"] !== undefined) data["Push.FcmCredentialSid"] = params["push.fcmCredentialSid"]; if (params["totp.issuer"] !== undefined) data["Totp.Issuer"] = params["totp.issuer"]; if (params["totp.timeStep"] !== undefined) data["Totp.TimeStep"] = params["totp.timeStep"]; if (params["totp.codeLength"] !== undefined) data["Totp.CodeLength"] = params["totp.codeLength"]; if (params["totp.skew"] !== undefined) data["Totp.Skew"] = params["totp.skew"]; if (params["defaultTemplateSid"] !== undefined) data["DefaultTemplateSid"] = params["defaultTemplateSid"]; if (params["whatsapp.msgServiceSid"] !== undefined) data["Whatsapp.MsgServiceSid"] = params["whatsapp.msgServiceSid"]; if (params["whatsapp.from"] !== undefined) data["Whatsapp.From"] = params["whatsapp.from"]; if (params["verifyEventSubscriptionEnabled"] !== undefined) data["VerifyEventSubscriptionEnabled"] = serialize.bool(params["verifyEventSubscriptionEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.codeLength = deserialize.integer(payload.code_length); this.lookupEnabled = payload.lookup_enabled; this.psd2Enabled = payload.psd2_enabled; this.skipSmsToLandlines = payload.skip_sms_to_landlines; this.dtmfInputRequired = payload.dtmf_input_required; this.ttsName = payload.tts_name; this.doNotShareWarningEnabled = payload.do_not_share_warning_enabled; this.customCodeEnabled = payload.custom_code_enabled; this.push = payload.push; this.totp = payload.totp; this.defaultTemplateSid = payload.default_template_sid; this.whatsapp = payload.whatsapp; this.verifyEventSubscriptionEnabled = payload.verify_event_subscription_enabled; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the accessTokens. */ accessTokens() { return this._proxy.accessTokens; } /** * Access the entities. */ entities() { return this._proxy.entities; } /** * Access the messagingConfigurations. */ messagingConfigurations() { return this._proxy.messagingConfigurations; } /** * Access the rateLimits. */ rateLimits() { return this._proxy.rateLimits; } /** * Access the verifications. */ verifications() { return this._proxy.verifications; } /** * Access the verificationChecks. */ verificationChecks() { return this._proxy.verificationChecks; } /** * Access the webhooks. */ webhooks() { return this._proxy.webhooks; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, codeLength: this.codeLength, lookupEnabled: this.lookupEnabled, psd2Enabled: this.psd2Enabled, skipSmsToLandlines: this.skipSmsToLandlines, dtmfInputRequired: this.dtmfInputRequired, ttsName: this.ttsName, doNotShareWarningEnabled: this.doNotShareWarningEnabled, customCodeEnabled: this.customCodeEnabled, push: this.push, totp: this.totp, defaultTemplateSid: this.defaultTemplateSid, whatsapp: this.whatsapp, verifyEventSubscriptionEnabled: this.verifyEventSubscriptionEnabled, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["codeLength"] !== undefined) data["CodeLength"] = params["codeLength"]; if (params["lookupEnabled"] !== undefined) data["LookupEnabled"] = serialize.bool(params["lookupEnabled"]); if (params["skipSmsToLandlines"] !== undefined) data["SkipSmsToLandlines"] = serialize.bool(params["skipSmsToLandlines"]); if (params["dtmfInputRequired"] !== undefined) data["DtmfInputRequired"] = serialize.bool(params["dtmfInputRequired"]); if (params["ttsName"] !== undefined) data["TtsName"] = params["ttsName"]; if (params["psd2Enabled"] !== undefined) data["Psd2Enabled"] = serialize.bool(params["psd2Enabled"]); if (params["doNotShareWarningEnabled"] !== undefined) data["DoNotShareWarningEnabled"] = serialize.bool(params["doNotShareWarningEnabled"]); if (params["customCodeEnabled"] !== undefined) data["CustomCodeEnabled"] = serialize.bool(params["customCodeEnabled"]); if (params["push.includeDate"] !== undefined) data["Push.IncludeDate"] = serialize.bool(params["push.includeDate"]); if (params["push.apnCredentialSid"] !== undefined) data["Push.ApnCredentialSid"] = params["push.apnCredentialSid"]; if (params["push.fcmCredentialSid"] !== undefined) data["Push.FcmCredentialSid"] = params["push.fcmCredentialSid"]; if (params["totp.issuer"] !== undefined) data["Totp.Issuer"] = params["totp.issuer"]; if (params["totp.timeStep"] !== undefined) data["Totp.TimeStep"] = params["totp.timeStep"]; if (params["totp.codeLength"] !== undefined) data["Totp.CodeLength"] = params["totp.codeLength"]; if (params["totp.skew"] !== undefined) data["Totp.Skew"] = params["totp.skew"]; if (params["defaultTemplateSid"] !== undefined) data["DefaultTemplateSid"] = params["defaultTemplateSid"]; if (params["whatsapp.msgServiceSid"] !== undefined) data["Whatsapp.MsgServiceSid"] = params["whatsapp.msgServiceSid"]; if (params["whatsapp.from"] !== undefined) data["Whatsapp.From"] = params["whatsapp.from"]; if (params["verifyEventSubscriptionEnabled"] !== undefined) data["VerifyEventSubscriptionEnabled"] = serialize.bool(params["verifyEventSubscriptionEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/verify/v2/verificationAttemptsSummary.d.ts000064400000014044151677225100015741 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; export type VerificationAttemptsSummaryChannels = "sms" | "call" | "email" | "whatsapp"; /** * Options to pass to fetch a VerificationAttemptsSummaryInstance */ export interface VerificationAttemptsSummaryContextFetchOptions { /** Filter used to consider only Verification Attempts of the given verify service on the summary aggregation. */ verifyServiceSid?: string; /** Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd\'T\'HH:mm:ss\'Z. */ dateCreatedAfter?: Date; /** Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd\'T\'HH:mm:ss\'Z. */ dateCreatedBefore?: Date; /** Filter used to consider only Verification Attempts sent to the specified destination country on the summary aggregation. */ country?: string; /** Filter Verification Attempts considered on the summary aggregation by communication channel. Valid values are `SMS`, `CALL` and `WHATSAPP` */ channel?: VerificationAttemptsSummaryChannels; /** Filter the Verification Attempts considered on the summary aggregation by Destination prefix. It is the prefix of a phone number in E.164 format. */ destinationPrefix?: string; } export interface VerificationAttemptsSummaryContext { /** * Fetch a VerificationAttemptsSummaryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationAttemptsSummaryInstance */ fetch(callback?: (error: Error | null, item?: VerificationAttemptsSummaryInstance) => any): Promise<VerificationAttemptsSummaryInstance>; /** * Fetch a VerificationAttemptsSummaryInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationAttemptsSummaryInstance */ fetch(params: VerificationAttemptsSummaryContextFetchOptions, callback?: (error: Error | null, item?: VerificationAttemptsSummaryInstance) => any): Promise<VerificationAttemptsSummaryInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface VerificationAttemptsSummaryContextSolution { } export declare class VerificationAttemptsSummaryContextImpl implements VerificationAttemptsSummaryContext { protected _version: V2; protected _solution: VerificationAttemptsSummaryContextSolution; protected _uri: string; constructor(_version: V2); fetch(params?: VerificationAttemptsSummaryContextFetchOptions | ((error: Error | null, item?: VerificationAttemptsSummaryInstance) => any), callback?: (error: Error | null, item?: VerificationAttemptsSummaryInstance) => any): Promise<VerificationAttemptsSummaryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): VerificationAttemptsSummaryContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface VerificationAttemptsSummaryResource { total_attempts: number; total_converted: number; total_unconverted: number; conversion_rate_percentage: number; url: string; } export declare class VerificationAttemptsSummaryInstance { protected _version: V2; protected _solution: VerificationAttemptsSummaryContextSolution; protected _context?: VerificationAttemptsSummaryContext; constructor(_version: V2, payload: VerificationAttemptsSummaryResource); /** * Total of attempts made according to the provided filters */ totalAttempts: number; /** * Total of attempts made that were confirmed by the end user, according to the provided filters. */ totalConverted: number; /** * Total of attempts made that were not confirmed by the end user, according to the provided filters. */ totalUnconverted: number; /** * Percentage of the confirmed messages over the total, defined by (total_converted/total_attempts)*100. */ conversionRatePercentage: number; url: string; private get _proxy(); /** * Fetch a VerificationAttemptsSummaryInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationAttemptsSummaryInstance */ fetch(callback?: (error: Error | null, item?: VerificationAttemptsSummaryInstance) => any): Promise<VerificationAttemptsSummaryInstance>; /** * Fetch a VerificationAttemptsSummaryInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationAttemptsSummaryInstance */ fetch(params: VerificationAttemptsSummaryContextFetchOptions, callback?: (error: Error | null, item?: VerificationAttemptsSummaryInstance) => any): Promise<VerificationAttemptsSummaryInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { totalAttempts: number; totalConverted: number; totalUnconverted: number; conversionRatePercentage: number; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface VerificationAttemptsSummarySolution { } export interface VerificationAttemptsSummaryListInstance { _version: V2; _solution: VerificationAttemptsSummarySolution; _uri: string; (): VerificationAttemptsSummaryContext; get(): VerificationAttemptsSummaryContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function VerificationAttemptsSummaryListInstance(version: V2): VerificationAttemptsSummaryListInstance; export {}; rest/verify/v2/safelist.js000064400000012405151677225100011534 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.SafelistListInstance = exports.SafelistInstance = exports.SafelistContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class SafelistContextImpl { constructor(_version, phoneNumber) { this._version = _version; if (!(0, utility_1.isValidPathParam)(phoneNumber)) { throw new Error("Parameter 'phoneNumber' is not valid."); } this._solution = { phoneNumber }; this._uri = `/SafeList/Numbers/${phoneNumber}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SafelistInstance(operationVersion, payload, instance._solution.phoneNumber)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SafelistContextImpl = SafelistContextImpl; class SafelistInstance { constructor(_version, payload, phoneNumber) { this._version = _version; this.sid = payload.sid; this.phoneNumber = payload.phone_number; this.url = payload.url; this._solution = { phoneNumber: phoneNumber || this.phoneNumber }; } get _proxy() { this._context = this._context || new SafelistContextImpl(this._version, this._solution.phoneNumber); return this._context; } /** * Remove a SafelistInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SafelistInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SafelistInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, phoneNumber: this.phoneNumber, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SafelistInstance = SafelistInstance; function SafelistListInstance(version) { const instance = ((phoneNumber) => instance.get(phoneNumber)); instance.get = function get(phoneNumber) { return new SafelistContextImpl(version, phoneNumber); }; 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"; 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.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; } exports.SafelistListInstance = SafelistListInstance; rest/verify/v2/template.js000064400000011066151677225100011537 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.TemplatePage = exports.TemplateInstance = exports.TemplateListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function TemplateListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Templates`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TemplatePage(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 TemplatePage(instance._version, payload, 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; } exports.TemplateListInstance = TemplateListInstance; class TemplateInstance { constructor(_version, payload) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.channels = payload.channels; this.translations = payload.translations; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, channels: this.channels, translations: this.translations, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TemplateInstance = TemplateInstance; class TemplatePage extends Page_1.default { /** * Initialize the TemplatePage * * @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 TemplateInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TemplateInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TemplatePage = TemplatePage; rest/verify/v2/form.js000064400000007220151677225100010664 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.FormListInstance = exports.FormInstance = exports.FormContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class FormContextImpl { constructor(_version, formType) { this._version = _version; if (!(0, utility_1.isValidPathParam)(formType)) { throw new Error("Parameter 'formType' is not valid."); } this._solution = { formType }; this._uri = `/Forms/${formType}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FormInstance(operationVersion, payload, instance._solution.formType)); 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.FormContextImpl = FormContextImpl; class FormInstance { constructor(_version, payload, formType) { this._version = _version; this.formType = payload.form_type; this.forms = payload.forms; this.formMeta = payload.form_meta; this.url = payload.url; this._solution = { formType: formType || this.formType }; } get _proxy() { this._context = this._context || new FormContextImpl(this._version, this._solution.formType); return this._context; } /** * Fetch a FormInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FormInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { formType: this.formType, forms: this.forms, formMeta: this.formMeta, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FormInstance = FormInstance; function FormListInstance(version) { const instance = ((formType) => instance.get(formType)); instance.get = function get(formType) { return new FormContextImpl(version, formType); }; 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; } exports.FormListInstance = FormListInstance; rest/verify/v2/service/rateLimit.d.ts000064400000027724151677225100013562 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; import { BucketListInstance } from "./rateLimit/bucket"; /** * Options to pass to update a RateLimitInstance */ export interface RateLimitContextUpdateOptions { /** Description of this Rate Limit */ description?: string; } /** * Options to pass to create a RateLimitInstance */ export interface RateLimitListInstanceCreateOptions { /** Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.** */ uniqueName: string; /** Description of this Rate Limit */ description?: string; } /** * Options to pass to each */ export interface RateLimitListInstanceEachOptions { /** 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: RateLimitInstance, 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 RateLimitListInstanceOptions { /** 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 RateLimitListInstancePageOptions { /** 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 RateLimitContext { buckets: BucketListInstance; /** * Remove a RateLimitInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RateLimitInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RateLimitInstance */ fetch(callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>; /** * Update a RateLimitInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RateLimitInstance */ update(callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>; /** * Update a RateLimitInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RateLimitInstance */ update(params: RateLimitContextUpdateOptions, callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RateLimitContextSolution { serviceSid: string; sid: string; } export declare class RateLimitContextImpl implements RateLimitContext { protected _version: V2; protected _solution: RateLimitContextSolution; protected _uri: string; protected _buckets?: BucketListInstance; constructor(_version: V2, serviceSid: string, sid: string); get buckets(): BucketListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>; update(params?: RateLimitContextUpdateOptions | ((error: Error | null, item?: RateLimitInstance) => any), callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RateLimitContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RateLimitPayload extends TwilioResponsePayload { rate_limits: RateLimitResource[]; } interface RateLimitResource { sid: string; service_sid: string; account_sid: string; unique_name: string; description: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class RateLimitInstance { protected _version: V2; protected _solution: RateLimitContextSolution; protected _context?: RateLimitContext; constructor(_version: V2, payload: RateLimitResource, serviceSid: string, sid?: string); /** * A 34 character string that uniquely identifies this Rate Limit. */ sid: string; /** * The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. */ serviceSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. */ accountSid: string; /** * Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.** */ uniqueName: string; /** * Description of this Rate Limit */ description: 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 URL of this resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a RateLimitInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RateLimitInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RateLimitInstance */ fetch(callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>; /** * Update a RateLimitInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RateLimitInstance */ update(callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>; /** * Update a RateLimitInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RateLimitInstance */ update(params: RateLimitContextUpdateOptions, callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>; /** * Access the buckets. */ buckets(): BucketListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; serviceSid: string; accountSid: string; uniqueName: string; description: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RateLimitSolution { serviceSid: string; } export interface RateLimitListInstance { _version: V2; _solution: RateLimitSolution; _uri: string; (sid: string): RateLimitContext; get(sid: string): RateLimitContext; /** * Create a RateLimitInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RateLimitInstance */ create(params: RateLimitListInstanceCreateOptions, callback?: (error: Error | null, item?: RateLimitInstance) => any): Promise<RateLimitInstance>; /** * Streams RateLimitInstance 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 { RateLimitListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RateLimitInstance, done: (err?: Error) => void) => void): void; each(params: RateLimitListInstanceEachOptions, callback?: (item: RateLimitInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RateLimitInstance 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: RateLimitPage) => any): Promise<RateLimitPage>; /** * Lists RateLimitInstance 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 { RateLimitListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RateLimitInstance[]) => any): Promise<RateLimitInstance[]>; list(params: RateLimitListInstanceOptions, callback?: (error: Error | null, items: RateLimitInstance[]) => any): Promise<RateLimitInstance[]>; /** * Retrieve a single page of RateLimitInstance 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 { RateLimitListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RateLimitPage) => any): Promise<RateLimitPage>; page(params: RateLimitListInstancePageOptions, callback?: (error: Error | null, items: RateLimitPage) => any): Promise<RateLimitPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RateLimitListInstance(version: V2, serviceSid: string): RateLimitListInstance; export declare class RateLimitPage extends Page<V2, RateLimitPayload, RateLimitResource, RateLimitInstance> { /** * Initialize the RateLimitPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: RateLimitSolution); /** * Build an instance of RateLimitInstance * * @param payload - Payload response from the API */ getInstance(payload: RateLimitResource): RateLimitInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/accessToken.d.ts000064400000012156151677225100014063 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../V2"; export type AccessTokenFactorTypes = "push"; /** * Options to pass to create a AccessTokenInstance */ export interface AccessTokenListInstanceCreateOptions { /** The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, and generated by your external system, such as your user\\\'s UUID, GUID, or SID. */ identity: string; /** */ factorType: AccessTokenFactorTypes; /** The friendly name of the factor that is going to be created with this access token */ factorFriendlyName?: string; /** How long, in seconds, the access token is valid. Can be an integer between 60 and 300. Default is 60. */ ttl?: number; } export interface AccessTokenContext { /** * Fetch a AccessTokenInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccessTokenInstance */ fetch(callback?: (error: Error | null, item?: AccessTokenInstance) => any): Promise<AccessTokenInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AccessTokenContextSolution { serviceSid: string; sid: string; } export declare class AccessTokenContextImpl implements AccessTokenContext { protected _version: V2; protected _solution: AccessTokenContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, sid: string); fetch(callback?: (error: Error | null, item?: AccessTokenInstance) => any): Promise<AccessTokenInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AccessTokenContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AccessTokenResource { sid: string; account_sid: string; service_sid: string; entity_identity: string; factor_type: AccessTokenFactorTypes; factor_friendly_name: string; token: string; url: string; ttl: number; date_created: Date; } export declare class AccessTokenInstance { protected _version: V2; protected _solution: AccessTokenContextSolution; protected _context?: AccessTokenContext; constructor(_version: V2, payload: AccessTokenResource, serviceSid: string, sid?: string); /** * A 34 character string that uniquely identifies this Access Token. */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * The unique SID identifier of the Verify Service. */ serviceSid: string; /** * The unique external identifier for the Entity of the Service. */ entityIdentity: string; factorType: AccessTokenFactorTypes; /** * A human readable description of this factor, up to 64 characters. For a push factor, this can be the device\'s name. */ factorFriendlyName: string; /** * The access token generated for enrollment, this is an encrypted json web token. */ token: string; /** * The URL of this resource. */ url: string; /** * How long, in seconds, the access token is valid. Max: 5 minutes */ ttl: number; /** * The date that this access token was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; private get _proxy(); /** * Fetch a AccessTokenInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccessTokenInstance */ fetch(callback?: (error: Error | null, item?: AccessTokenInstance) => any): Promise<AccessTokenInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; entityIdentity: string; factorType: "push"; factorFriendlyName: string; token: string; url: string; ttl: number; dateCreated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AccessTokenSolution { serviceSid: string; } export interface AccessTokenListInstance { _version: V2; _solution: AccessTokenSolution; _uri: string; (sid: string): AccessTokenContext; get(sid: string): AccessTokenContext; /** * Create a AccessTokenInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AccessTokenInstance */ create(params: AccessTokenListInstanceCreateOptions, callback?: (error: Error | null, item?: AccessTokenInstance) => any): Promise<AccessTokenInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AccessTokenListInstance(version: V2, serviceSid: string): AccessTokenListInstance; export {}; rest/verify/v2/service/accessToken.js000064400000014222151677225100013623 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.AccessTokenListInstance = exports.AccessTokenInstance = exports.AccessTokenContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class AccessTokenContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/AccessTokens/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AccessTokenInstance(operationVersion, payload, instance._solution.serviceSid, 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.AccessTokenContextImpl = AccessTokenContextImpl; class AccessTokenInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.entityIdentity = payload.entity_identity; this.factorType = payload.factor_type; this.factorFriendlyName = payload.factor_friendly_name; this.token = payload.token; this.url = payload.url; this.ttl = deserialize.integer(payload.ttl); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AccessTokenContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Fetch a AccessTokenInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AccessTokenInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, entityIdentity: this.entityIdentity, factorType: this.factorType, factorFriendlyName: this.factorFriendlyName, token: this.token, url: this.url, ttl: this.ttl, dateCreated: this.dateCreated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AccessTokenInstance = AccessTokenInstance; function AccessTokenListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AccessTokenContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/AccessTokens`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } if (params["factorType"] === null || params["factorType"] === undefined) { throw new Error("Required parameter \"params['factorType']\" missing."); } let data = {}; data["Identity"] = params["identity"]; data["FactorType"] = params["factorType"]; if (params["factorFriendlyName"] !== undefined) data["FactorFriendlyName"] = params["factorFriendlyName"]; if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AccessTokenInstance(operationVersion, payload, instance._solution.serviceSid)); 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; } exports.AccessTokenListInstance = AccessTokenListInstance; rest/verify/v2/service/entity.js000064400000023265151677225100012704 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.EntityPage = exports.EntityListInstance = exports.EntityInstance = exports.EntityContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const challenge_1 = require("./entity/challenge"); const factor_1 = require("./entity/factor"); const newFactor_1 = require("./entity/newFactor"); class EntityContextImpl { constructor(_version, serviceSid, identity) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } this._solution = { serviceSid, identity }; this._uri = `/Services/${serviceSid}/Entities/${identity}`; } get challenges() { this._challenges = this._challenges || (0, challenge_1.ChallengeListInstance)(this._version, this._solution.serviceSid, this._solution.identity); return this._challenges; } get factors() { this._factors = this._factors || (0, factor_1.FactorListInstance)(this._version, this._solution.serviceSid, this._solution.identity); return this._factors; } get newFactors() { this._newFactors = this._newFactors || (0, newFactor_1.NewFactorListInstance)(this._version, this._solution.serviceSid, this._solution.identity); return this._newFactors; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EntityInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.identity)); 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.EntityContextImpl = EntityContextImpl; class EntityInstance { constructor(_version, payload, serviceSid, identity) { this._version = _version; this.sid = payload.sid; this.identity = payload.identity; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, identity: identity || this.identity }; } get _proxy() { this._context = this._context || new EntityContextImpl(this._version, this._solution.serviceSid, this._solution.identity); return this._context; } /** * Remove a EntityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a EntityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EntityInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the challenges. */ challenges() { return this._proxy.challenges; } /** * Access the factors. */ factors() { return this._proxy.factors; } /** * Access the newFactors. */ newFactors() { return this._proxy.newFactors; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, identity: this.identity, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EntityInstance = EntityInstance; function EntityListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((identity) => instance.get(identity)); instance.get = function get(identity) { return new EntityContextImpl(version, serviceSid, identity); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Entities`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } let data = {}; data["Identity"] = params["identity"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new EntityInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EntityPage(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 EntityPage(instance._version, payload, 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; } exports.EntityListInstance = EntityListInstance; class EntityPage extends Page_1.default { /** * Initialize the EntityPage * * @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 EntityInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EntityInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EntityPage = EntityPage; rest/verify/v2/service/verification.js000064400000021653151677225100014051 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.VerificationListInstance = exports.VerificationInstance = exports.VerificationContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class VerificationContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Verifications/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new VerificationInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["status"] === null || params["status"] === undefined) { throw new Error("Required parameter \"params['status']\" missing."); } let data = {}; data["Status"] = params["status"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new VerificationInstance(operationVersion, payload, instance._solution.serviceSid, 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.VerificationContextImpl = VerificationContextImpl; class VerificationInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.serviceSid = payload.service_sid; this.accountSid = payload.account_sid; this.to = payload.to; this.channel = payload.channel; this.status = payload.status; this.valid = payload.valid; this.lookup = payload.lookup; this.amount = payload.amount; this.payee = payload.payee; this.sendCodeAttempts = payload.send_code_attempts; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.sna = payload.sna; this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new VerificationContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Fetch a VerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, serviceSid: this.serviceSid, accountSid: this.accountSid, to: this.to, channel: this.channel, status: this.status, valid: this.valid, lookup: this.lookup, amount: this.amount, payee: this.payee, sendCodeAttempts: this.sendCodeAttempts, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, sna: this.sna, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.VerificationInstance = VerificationInstance; function VerificationListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new VerificationContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Verifications`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["to"] === null || params["to"] === undefined) { throw new Error("Required parameter \"params['to']\" missing."); } if (params["channel"] === null || params["channel"] === undefined) { throw new Error("Required parameter \"params['channel']\" missing."); } let data = {}; data["To"] = params["to"]; data["Channel"] = params["channel"]; if (params["customFriendlyName"] !== undefined) data["CustomFriendlyName"] = params["customFriendlyName"]; if (params["customMessage"] !== undefined) data["CustomMessage"] = params["customMessage"]; if (params["sendDigits"] !== undefined) data["SendDigits"] = params["sendDigits"]; if (params["locale"] !== undefined) data["Locale"] = params["locale"]; if (params["customCode"] !== undefined) data["CustomCode"] = params["customCode"]; if (params["amount"] !== undefined) data["Amount"] = params["amount"]; if (params["payee"] !== undefined) data["Payee"] = params["payee"]; if (params["rateLimits"] !== undefined) data["RateLimits"] = serialize.object(params["rateLimits"]); if (params["channelConfiguration"] !== undefined) data["ChannelConfiguration"] = serialize.object(params["channelConfiguration"]); if (params["appHash"] !== undefined) data["AppHash"] = params["appHash"]; if (params["templateSid"] !== undefined) data["TemplateSid"] = params["templateSid"]; if (params["templateCustomSubstitutions"] !== undefined) data["TemplateCustomSubstitutions"] = params["templateCustomSubstitutions"]; if (params["deviceIp"] !== undefined) data["DeviceIp"] = params["deviceIp"]; if (params["riskCheck"] !== undefined) data["RiskCheck"] = params["riskCheck"]; if (params["tags"] !== undefined) data["Tags"] = params["tags"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new VerificationInstance(operationVersion, payload, instance._solution.serviceSid)); 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; } exports.VerificationListInstance = VerificationListInstance; rest/verify/v2/service/messagingConfiguration.d.ts000064400000030621151677225100016323 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; /** * Options to pass to update a MessagingConfigurationInstance */ export interface MessagingConfigurationContextUpdateOptions { /** The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration. */ messagingServiceSid: string; } /** * Options to pass to create a MessagingConfigurationInstance */ export interface MessagingConfigurationListInstanceCreateOptions { /** The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value `all`. */ country: string; /** The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration. */ messagingServiceSid: string; } /** * Options to pass to each */ export interface MessagingConfigurationListInstanceEachOptions { /** 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: MessagingConfigurationInstance, 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 MessagingConfigurationListInstanceOptions { /** 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 MessagingConfigurationListInstancePageOptions { /** 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 MessagingConfigurationContext { /** * Remove a MessagingConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessagingConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessagingConfigurationInstance */ fetch(callback?: (error: Error | null, item?: MessagingConfigurationInstance) => any): Promise<MessagingConfigurationInstance>; /** * Update a MessagingConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessagingConfigurationInstance */ update(params: MessagingConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: MessagingConfigurationInstance) => any): Promise<MessagingConfigurationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MessagingConfigurationContextSolution { serviceSid: string; country: string; } export declare class MessagingConfigurationContextImpl implements MessagingConfigurationContext { protected _version: V2; protected _solution: MessagingConfigurationContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, country: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: MessagingConfigurationInstance) => any): Promise<MessagingConfigurationInstance>; update(params: MessagingConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: MessagingConfigurationInstance) => any): Promise<MessagingConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MessagingConfigurationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MessagingConfigurationPayload extends TwilioResponsePayload { messaging_configurations: MessagingConfigurationResource[]; } interface MessagingConfigurationResource { account_sid: string; service_sid: string; country: string; messaging_service_sid: string; date_created: Date; date_updated: Date; url: string; } export declare class MessagingConfigurationInstance { protected _version: V2; protected _solution: MessagingConfigurationContextSolution; protected _context?: MessagingConfigurationContext; constructor(_version: V2, payload: MessagingConfigurationResource, serviceSid: string, country?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/verify/api/service) that the resource is associated with. */ serviceSid: string; /** * The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value `all`. */ country: string; /** * The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration. */ messagingServiceSid: 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 URL of this resource. */ url: string; private get _proxy(); /** * Remove a MessagingConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a MessagingConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessagingConfigurationInstance */ fetch(callback?: (error: Error | null, item?: MessagingConfigurationInstance) => any): Promise<MessagingConfigurationInstance>; /** * Update a MessagingConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessagingConfigurationInstance */ update(params: MessagingConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: MessagingConfigurationInstance) => any): Promise<MessagingConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; country: string; messagingServiceSid: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MessagingConfigurationSolution { serviceSid: string; } export interface MessagingConfigurationListInstance { _version: V2; _solution: MessagingConfigurationSolution; _uri: string; (country: string): MessagingConfigurationContext; get(country: string): MessagingConfigurationContext; /** * Create a MessagingConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MessagingConfigurationInstance */ create(params: MessagingConfigurationListInstanceCreateOptions, callback?: (error: Error | null, item?: MessagingConfigurationInstance) => any): Promise<MessagingConfigurationInstance>; /** * Streams MessagingConfigurationInstance 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 { MessagingConfigurationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: MessagingConfigurationInstance, done: (err?: Error) => void) => void): void; each(params: MessagingConfigurationListInstanceEachOptions, callback?: (item: MessagingConfigurationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of MessagingConfigurationInstance 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: MessagingConfigurationPage) => any): Promise<MessagingConfigurationPage>; /** * Lists MessagingConfigurationInstance 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 { MessagingConfigurationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: MessagingConfigurationInstance[]) => any): Promise<MessagingConfigurationInstance[]>; list(params: MessagingConfigurationListInstanceOptions, callback?: (error: Error | null, items: MessagingConfigurationInstance[]) => any): Promise<MessagingConfigurationInstance[]>; /** * Retrieve a single page of MessagingConfigurationInstance 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 { MessagingConfigurationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: MessagingConfigurationPage) => any): Promise<MessagingConfigurationPage>; page(params: MessagingConfigurationListInstancePageOptions, callback?: (error: Error | null, items: MessagingConfigurationPage) => any): Promise<MessagingConfigurationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MessagingConfigurationListInstance(version: V2, serviceSid: string): MessagingConfigurationListInstance; export declare class MessagingConfigurationPage extends Page<V2, MessagingConfigurationPayload, MessagingConfigurationResource, MessagingConfigurationInstance> { /** * Initialize the MessagingConfigurationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: MessagingConfigurationSolution); /** * Build an instance of MessagingConfigurationInstance * * @param payload - Payload response from the API */ getInstance(payload: MessagingConfigurationResource): MessagingConfigurationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/entity.d.ts000064400000025024151677225100013133 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; import { ChallengeListInstance } from "./entity/challenge"; import { FactorListInstance } from "./entity/factor"; import { NewFactorListInstance } from "./entity/newFactor"; /** * Options to pass to create a EntityInstance */ export interface EntityListInstanceCreateOptions { /** The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user\\\'s UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. */ identity: string; } /** * Options to pass to each */ export interface EntityListInstanceEachOptions { /** 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: EntityInstance, 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 EntityListInstanceOptions { /** 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 EntityListInstancePageOptions { /** 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 EntityContext { challenges: ChallengeListInstance; factors: FactorListInstance; newFactors: NewFactorListInstance; /** * Remove a EntityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EntityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EntityInstance */ fetch(callback?: (error: Error | null, item?: EntityInstance) => any): Promise<EntityInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EntityContextSolution { serviceSid: string; identity: string; } export declare class EntityContextImpl implements EntityContext { protected _version: V2; protected _solution: EntityContextSolution; protected _uri: string; protected _challenges?: ChallengeListInstance; protected _factors?: FactorListInstance; protected _newFactors?: NewFactorListInstance; constructor(_version: V2, serviceSid: string, identity: string); get challenges(): ChallengeListInstance; get factors(): FactorListInstance; get newFactors(): NewFactorListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: EntityInstance) => any): Promise<EntityInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EntityContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EntityPayload extends TwilioResponsePayload { entities: EntityResource[]; } interface EntityResource { sid: string; identity: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class EntityInstance { protected _version: V2; protected _solution: EntityContextSolution; protected _context?: EntityContext; constructor(_version: V2, payload: EntityResource, serviceSid: string, identity?: string); /** * A 34 character string that uniquely identifies this Entity. */ sid: string; /** * The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user\'s UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. */ identity: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * The unique SID identifier of the Service. */ serviceSid: string; /** * The date that this Entity was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date that this Entity was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The URL of this resource. */ url: string; /** * Contains a dictionary of URL links to nested resources of this Entity. */ links: Record<string, string>; private get _proxy(); /** * Remove a EntityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EntityInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EntityInstance */ fetch(callback?: (error: Error | null, item?: EntityInstance) => any): Promise<EntityInstance>; /** * Access the challenges. */ challenges(): ChallengeListInstance; /** * Access the factors. */ factors(): FactorListInstance; /** * Access the newFactors. */ newFactors(): NewFactorListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; identity: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EntitySolution { serviceSid: string; } export interface EntityListInstance { _version: V2; _solution: EntitySolution; _uri: string; (identity: string): EntityContext; get(identity: string): EntityContext; /** * Create a EntityInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EntityInstance */ create(params: EntityListInstanceCreateOptions, callback?: (error: Error | null, item?: EntityInstance) => any): Promise<EntityInstance>; /** * Streams EntityInstance 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 { EntityListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EntityInstance, done: (err?: Error) => void) => void): void; each(params: EntityListInstanceEachOptions, callback?: (item: EntityInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EntityInstance 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: EntityPage) => any): Promise<EntityPage>; /** * Lists EntityInstance 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 { EntityListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EntityInstance[]) => any): Promise<EntityInstance[]>; list(params: EntityListInstanceOptions, callback?: (error: Error | null, items: EntityInstance[]) => any): Promise<EntityInstance[]>; /** * Retrieve a single page of EntityInstance 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 { EntityListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EntityPage) => any): Promise<EntityPage>; page(params: EntityListInstancePageOptions, callback?: (error: Error | null, items: EntityPage) => any): Promise<EntityPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EntityListInstance(version: V2, serviceSid: string): EntityListInstance; export declare class EntityPage extends Page<V2, EntityPayload, EntityResource, EntityInstance> { /** * Initialize the EntityPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: EntitySolution); /** * Build an instance of EntityInstance * * @param payload - Payload response from the API */ getInstance(payload: EntityResource): EntityInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/verification.d.ts000064400000024757151677225100014315 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../V2"; export type VerificationChannel = "sms" | "call" | "email" | "whatsapp" | "sna"; export type VerificationRiskCheck = "enable" | "disable"; export type VerificationStatus = "canceled" | "approved"; /** * Options to pass to update a VerificationInstance */ export interface VerificationContextUpdateOptions { /** */ status: VerificationStatus; } /** * Options to pass to create a VerificationInstance */ export interface VerificationListInstanceCreateOptions { /** The phone number or [email](https://www.twilio.com/docs/verify/email) to verify. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). */ to: string; /** The verification method to use. One of: [`email`](https://www.twilio.com/docs/verify/email), `sms`, `whatsapp`, `call`, `sna` or `auto`. */ channel: string; /** A custom user defined friendly name that overwrites the existing one in the verification message */ customFriendlyName?: string; /** The text of a custom message to use for the verification. */ customMessage?: string; /** The digits to send after a phone call is answered, for example, to dial an extension. For more information, see the Programmable Voice documentation of [sendDigits](https://www.twilio.com/docs/voice/twiml/number#attributes-sendDigits). */ sendDigits?: string; /** Locale will automatically resolve based on phone number country code for SMS, WhatsApp, and call channel verifications. It will fallback to English or the template’s default translation if the selected translation is not available. This parameter will override the automatic locale resolution. [See supported languages and more information here](https://www.twilio.com/docs/verify/supported-languages). */ locale?: string; /** A pre-generated code to use for verification. The code can be between 4 and 10 characters, inclusive. */ customCode?: string; /** The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. */ amount?: string; /** The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. */ payee?: string; /** The custom key-value pairs of Programmable Rate Limits. Keys correspond to `unique_name` fields defined when [creating your Rate Limit](https://www.twilio.com/docs/verify/api/service-rate-limits). Associated value pairs represent values in the request that you are rate limiting on. You may include multiple Rate Limit values in each request. */ rateLimits?: any; /** [`email`](https://www.twilio.com/docs/verify/email) channel configuration in json format. The fields \\\'from\\\' and \\\'from_name\\\' are optional but if included the \\\'from\\\' field must have a valid email address. */ channelConfiguration?: any; /** Your [App Hash](https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string) to be appended at the end of your verification SMS body. Applies only to SMS. Example SMS body: `<#> Your AppName verification code is: 1234 He42w354ol9`. */ appHash?: string; /** The message [template](https://www.twilio.com/docs/verify/api/templates). If provided, will override the default template for the Service. SMS and Voice channels only. */ templateSid?: string; /** A stringified JSON object in which the keys are the template\\\'s special variables and the values are the variables substitutions. */ templateCustomSubstitutions?: string; /** Strongly encouraged if using the auto channel. The IP address of the client\\\'s device. If provided, it has to be a valid IPv4 or IPv6 address. */ deviceIp?: string; /** */ riskCheck?: VerificationRiskCheck; /** A string containing a JSON map of key value pairs of tags to be recorded as metadata for the message. The object may contain up to 10 tags. Keys and values can each be up to 128 characters in length. */ tags?: string; } export interface VerificationContext { /** * Fetch a VerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationInstance */ fetch(callback?: (error: Error | null, item?: VerificationInstance) => any): Promise<VerificationInstance>; /** * Update a VerificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationInstance */ update(params: VerificationContextUpdateOptions, callback?: (error: Error | null, item?: VerificationInstance) => any): Promise<VerificationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface VerificationContextSolution { serviceSid: string; sid: string; } export declare class VerificationContextImpl implements VerificationContext { protected _version: V2; protected _solution: VerificationContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, sid: string); fetch(callback?: (error: Error | null, item?: VerificationInstance) => any): Promise<VerificationInstance>; update(params: VerificationContextUpdateOptions, callback?: (error: Error | null, item?: VerificationInstance) => any): Promise<VerificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): VerificationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface VerificationResource { sid: string; service_sid: string; account_sid: string; to: string; channel: VerificationChannel; status: string; valid: boolean; lookup: any; amount: string; payee: string; send_code_attempts: Array<any>; date_created: Date; date_updated: Date; sna: any; url: string; } export declare class VerificationInstance { protected _version: V2; protected _solution: VerificationContextSolution; protected _context?: VerificationContext; constructor(_version: V2, payload: VerificationResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Verification resource. */ sid: string; /** * The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. */ serviceSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. */ accountSid: string; /** * The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). */ to: string; channel: VerificationChannel; /** * The status of the verification. Can be: `pending`, `approved`, `canceled`, `max_attempts_reached`, `deleted`, `failed` or `expired`. */ status: string; /** * Use \"status\" instead. Legacy property indicating whether the verification was successful. */ valid: boolean; /** * Information about the phone number being verified. */ lookup: any; /** * The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. */ amount: string; /** * The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. */ payee: string; /** * An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID. */ sendCodeAttempts: Array<any>; /** * 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 set of fields used for a silent network auth (`sna`) verification. Contains a single field with the URL to be invoked to verify the phone number. */ sna: any; /** * The absolute URL of the Verification resource. */ url: string; private get _proxy(); /** * Fetch a VerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationInstance */ fetch(callback?: (error: Error | null, item?: VerificationInstance) => any): Promise<VerificationInstance>; /** * Update a VerificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationInstance */ update(params: VerificationContextUpdateOptions, callback?: (error: Error | null, item?: VerificationInstance) => any): Promise<VerificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; serviceSid: string; accountSid: string; to: string; channel: VerificationChannel; status: string; valid: boolean; lookup: any; amount: string; payee: string; sendCodeAttempts: any[]; dateCreated: Date; dateUpdated: Date; sna: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface VerificationSolution { serviceSid: string; } export interface VerificationListInstance { _version: V2; _solution: VerificationSolution; _uri: string; (sid: string): VerificationContext; get(sid: string): VerificationContext; /** * Create a VerificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationInstance */ create(params: VerificationListInstanceCreateOptions, callback?: (error: Error | null, item?: VerificationInstance) => any): Promise<VerificationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function VerificationListInstance(version: V2, serviceSid: string): VerificationListInstance; export {}; rest/verify/v2/service/rateLimit.js000064400000024214151677225100013315 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.RateLimitPage = exports.RateLimitListInstance = exports.RateLimitInstance = exports.RateLimitContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const bucket_1 = require("./rateLimit/bucket"); class RateLimitContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/RateLimits/${sid}`; } get buckets() { this._buckets = this._buckets || (0, bucket_1.BucketListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._buckets; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RateLimitInstance(operationVersion, payload, instance._solution.serviceSid, 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["description"] !== undefined) data["Description"] = params["description"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RateLimitInstance(operationVersion, payload, instance._solution.serviceSid, 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.RateLimitContextImpl = RateLimitContextImpl; class RateLimitInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.serviceSid = payload.service_sid; this.accountSid = payload.account_sid; this.uniqueName = payload.unique_name; this.description = payload.description; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RateLimitContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a RateLimitInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RateLimitInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RateLimitInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the buckets. */ buckets() { return this._proxy.buckets; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, serviceSid: this.serviceSid, accountSid: this.accountSid, uniqueName: this.uniqueName, description: this.description, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RateLimitInstance = RateLimitInstance; function RateLimitListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RateLimitContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/RateLimits`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["uniqueName"] === null || params["uniqueName"] === undefined) { throw new Error("Required parameter \"params['uniqueName']\" missing."); } let data = {}; data["UniqueName"] = params["uniqueName"]; if (params["description"] !== undefined) data["Description"] = params["description"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RateLimitInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RateLimitPage(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 RateLimitPage(instance._version, payload, 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; } exports.RateLimitListInstance = RateLimitListInstance; class RateLimitPage extends Page_1.default { /** * Initialize the RateLimitPage * * @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 RateLimitInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RateLimitInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RateLimitPage = RateLimitPage; rest/verify/v2/service/entity/challenge.js000064400000027622151677225100014627 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.ChallengePage = exports.ChallengeListInstance = exports.ChallengeInstance = exports.ChallengeContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const notification_1 = require("./challenge/notification"); class ChallengeContextImpl { constructor(_version, serviceSid, identity, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, identity, sid }; this._uri = `/Services/${serviceSid}/Entities/${identity}/Challenges/${sid}`; } get notifications() { this._notifications = this._notifications || (0, notification_1.NotificationListInstance)(this._version, this._solution.serviceSid, this._solution.identity, this._solution.sid); return this._notifications; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ChallengeInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.identity, 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["authPayload"] !== undefined) data["AuthPayload"] = params["authPayload"]; if (params["metadata"] !== undefined) data["Metadata"] = serialize.object(params["metadata"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChallengeInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.identity, 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.ChallengeContextImpl = ChallengeContextImpl; class ChallengeInstance { constructor(_version, payload, serviceSid, identity, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.entitySid = payload.entity_sid; this.identity = payload.identity; this.factorSid = payload.factor_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.dateResponded = deserialize.iso8601DateTime(payload.date_responded); this.expirationDate = deserialize.iso8601DateTime(payload.expiration_date); this.status = payload.status; this.respondedReason = payload.responded_reason; this.details = payload.details; this.hiddenDetails = payload.hidden_details; this.metadata = payload.metadata; this.factorType = payload.factor_type; this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, identity, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ChallengeContextImpl(this._version, this._solution.serviceSid, this._solution.identity, this._solution.sid); return this._context; } /** * Fetch a ChallengeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChallengeInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the notifications. */ notifications() { return this._proxy.notifications; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, entitySid: this.entitySid, identity: this.identity, factorSid: this.factorSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, dateResponded: this.dateResponded, expirationDate: this.expirationDate, status: this.status, respondedReason: this.respondedReason, details: this.details, hiddenDetails: this.hiddenDetails, metadata: this.metadata, factorType: this.factorType, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChallengeInstance = ChallengeInstance; function ChallengeListInstance(version, serviceSid, identity) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ChallengeContextImpl(version, serviceSid, identity, sid); }; instance._version = version; instance._solution = { serviceSid, identity }; instance._uri = `/Services/${serviceSid}/Entities/${identity}/Challenges`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["factorSid"] === null || params["factorSid"] === undefined) { throw new Error("Required parameter \"params['factorSid']\" missing."); } let data = {}; data["FactorSid"] = params["factorSid"]; if (params["expirationDate"] !== undefined) data["ExpirationDate"] = serialize.iso8601DateTime(params["expirationDate"]); if (params["details.message"] !== undefined) data["Details.Message"] = params["details.message"]; if (params["details.fields"] !== undefined) data["Details.Fields"] = serialize.map(params["details.fields"], (e) => serialize.object(e)); if (params["hiddenDetails"] !== undefined) data["HiddenDetails"] = serialize.object(params["hiddenDetails"]); if (params["authPayload"] !== undefined) data["AuthPayload"] = params["authPayload"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ChallengeInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.identity)); 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["factorSid"] !== undefined) data["FactorSid"] = params["factorSid"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["order"] !== undefined) data["Order"] = params["order"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ChallengePage(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 ChallengePage(instance._version, payload, 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; } exports.ChallengeListInstance = ChallengeListInstance; class ChallengePage extends Page_1.default { /** * Initialize the ChallengePage * * @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 ChallengeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ChallengeInstance(this._version, payload, this._solution.serviceSid, this._solution.identity); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChallengePage = ChallengePage; rest/verify/v2/service/entity/challenge/notification.js000064400000007747151677225100017323 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.NotificationInstance = exports.NotificationListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); function NotificationListInstance(version, serviceSid, identity, challengeSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } if (!(0, utility_1.isValidPathParam)(challengeSid)) { throw new Error("Parameter 'challengeSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { serviceSid, identity, challengeSid }; instance._uri = `/Services/${serviceSid}/Entities/${identity}/Challenges/${challengeSid}/Notifications`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new NotificationInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.identity, instance._solution.challengeSid)); 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; } exports.NotificationListInstance = NotificationListInstance; class NotificationInstance { constructor(_version, payload, serviceSid, identity, challengeSid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.entitySid = payload.entity_sid; this.identity = payload.identity; this.challengeSid = payload.challenge_sid; this.priority = payload.priority; this.ttl = deserialize.integer(payload.ttl); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, entitySid: this.entitySid, identity: this.identity, challengeSid: this.challengeSid, priority: this.priority, ttl: this.ttl, dateCreated: this.dateCreated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NotificationInstance = NotificationInstance; rest/verify/v2/service/entity/challenge/notification.d.ts000064400000007467151677225100017556 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../../../V2"; /** * Options to pass to create a NotificationInstance */ export interface NotificationListInstanceCreateOptions { /** How long, in seconds, the notification is valid. Can be an integer between 0 and 300. Default is 300. Delivery is attempted until the TTL elapses, even if the device is offline. 0 means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. */ ttl?: number; } export interface NotificationSolution { serviceSid: string; identity: string; challengeSid: string; } export interface NotificationListInstance { _version: V2; _solution: NotificationSolution; _uri: string; /** * Create a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ create(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Create a NotificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ create(params: NotificationListInstanceCreateOptions, callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NotificationListInstance(version: V2, serviceSid: string, identity: string, challengeSid: string): NotificationListInstance; interface NotificationResource { sid: string; account_sid: string; service_sid: string; entity_sid: string; identity: string; challenge_sid: string; priority: string; ttl: number; date_created: Date; } export declare class NotificationInstance { protected _version: V2; constructor(_version: V2, payload: NotificationResource, serviceSid: string, identity: string, challengeSid: string); /** * A 34 character string that uniquely identifies this Notification. */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * The unique SID identifier of the Service. */ serviceSid: string; /** * The unique SID identifier of the Entity. */ entitySid: string; /** * Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user\'s UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. */ identity: string; /** * The unique SID identifier of the Challenge. */ challengeSid: string; /** * The priority of the notification. For `push` Challenges it\'s always `high` which sends the notification immediately, and can wake up a sleeping device. */ priority: string; /** * How long, in seconds, the notification is valid. Max: 5 minutes */ ttl: number; /** * The date that this Notification was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; entitySid: string; identity: string; challengeSid: string; priority: string; ttl: number; dateCreated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/entity/factor.d.ts000064400000031615151677225100014414 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; export type FactorFactorStatuses = "unverified" | "verified"; export type FactorFactorTypes = "push" | "totp"; export type FactorTotpAlgorithms = "sha1" | "sha256" | "sha512"; /** * Options to pass to update a FactorInstance */ export interface FactorContextUpdateOptions { /** The optional payload needed to verify the Factor for the first time. E.g. for a TOTP, the numeric code. */ authPayload?: string; /** The new friendly name of this Factor. It can be up to 64 characters. */ friendlyName?: string; /** For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Required when `factor_type` is `push`. If specified, this value must be between 32 and 255 characters long. */ "config.notificationToken"?: string; /** The Verify Push SDK version used to configure the factor */ "config.sdkVersion"?: string; /** Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive */ "config.timeStep"?: number; /** The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive */ "config.skew"?: number; /** Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive */ "config.codeLength"?: number; /** */ "config.alg"?: FactorTotpAlgorithms; /** The transport technology used to generate the Notification Token. Can be `apn`, `fcm` or `none`. Required when `factor_type` is `push`. */ "config.notificationPlatform"?: string; } /** * Options to pass to each */ export interface FactorListInstanceEachOptions { /** 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: FactorInstance, 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 FactorListInstanceOptions { /** 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 FactorListInstancePageOptions { /** 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 FactorContext { /** * Remove a FactorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FactorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FactorInstance */ fetch(callback?: (error: Error | null, item?: FactorInstance) => any): Promise<FactorInstance>; /** * Update a FactorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FactorInstance */ update(callback?: (error: Error | null, item?: FactorInstance) => any): Promise<FactorInstance>; /** * Update a FactorInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FactorInstance */ update(params: FactorContextUpdateOptions, callback?: (error: Error | null, item?: FactorInstance) => any): Promise<FactorInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FactorContextSolution { serviceSid: string; identity: string; sid: string; } export declare class FactorContextImpl implements FactorContext { protected _version: V2; protected _solution: FactorContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, identity: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: FactorInstance) => any): Promise<FactorInstance>; update(params?: FactorContextUpdateOptions | ((error: Error | null, item?: FactorInstance) => any), callback?: (error: Error | null, item?: FactorInstance) => any): Promise<FactorInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FactorContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FactorPayload extends TwilioResponsePayload { factors: FactorResource[]; } interface FactorResource { sid: string; account_sid: string; service_sid: string; entity_sid: string; identity: string; date_created: Date; date_updated: Date; friendly_name: string; status: FactorFactorStatuses; factor_type: FactorFactorTypes; config: any; metadata: any; url: string; } export declare class FactorInstance { protected _version: V2; protected _solution: FactorContextSolution; protected _context?: FactorContext; constructor(_version: V2, payload: FactorResource, serviceSid: string, identity: string, sid?: string); /** * A 34 character string that uniquely identifies this Factor. */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * The unique SID identifier of the Service. */ serviceSid: string; /** * The unique SID identifier of the Entity. */ entitySid: string; /** * Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user\'s UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. */ identity: string; /** * The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * A human readable description of this resource, up to 64 characters. For a push factor, this can be the device\'s name. */ friendlyName: string; status: FactorFactorStatuses; factorType: FactorFactorTypes; /** * An object that contains configurations specific to a `factor_type`. */ config: any; /** * Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. */ metadata: any; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Remove a FactorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FactorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FactorInstance */ fetch(callback?: (error: Error | null, item?: FactorInstance) => any): Promise<FactorInstance>; /** * Update a FactorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FactorInstance */ update(callback?: (error: Error | null, item?: FactorInstance) => any): Promise<FactorInstance>; /** * Update a FactorInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FactorInstance */ update(params: FactorContextUpdateOptions, callback?: (error: Error | null, item?: FactorInstance) => any): Promise<FactorInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; entitySid: string; identity: string; dateCreated: Date; dateUpdated: Date; friendlyName: string; status: FactorFactorStatuses; factorType: FactorFactorTypes; config: any; metadata: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FactorSolution { serviceSid: string; identity: string; } export interface FactorListInstance { _version: V2; _solution: FactorSolution; _uri: string; (sid: string): FactorContext; get(sid: string): FactorContext; /** * Streams FactorInstance 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 { FactorListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: FactorInstance, done: (err?: Error) => void) => void): void; each(params: FactorListInstanceEachOptions, callback?: (item: FactorInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of FactorInstance 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: FactorPage) => any): Promise<FactorPage>; /** * Lists FactorInstance 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 { FactorListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: FactorInstance[]) => any): Promise<FactorInstance[]>; list(params: FactorListInstanceOptions, callback?: (error: Error | null, items: FactorInstance[]) => any): Promise<FactorInstance[]>; /** * Retrieve a single page of FactorInstance 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 { FactorListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: FactorPage) => any): Promise<FactorPage>; page(params: FactorListInstancePageOptions, callback?: (error: Error | null, items: FactorPage) => any): Promise<FactorPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FactorListInstance(version: V2, serviceSid: string, identity: string): FactorListInstance; export declare class FactorPage extends Page<V2, FactorPayload, FactorResource, FactorInstance> { /** * Initialize the FactorPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: FactorSolution); /** * Build an instance of FactorInstance * * @param payload - Payload response from the API */ getInstance(payload: FactorResource): FactorInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/entity/factor.js000064400000024561151677225100014162 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.FactorPage = exports.FactorListInstance = exports.FactorInstance = exports.FactorContextImpl = void 0; 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 FactorContextImpl { constructor(_version, serviceSid, identity, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, identity, sid }; this._uri = `/Services/${serviceSid}/Entities/${identity}/Factors/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FactorInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.identity, 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["authPayload"] !== undefined) data["AuthPayload"] = params["authPayload"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["config.notificationToken"] !== undefined) data["Config.NotificationToken"] = params["config.notificationToken"]; if (params["config.sdkVersion"] !== undefined) data["Config.SdkVersion"] = params["config.sdkVersion"]; if (params["config.timeStep"] !== undefined) data["Config.TimeStep"] = params["config.timeStep"]; if (params["config.skew"] !== undefined) data["Config.Skew"] = params["config.skew"]; if (params["config.codeLength"] !== undefined) data["Config.CodeLength"] = params["config.codeLength"]; if (params["config.alg"] !== undefined) data["Config.Alg"] = params["config.alg"]; if (params["config.notificationPlatform"] !== undefined) data["Config.NotificationPlatform"] = params["config.notificationPlatform"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FactorInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.identity, 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.FactorContextImpl = FactorContextImpl; class FactorInstance { constructor(_version, payload, serviceSid, identity, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.entitySid = payload.entity_sid; this.identity = payload.identity; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.status = payload.status; this.factorType = payload.factor_type; this.config = payload.config; this.metadata = payload.metadata; this.url = payload.url; this._solution = { serviceSid, identity, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new FactorContextImpl(this._version, this._solution.serviceSid, this._solution.identity, this._solution.sid); return this._context; } /** * Remove a FactorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a FactorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FactorInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, entitySid: this.entitySid, identity: this.identity, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, status: this.status, factorType: this.factorType, config: this.config, metadata: this.metadata, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FactorInstance = FactorInstance; function FactorListInstance(version, serviceSid, identity) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new FactorContextImpl(version, serviceSid, identity, sid); }; instance._version = version; instance._solution = { serviceSid, identity }; instance._uri = `/Services/${serviceSid}/Entities/${identity}/Factors`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new FactorPage(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 FactorPage(instance._version, payload, 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; } exports.FactorListInstance = FactorListInstance; class FactorPage extends Page_1.default { /** * Initialize the FactorPage * * @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 FactorInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new FactorInstance(this._version, payload, this._solution.serviceSid, this._solution.identity); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FactorPage = FactorPage; rest/verify/v2/service/entity/challenge.d.ts000064400000040475151677225100015064 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; import { NotificationListInstance } from "./challenge/notification"; export type ChallengeChallengeReasons = "none" | "not_needed" | "not_requested"; export type ChallengeChallengeStatuses = "pending" | "expired" | "approved" | "denied"; export type ChallengeFactorTypes = "push" | "totp"; export type ChallengeListOrders = "asc" | "desc"; /** * Options to pass to update a ChallengeInstance */ export interface ChallengeContextUpdateOptions { /** The optional payload needed to verify the Challenge. E.g., a TOTP would use the numeric code. For `TOTP` this value must be between 3 and 8 characters long. For `Push` this value can be up to 5456 characters in length */ authPayload?: string; /** Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\\\"os\\\": \\\"Android\\\"}`. Can be up to 1024 characters in length. */ metadata?: any; } /** * Options to pass to create a ChallengeInstance */ export interface ChallengeListInstanceCreateOptions { /** The unique SID identifier of the Factor. */ factorSid: string; /** The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. */ expirationDate?: Date; /** Shown to the user when the push notification arrives. Required when `factor_type` is `push`. Can be up to 256 characters in length */ "details.message"?: string; /** A list of objects that describe the Fields included in the Challenge. Each object contains the label and value of the field, the label can be up to 36 characters in length and the value can be up to 128 characters in length. Used when `factor_type` is `push`. There can be up to 20 details fields. */ "details.fields"?: Array<any>; /** Details provided to give context about the Challenge. Not shown to the end user. It must be a stringified JSON with only strings values eg. `{\\\"ip\\\": \\\"172.168.1.234\\\"}`. Can be up to 1024 characters in length */ hiddenDetails?: any; /** Optional payload used to verify the Challenge upon creation. Only used with a Factor of type `totp` to carry the TOTP code that needs to be verified. For `TOTP` this value must be between 3 and 8 characters long. */ authPayload?: string; } /** * Options to pass to each */ export interface ChallengeListInstanceEachOptions { /** The unique SID identifier of the Factor. */ factorSid?: string; /** The Status of the Challenges to fetch. One of `pending`, `expired`, `approved` or `denied`. */ status?: ChallengeChallengeStatuses; /** The desired sort order of the Challenges list. One of `asc` or `desc` for ascending and descending respectively. Defaults to `asc`. */ order?: ChallengeListOrders; /** 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: ChallengeInstance, 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 ChallengeListInstanceOptions { /** The unique SID identifier of the Factor. */ factorSid?: string; /** The Status of the Challenges to fetch. One of `pending`, `expired`, `approved` or `denied`. */ status?: ChallengeChallengeStatuses; /** The desired sort order of the Challenges list. One of `asc` or `desc` for ascending and descending respectively. Defaults to `asc`. */ order?: ChallengeListOrders; /** 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 ChallengeListInstancePageOptions { /** The unique SID identifier of the Factor. */ factorSid?: string; /** The Status of the Challenges to fetch. One of `pending`, `expired`, `approved` or `denied`. */ status?: ChallengeChallengeStatuses; /** The desired sort order of the Challenges list. One of `asc` or `desc` for ascending and descending respectively. Defaults to `asc`. */ order?: ChallengeListOrders; /** 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 ChallengeContext { notifications: NotificationListInstance; /** * Fetch a ChallengeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChallengeInstance */ fetch(callback?: (error: Error | null, item?: ChallengeInstance) => any): Promise<ChallengeInstance>; /** * Update a ChallengeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChallengeInstance */ update(callback?: (error: Error | null, item?: ChallengeInstance) => any): Promise<ChallengeInstance>; /** * Update a ChallengeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChallengeInstance */ update(params: ChallengeContextUpdateOptions, callback?: (error: Error | null, item?: ChallengeInstance) => any): Promise<ChallengeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ChallengeContextSolution { serviceSid: string; identity: string; sid: string; } export declare class ChallengeContextImpl implements ChallengeContext { protected _version: V2; protected _solution: ChallengeContextSolution; protected _uri: string; protected _notifications?: NotificationListInstance; constructor(_version: V2, serviceSid: string, identity: string, sid: string); get notifications(): NotificationListInstance; fetch(callback?: (error: Error | null, item?: ChallengeInstance) => any): Promise<ChallengeInstance>; update(params?: ChallengeContextUpdateOptions | ((error: Error | null, item?: ChallengeInstance) => any), callback?: (error: Error | null, item?: ChallengeInstance) => any): Promise<ChallengeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ChallengeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ChallengePayload extends TwilioResponsePayload { challenges: ChallengeResource[]; } interface ChallengeResource { sid: string; account_sid: string; service_sid: string; entity_sid: string; identity: string; factor_sid: string; date_created: Date; date_updated: Date; date_responded: Date; expiration_date: Date; status: ChallengeChallengeStatuses; responded_reason: ChallengeChallengeReasons; details: any; hidden_details: any; metadata: any; factor_type: ChallengeFactorTypes; url: string; links: Record<string, string>; } export declare class ChallengeInstance { protected _version: V2; protected _solution: ChallengeContextSolution; protected _context?: ChallengeContext; constructor(_version: V2, payload: ChallengeResource, serviceSid: string, identity: string, sid?: string); /** * A 34 character string that uniquely identifies this Challenge. */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * The unique SID identifier of the Service. */ serviceSid: string; /** * The unique SID identifier of the Entity. */ entitySid: string; /** * Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user\'s UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. */ identity: string; /** * The unique SID identifier of the Factor. */ factorSid: string; /** * The date that this Challenge was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date that this Challenge was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The date that this Challenge was responded, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateResponded: Date; /** * The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. */ expirationDate: Date; status: ChallengeChallengeStatuses; respondedReason: ChallengeChallengeReasons; /** * Details provided to give context about the Challenge. Intended to be shown to the end user. */ details: any; /** * Details provided to give context about the Challenge. Intended to be hidden from the end user. It must be a stringified JSON with only strings values eg. `{\"ip\": \"172.168.1.234\"}` */ hiddenDetails: any; /** * Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. */ metadata: any; factorType: ChallengeFactorTypes; /** * The URL of this resource. */ url: string; /** * Contains a dictionary of URL links to nested resources of this Challenge. */ links: Record<string, string>; private get _proxy(); /** * Fetch a ChallengeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChallengeInstance */ fetch(callback?: (error: Error | null, item?: ChallengeInstance) => any): Promise<ChallengeInstance>; /** * Update a ChallengeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChallengeInstance */ update(callback?: (error: Error | null, item?: ChallengeInstance) => any): Promise<ChallengeInstance>; /** * Update a ChallengeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChallengeInstance */ update(params: ChallengeContextUpdateOptions, callback?: (error: Error | null, item?: ChallengeInstance) => any): Promise<ChallengeInstance>; /** * Access the notifications. */ notifications(): NotificationListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; entitySid: string; identity: string; factorSid: string; dateCreated: Date; dateUpdated: Date; dateResponded: Date; expirationDate: Date; status: ChallengeChallengeStatuses; respondedReason: ChallengeChallengeReasons; details: any; hiddenDetails: any; metadata: any; factorType: ChallengeFactorTypes; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ChallengeSolution { serviceSid: string; identity: string; } export interface ChallengeListInstance { _version: V2; _solution: ChallengeSolution; _uri: string; (sid: string): ChallengeContext; get(sid: string): ChallengeContext; /** * Create a ChallengeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ChallengeInstance */ create(params: ChallengeListInstanceCreateOptions, callback?: (error: Error | null, item?: ChallengeInstance) => any): Promise<ChallengeInstance>; /** * Streams ChallengeInstance 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 { ChallengeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ChallengeInstance, done: (err?: Error) => void) => void): void; each(params: ChallengeListInstanceEachOptions, callback?: (item: ChallengeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ChallengeInstance 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: ChallengePage) => any): Promise<ChallengePage>; /** * Lists ChallengeInstance 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 { ChallengeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ChallengeInstance[]) => any): Promise<ChallengeInstance[]>; list(params: ChallengeListInstanceOptions, callback?: (error: Error | null, items: ChallengeInstance[]) => any): Promise<ChallengeInstance[]>; /** * Retrieve a single page of ChallengeInstance 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 { ChallengeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ChallengePage) => any): Promise<ChallengePage>; page(params: ChallengeListInstancePageOptions, callback?: (error: Error | null, items: ChallengePage) => any): Promise<ChallengePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ChallengeListInstance(version: V2, serviceSid: string, identity: string): ChallengeListInstance; export declare class ChallengePage extends Page<V2, ChallengePayload, ChallengeResource, ChallengeInstance> { /** * Initialize the ChallengePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ChallengeSolution); /** * Build an instance of ChallengeInstance * * @param payload - Payload response from the API */ getInstance(payload: ChallengeResource): ChallengeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/entity/newFactor.js000064400000013610151677225100014625 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.NewFactorInstance = exports.NewFactorListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); function NewFactorListInstance(version, serviceSid, identity) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(identity)) { throw new Error("Parameter 'identity' is not valid."); } const instance = {}; instance._version = version; instance._solution = { serviceSid, identity }; instance._uri = `/Services/${serviceSid}/Entities/${identity}/Factors`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["factorType"] === null || params["factorType"] === undefined) { throw new Error("Required parameter \"params['factorType']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["FactorType"] = params["factorType"]; if (params["binding.alg"] !== undefined) data["Binding.Alg"] = params["binding.alg"]; if (params["binding.publicKey"] !== undefined) data["Binding.PublicKey"] = params["binding.publicKey"]; if (params["config.appId"] !== undefined) data["Config.AppId"] = params["config.appId"]; if (params["config.notificationPlatform"] !== undefined) data["Config.NotificationPlatform"] = params["config.notificationPlatform"]; if (params["config.notificationToken"] !== undefined) data["Config.NotificationToken"] = params["config.notificationToken"]; if (params["config.sdkVersion"] !== undefined) data["Config.SdkVersion"] = params["config.sdkVersion"]; if (params["binding.secret"] !== undefined) data["Binding.Secret"] = params["binding.secret"]; if (params["config.timeStep"] !== undefined) data["Config.TimeStep"] = params["config.timeStep"]; if (params["config.skew"] !== undefined) data["Config.Skew"] = params["config.skew"]; if (params["config.codeLength"] !== undefined) data["Config.CodeLength"] = params["config.codeLength"]; if (params["config.alg"] !== undefined) data["Config.Alg"] = params["config.alg"]; if (params["metadata"] !== undefined) data["Metadata"] = serialize.object(params["metadata"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new NewFactorInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.identity)); 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; } exports.NewFactorListInstance = NewFactorListInstance; class NewFactorInstance { constructor(_version, payload, serviceSid, identity) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.entitySid = payload.entity_sid; this.identity = payload.identity; this.binding = payload.binding; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.status = payload.status; this.factorType = payload.factor_type; this.config = payload.config; this.metadata = payload.metadata; this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, entitySid: this.entitySid, identity: this.identity, binding: this.binding, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, status: this.status, factorType: this.factorType, config: this.config, metadata: this.metadata, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NewFactorInstance = NewFactorInstance; rest/verify/v2/service/entity/newFactor.d.ts000064400000017277151677225100015076 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../../V2"; export type NewFactorFactorStatuses = "unverified" | "verified"; export type NewFactorFactorTypes = "push" | "totp"; export type NewFactorNotificationPlatforms = "apn" | "fcm" | "none"; export type NewFactorTotpAlgorithms = "sha1" | "sha256" | "sha512"; /** * Options to pass to create a NewFactorInstance */ export interface NewFactorListInstanceCreateOptions { /** The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors. For `factor_type` `push`, this could be a device name. For `factor_type` `totp`, this value is used as the “account name” in constructing the `binding.uri` property. At the same time, we recommend avoiding providing PII. */ friendlyName: string; /** */ factorType: NewFactorFactorTypes; /** The algorithm used when `factor_type` is `push`. Algorithm supported: `ES256` */ "binding.alg"?: string; /** The Ecdsa public key in PKIX, ASN.1 DER format encoded in Base64. Required when `factor_type` is `push` */ "binding.publicKey"?: string; /** The ID that uniquely identifies your app in the Google or Apple store, such as `com.example.myapp`. It can be up to 100 characters long. Required when `factor_type` is `push`. */ "config.appId"?: string; /** */ "config.notificationPlatform"?: NewFactorNotificationPlatforms; /** For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Must be between 32 and 255 characters long. Required when `factor_type` is `push`. */ "config.notificationToken"?: string; /** The Verify Push SDK version used to configure the factor Required when `factor_type` is `push` */ "config.sdkVersion"?: string; /** The shared secret for TOTP factors encoded in Base32. This can be provided when creating the Factor, otherwise it will be generated. Used when `factor_type` is `totp` */ "binding.secret"?: string; /** Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. The default value is defined at the service level in the property `totp.time_step`. Defaults to 30 seconds if not configured. Used when `factor_type` is `totp` */ "config.timeStep"?: number; /** The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. The default value is defined at the service level in the property `totp.skew`. If not configured defaults to 1. Used when `factor_type` is `totp` */ "config.skew"?: number; /** Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. The default value is defined at the service level in the property `totp.code_length`. If not configured defaults to 6. Used when `factor_type` is `totp` */ "config.codeLength"?: number; /** */ "config.alg"?: NewFactorTotpAlgorithms; /** Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\\\"os\\\": \\\"Android\\\"}`. Can be up to 1024 characters in length. */ metadata?: any; } export interface NewFactorSolution { serviceSid: string; identity: string; } export interface NewFactorListInstance { _version: V2; _solution: NewFactorSolution; _uri: string; /** * Create a NewFactorInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NewFactorInstance */ create(params: NewFactorListInstanceCreateOptions, callback?: (error: Error | null, item?: NewFactorInstance) => any): Promise<NewFactorInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NewFactorListInstance(version: V2, serviceSid: string, identity: string): NewFactorListInstance; interface NewFactorResource { sid: string; account_sid: string; service_sid: string; entity_sid: string; identity: string; binding: any; date_created: Date; date_updated: Date; friendly_name: string; status: NewFactorFactorStatuses; factor_type: NewFactorFactorTypes; config: any; metadata: any; url: string; } export declare class NewFactorInstance { protected _version: V2; constructor(_version: V2, payload: NewFactorResource, serviceSid: string, identity: string); /** * A 34 character string that uniquely identifies this Factor. */ sid: string; /** * The unique SID identifier of the Account. */ accountSid: string; /** * The unique SID identifier of the Service. */ serviceSid: string; /** * The unique SID identifier of the Entity. */ entitySid: string; /** * Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user\'s UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. */ identity: string; /** * Contains the `factor_type` specific secret and metadata. For push, this is `binding.public_key` and `binding.alg`. For totp, this is `binding.secret` and `binding.uri`. The `binding.uri` property is generated following the [google authenticator key URI format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format), and `Factor.friendly_name` is used for the “accountname” value and `Service.friendly_name` or `Service.totp.issuer` is used for the `issuer` value. The Binding property is ONLY returned upon Factor creation. */ binding: any; /** * The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors. For `factor_type` `push`, this could be a device name. For `factor_type` `totp`, this value is used as the “account name” in constructing the `binding.uri` property. At the same time, we recommend avoiding providing PII. */ friendlyName: string; status: NewFactorFactorStatuses; factorType: NewFactorFactorTypes; /** * An object that contains configurations specific to a `factor_type`. */ config: any; /** * Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. */ metadata: any; /** * The URL of this resource. */ url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; entitySid: string; identity: string; binding: any; dateCreated: Date; dateUpdated: Date; friendlyName: string; status: NewFactorFactorStatuses; factorType: NewFactorFactorTypes; config: any; metadata: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/webhook.d.ts000064400000031075151677225100013260 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type WebhookMethods = "GET" | "POST"; export type WebhookStatus = "enabled" | "disabled"; export type WebhookVersion = "v1" | "v2"; /** * Options to pass to update a WebhookInstance */ export interface WebhookContextUpdateOptions { /** The string that you assigned to describe the webhook. **This value should not contain PII.** */ friendlyName?: string; /** The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` */ eventTypes?: Array<string>; /** The URL associated with this Webhook. */ webhookUrl?: string; /** */ status?: WebhookStatus; /** */ version?: WebhookVersion; } /** * Options to pass to create a WebhookInstance */ export interface WebhookListInstanceCreateOptions { /** The string that you assigned to describe the webhook. **This value should not contain PII.** */ friendlyName: string; /** The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` */ eventTypes: Array<string>; /** The URL associated with this Webhook. */ webhookUrl: string; /** */ status?: WebhookStatus; /** */ version?: WebhookVersion; } /** * Options to pass to each */ export interface WebhookListInstanceEachOptions { /** 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: WebhookInstance, 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 WebhookListInstanceOptions { /** 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 WebhookListInstancePageOptions { /** 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 WebhookContext { /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface WebhookContextSolution { serviceSid: string; sid: string; } export declare class WebhookContextImpl implements WebhookContext { protected _version: V2; protected _solution: WebhookContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; update(params?: WebhookContextUpdateOptions | ((error: Error | null, item?: WebhookInstance) => any), callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): WebhookContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface WebhookPayload extends TwilioResponsePayload { webhooks: WebhookResource[]; } interface WebhookResource { sid: string; service_sid: string; account_sid: string; friendly_name: string; event_types: Array<string>; status: WebhookStatus; version: WebhookVersion; webhook_url: string; webhook_method: WebhookMethods; date_created: Date; date_updated: Date; url: string; } export declare class WebhookInstance { protected _version: V2; protected _solution: WebhookContextSolution; protected _context?: WebhookContext; constructor(_version: V2, payload: WebhookResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Webhook resource. */ sid: string; /** * The unique SID identifier of the Service. */ serviceSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. */ accountSid: string; /** * The string that you assigned to describe the webhook. **This value should not contain PII.** */ friendlyName: string; /** * The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` */ eventTypes: Array<string>; status: WebhookStatus; version: WebhookVersion; /** * The URL associated with this Webhook. */ webhookUrl: string; webhookMethod: WebhookMethods; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Webhook resource. */ url: string; private get _proxy(); /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Update a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ update(params: WebhookContextUpdateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; serviceSid: string; accountSid: string; friendlyName: string; eventTypes: string[]; status: WebhookStatus; version: WebhookVersion; webhookUrl: string; webhookMethod: WebhookMethods; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface WebhookSolution { serviceSid: string; } export interface WebhookListInstance { _version: V2; _solution: WebhookSolution; _uri: string; (sid: string): WebhookContext; get(sid: string): WebhookContext; /** * Create a WebhookInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ create(params: WebhookListInstanceCreateOptions, callback?: (error: Error | null, item?: WebhookInstance) => any): Promise<WebhookInstance>; /** * Streams WebhookInstance 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 { WebhookListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; each(params: WebhookListInstanceEachOptions, callback?: (item: WebhookInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of WebhookInstance 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: WebhookPage) => any): Promise<WebhookPage>; /** * Lists WebhookInstance 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 { WebhookListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; list(params: WebhookListInstanceOptions, callback?: (error: Error | null, items: WebhookInstance[]) => any): Promise<WebhookInstance[]>; /** * Retrieve a single page of WebhookInstance 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 { WebhookListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; page(params: WebhookListInstancePageOptions, callback?: (error: Error | null, items: WebhookPage) => any): Promise<WebhookPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function WebhookListInstance(version: V2, serviceSid: string): WebhookListInstance; export declare class WebhookPage extends Page<V2, WebhookPayload, WebhookResource, WebhookInstance> { /** * Initialize the WebhookPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: WebhookSolution); /** * Build an instance of WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload: WebhookResource): WebhookInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/messagingConfiguration.js000064400000024673151677225100016101 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.MessagingConfigurationPage = exports.MessagingConfigurationListInstance = exports.MessagingConfigurationInstance = exports.MessagingConfigurationContextImpl = void 0; 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 MessagingConfigurationContextImpl { constructor(_version, serviceSid, country) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(country)) { throw new Error("Parameter 'country' is not valid."); } this._solution = { serviceSid, country }; this._uri = `/Services/${serviceSid}/MessagingConfigurations/${country}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new MessagingConfigurationInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.country)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["messagingServiceSid"] === null || params["messagingServiceSid"] === undefined) { throw new Error("Required parameter \"params['messagingServiceSid']\" missing."); } let data = {}; data["MessagingServiceSid"] = params["messagingServiceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessagingConfigurationInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.country)); 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.MessagingConfigurationContextImpl = MessagingConfigurationContextImpl; class MessagingConfigurationInstance { constructor(_version, payload, serviceSid, country) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.country = payload.country; this.messagingServiceSid = payload.messaging_service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, country: country || this.country }; } get _proxy() { this._context = this._context || new MessagingConfigurationContextImpl(this._version, this._solution.serviceSid, this._solution.country); return this._context; } /** * Remove a MessagingConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a MessagingConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MessagingConfigurationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, country: this.country, messagingServiceSid: this.messagingServiceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessagingConfigurationInstance = MessagingConfigurationInstance; function MessagingConfigurationListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((country) => instance.get(country)); instance.get = function get(country) { return new MessagingConfigurationContextImpl(version, serviceSid, country); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/MessagingConfigurations`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["country"] === null || params["country"] === undefined) { throw new Error("Required parameter \"params['country']\" missing."); } if (params["messagingServiceSid"] === null || params["messagingServiceSid"] === undefined) { throw new Error("Required parameter \"params['messagingServiceSid']\" missing."); } let data = {}; data["Country"] = params["country"]; data["MessagingServiceSid"] = params["messagingServiceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new MessagingConfigurationInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MessagingConfigurationPage(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 MessagingConfigurationPage(instance._version, payload, 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; } exports.MessagingConfigurationListInstance = MessagingConfigurationListInstance; class MessagingConfigurationPage extends Page_1.default { /** * Initialize the MessagingConfigurationPage * * @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 MessagingConfigurationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new MessagingConfigurationInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MessagingConfigurationPage = MessagingConfigurationPage; rest/verify/v2/service/verificationCheck.js000064400000010300151677225100014772 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.VerificationCheckInstance = exports.VerificationCheckListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function VerificationCheckListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/VerificationCheck`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["code"] !== undefined) data["Code"] = params["code"]; if (params["to"] !== undefined) data["To"] = params["to"]; if (params["verificationSid"] !== undefined) data["VerificationSid"] = params["verificationSid"]; if (params["amount"] !== undefined) data["Amount"] = params["amount"]; if (params["payee"] !== undefined) data["Payee"] = params["payee"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new VerificationCheckInstance(operationVersion, payload, instance._solution.serviceSid)); 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; } exports.VerificationCheckListInstance = VerificationCheckListInstance; class VerificationCheckInstance { constructor(_version, payload, serviceSid) { this._version = _version; this.sid = payload.sid; this.serviceSid = payload.service_sid; this.accountSid = payload.account_sid; this.to = payload.to; this.channel = payload.channel; this.status = payload.status; this.valid = payload.valid; this.amount = payload.amount; this.payee = payload.payee; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.snaAttemptsErrorCodes = payload.sna_attempts_error_codes; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, serviceSid: this.serviceSid, accountSid: this.accountSid, to: this.to, channel: this.channel, status: this.status, valid: this.valid, amount: this.amount, payee: this.payee, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, snaAttemptsErrorCodes: this.snaAttemptsErrorCodes, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.VerificationCheckInstance = VerificationCheckInstance; rest/verify/v2/service/rateLimit/bucket.js000064400000024706151677225100014600 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.BucketPage = exports.BucketListInstance = exports.BucketInstance = exports.BucketContextImpl = void 0; 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 BucketContextImpl { constructor(_version, serviceSid, rateLimitSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(rateLimitSid)) { throw new Error("Parameter 'rateLimitSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, rateLimitSid, sid }; this._uri = `/Services/${serviceSid}/RateLimits/${rateLimitSid}/Buckets/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BucketInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.rateLimitSid, 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["max"] !== undefined) data["Max"] = params["max"]; if (params["interval"] !== undefined) data["Interval"] = params["interval"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BucketInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.rateLimitSid, 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.BucketContextImpl = BucketContextImpl; class BucketInstance { constructor(_version, payload, serviceSid, rateLimitSid, sid) { this._version = _version; this.sid = payload.sid; this.rateLimitSid = payload.rate_limit_sid; this.serviceSid = payload.service_sid; this.accountSid = payload.account_sid; this.max = deserialize.integer(payload.max); this.interval = deserialize.integer(payload.interval); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, rateLimitSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new BucketContextImpl(this._version, this._solution.serviceSid, this._solution.rateLimitSid, this._solution.sid); return this._context; } /** * Remove a BucketInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a BucketInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BucketInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, rateLimitSid: this.rateLimitSid, serviceSid: this.serviceSid, accountSid: this.accountSid, max: this.max, interval: this.interval, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BucketInstance = BucketInstance; function BucketListInstance(version, serviceSid, rateLimitSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(rateLimitSid)) { throw new Error("Parameter 'rateLimitSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new BucketContextImpl(version, serviceSid, rateLimitSid, sid); }; instance._version = version; instance._solution = { serviceSid, rateLimitSid }; instance._uri = `/Services/${serviceSid}/RateLimits/${rateLimitSid}/Buckets`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["max"] === null || params["max"] === undefined) { throw new Error("Required parameter \"params['max']\" missing."); } if (params["interval"] === null || params["interval"] === undefined) { throw new Error("Required parameter \"params['interval']\" missing."); } let data = {}; data["Max"] = params["max"]; data["Interval"] = params["interval"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BucketInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.rateLimitSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BucketPage(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 BucketPage(instance._version, payload, 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; } exports.BucketListInstance = BucketListInstance; class BucketPage extends Page_1.default { /** * Initialize the BucketPage * * @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 BucketInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BucketInstance(this._version, payload, this._solution.serviceSid, this._solution.rateLimitSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BucketPage = BucketPage; rest/verify/v2/service/rateLimit/bucket.d.ts000064400000026723151677225100015035 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V2 from "../../../V2"; /** * Options to pass to update a BucketInstance */ export interface BucketContextUpdateOptions { /** Maximum number of requests permitted in during the interval. */ max?: number; /** Number of seconds that the rate limit will be enforced over. */ interval?: number; } /** * Options to pass to create a BucketInstance */ export interface BucketListInstanceCreateOptions { /** Maximum number of requests permitted in during the interval. */ max: number; /** Number of seconds that the rate limit will be enforced over. */ interval: number; } /** * Options to pass to each */ export interface BucketListInstanceEachOptions { /** 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: BucketInstance, 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 BucketListInstanceOptions { /** 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 BucketListInstancePageOptions { /** 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 BucketContext { /** * Remove a BucketInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BucketInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BucketInstance */ fetch(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>; /** * Update a BucketInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BucketInstance */ update(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>; /** * Update a BucketInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BucketInstance */ update(params: BucketContextUpdateOptions, callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BucketContextSolution { serviceSid: string; rateLimitSid: string; sid: string; } export declare class BucketContextImpl implements BucketContext { protected _version: V2; protected _solution: BucketContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, rateLimitSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>; update(params?: BucketContextUpdateOptions | ((error: Error | null, item?: BucketInstance) => any), callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BucketContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BucketPayload extends TwilioResponsePayload { buckets: BucketResource[]; } interface BucketResource { sid: string; rate_limit_sid: string; service_sid: string; account_sid: string; max: number; interval: number; date_created: Date; date_updated: Date; url: string; } export declare class BucketInstance { protected _version: V2; protected _solution: BucketContextSolution; protected _context?: BucketContext; constructor(_version: V2, payload: BucketResource, serviceSid: string, rateLimitSid: string, sid?: string); /** * A 34 character string that uniquely identifies this Bucket. */ sid: string; /** * The Twilio-provided string that uniquely identifies the Rate Limit resource. */ rateLimitSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. */ serviceSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. */ accountSid: string; /** * Maximum number of requests permitted in during the interval. */ max: number; /** * Number of seconds that the rate limit will be enforced over. */ interval: number; /** * 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 URL of this resource. */ url: string; private get _proxy(); /** * Remove a BucketInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BucketInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BucketInstance */ fetch(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>; /** * Update a BucketInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BucketInstance */ update(callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>; /** * Update a BucketInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BucketInstance */ update(params: BucketContextUpdateOptions, callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; rateLimitSid: string; serviceSid: string; accountSid: string; max: number; interval: number; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BucketSolution { serviceSid: string; rateLimitSid: string; } export interface BucketListInstance { _version: V2; _solution: BucketSolution; _uri: string; (sid: string): BucketContext; get(sid: string): BucketContext; /** * Create a BucketInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BucketInstance */ create(params: BucketListInstanceCreateOptions, callback?: (error: Error | null, item?: BucketInstance) => any): Promise<BucketInstance>; /** * Streams BucketInstance 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 { BucketListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BucketInstance, done: (err?: Error) => void) => void): void; each(params: BucketListInstanceEachOptions, callback?: (item: BucketInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BucketInstance 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: BucketPage) => any): Promise<BucketPage>; /** * Lists BucketInstance 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 { BucketListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BucketInstance[]) => any): Promise<BucketInstance[]>; list(params: BucketListInstanceOptions, callback?: (error: Error | null, items: BucketInstance[]) => any): Promise<BucketInstance[]>; /** * Retrieve a single page of BucketInstance 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 { BucketListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BucketPage) => any): Promise<BucketPage>; page(params: BucketListInstancePageOptions, callback?: (error: Error | null, items: BucketPage) => any): Promise<BucketPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BucketListInstance(version: V2, serviceSid: string, rateLimitSid: string): BucketListInstance; export declare class BucketPage extends Page<V2, BucketPayload, BucketResource, BucketInstance> { /** * Initialize the BucketPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: BucketSolution); /** * Build an instance of BucketInstance * * @param payload - Payload response from the API */ getInstance(payload: BucketResource): BucketInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/verificationCheck.d.ts000064400000012273151677225100015241 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../V2"; export type VerificationCheckChannel = "sms" | "call" | "email" | "whatsapp" | "sna"; /** * Options to pass to create a VerificationCheckInstance */ export interface VerificationCheckListInstanceCreateOptions { /** The 4-10 character string being verified. */ code?: string; /** The phone number or [email](https://www.twilio.com/docs/verify/email) to verify. Either this parameter or the `verification_sid` must be specified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). */ to?: string; /** A SID that uniquely identifies the Verification Check. Either this parameter or the `to` phone number/[email](https://www.twilio.com/docs/verify/email) must be specified. */ verificationSid?: string; /** The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. */ amount?: string; /** The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. */ payee?: string; } export interface VerificationCheckSolution { serviceSid: string; } export interface VerificationCheckListInstance { _version: V2; _solution: VerificationCheckSolution; _uri: string; /** * Create a VerificationCheckInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationCheckInstance */ create(callback?: (error: Error | null, item?: VerificationCheckInstance) => any): Promise<VerificationCheckInstance>; /** * Create a VerificationCheckInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationCheckInstance */ create(params: VerificationCheckListInstanceCreateOptions, callback?: (error: Error | null, item?: VerificationCheckInstance) => any): Promise<VerificationCheckInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function VerificationCheckListInstance(version: V2, serviceSid: string): VerificationCheckListInstance; interface VerificationCheckResource { sid: string; service_sid: string; account_sid: string; to: string; channel: VerificationCheckChannel; status: string; valid: boolean; amount: string; payee: string; date_created: Date; date_updated: Date; sna_attempts_error_codes: Array<any>; } export declare class VerificationCheckInstance { protected _version: V2; constructor(_version: V2, payload: VerificationCheckResource, serviceSid: string); /** * The unique string that we created to identify the VerificationCheck resource. */ sid: string; /** * The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. */ serviceSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the VerificationCheck resource. */ accountSid: string; /** * The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). */ to: string; channel: VerificationCheckChannel; /** * The status of the verification. Can be: `pending`, `approved`, `canceled`, `max_attempts_reached`, `deleted`, `failed` or `expired`. */ status: string; /** * Use \"status\" instead. Legacy property indicating whether the verification was successful. */ valid: boolean; /** * The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. */ amount: string; /** * The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. */ payee: string; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was created. */ dateCreated: Date; /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was last updated. */ dateUpdated: Date; /** * List of error codes as a result of attempting a verification using the `sna` channel. The error codes are chronologically ordered, from the first attempt to the latest attempt. This will be an empty list if no errors occured or `null` if the last channel used wasn\'t `sna`. */ snaAttemptsErrorCodes: Array<any>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; serviceSid: string; accountSid: string; to: string; channel: VerificationCheckChannel; status: string; valid: boolean; amount: string; payee: string; dateCreated: Date; dateUpdated: Date; snaAttemptsErrorCodes: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/verify/v2/service/webhook.js000064400000025727151677225100013033 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.WebhookPage = exports.WebhookListInstance = exports.WebhookInstance = exports.WebhookContextImpl = void 0; 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 WebhookContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Webhooks/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["eventTypes"] !== undefined) data["EventTypes"] = serialize.map(params["eventTypes"], (e) => e); if (params["webhookUrl"] !== undefined) data["WebhookUrl"] = params["webhookUrl"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["version"] !== undefined) data["Version"] = params["version"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.serviceSid, 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.WebhookContextImpl = WebhookContextImpl; class WebhookInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.serviceSid = payload.service_sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.eventTypes = payload.event_types; this.status = payload.status; this.version = payload.version; this.webhookUrl = payload.webhook_url; this.webhookMethod = payload.webhook_method; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new WebhookContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a WebhookInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed WebhookInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, serviceSid: this.serviceSid, accountSid: this.accountSid, friendlyName: this.friendlyName, eventTypes: this.eventTypes, status: this.status, version: this.version, webhookUrl: this.webhookUrl, webhookMethod: this.webhookMethod, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookInstance = WebhookInstance; function WebhookListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new WebhookContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Webhooks`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["eventTypes"] === null || params["eventTypes"] === undefined) { throw new Error("Required parameter \"params['eventTypes']\" missing."); } if (params["webhookUrl"] === null || params["webhookUrl"] === undefined) { throw new Error("Required parameter \"params['webhookUrl']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["EventTypes"] = serialize.map(params["eventTypes"], (e) => e); data["WebhookUrl"] = params["webhookUrl"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["version"] !== undefined) data["Version"] = params["version"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new WebhookPage(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 WebhookPage(instance._version, payload, 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; } exports.WebhookListInstance = WebhookListInstance; class WebhookPage extends Page_1.default { /** * Initialize the WebhookPage * * @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 WebhookInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new WebhookInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.WebhookPage = WebhookPage; rest/verify/v2/safelist.d.ts000064400000007741151677225100011777 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; /** * Options to pass to create a SafelistInstance */ export interface SafelistListInstanceCreateOptions { /** The phone number to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). */ phoneNumber: string; } export interface SafelistContext { /** * 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>; /** * 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>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SafelistContextSolution { phoneNumber: string; } export declare class SafelistContextImpl implements SafelistContext { protected _version: V2; protected _solution: SafelistContextSolution; protected _uri: string; constructor(_version: V2, phoneNumber: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SafelistInstance) => any): Promise<SafelistInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SafelistContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SafelistResource { sid: string; phone_number: string; url: string; } export declare class SafelistInstance { protected _version: V2; protected _solution: SafelistContextSolution; protected _context?: SafelistContext; constructor(_version: V2, payload: SafelistResource, phoneNumber?: string); /** * The unique string that we created to identify the SafeList resource. */ sid: string; /** * The phone number in SafeList. */ phoneNumber: string; /** * The absolute URL of the SafeList resource. */ url: string; private get _proxy(); /** * 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>; /** * 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>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; phoneNumber: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SafelistSolution { } export interface SafelistListInstance { _version: V2; _solution: SafelistSolution; _uri: string; (phoneNumber: string): SafelistContext; get(phoneNumber: string): SafelistContext; /** * 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>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SafelistListInstance(version: V2): SafelistListInstance; export {}; rest/verify/v2/form.d.ts000064400000005700151677225100011121 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; export type FormFormTypes = "form-push"; export interface FormContext { /** * Fetch a FormInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FormInstance */ fetch(callback?: (error: Error | null, item?: FormInstance) => any): Promise<FormInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FormContextSolution { formType: FormFormTypes; } export declare class FormContextImpl implements FormContext { protected _version: V2; protected _solution: FormContextSolution; protected _uri: string; constructor(_version: V2, formType: FormFormTypes); fetch(callback?: (error: Error | null, item?: FormInstance) => any): Promise<FormInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FormContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FormResource { form_type: FormFormTypes; forms: any; form_meta: any; url: string; } export declare class FormInstance { protected _version: V2; protected _solution: FormContextSolution; protected _context?: FormContext; constructor(_version: V2, payload: FormResource, formType?: FormFormTypes); formType: FormFormTypes; /** * Object that contains the available forms for this type. This available forms are given in the standard [JSON Schema](https://json-schema.org/) format */ forms: any; /** * Additional information for the available forms for this type. E.g. The separator string used for `binding` in a Factor push. */ formMeta: any; /** * The URL to access the forms for this type. */ url: string; private get _proxy(); /** * Fetch a FormInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FormInstance */ fetch(callback?: (error: Error | null, item?: FormInstance) => any): Promise<FormInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { formType: "form-push"; forms: any; formMeta: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FormSolution { } export interface FormListInstance { _version: V2; _solution: FormSolution; _uri: string; (formType: FormFormTypes): FormContext; get(formType: FormFormTypes): FormContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FormListInstance(version: V2): FormListInstance; export {}; rest/verify/v2/verificationAttempt.js000064400000017711151677225100013750 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Verify * 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.VerificationAttemptPage = exports.VerificationAttemptListInstance = exports.VerificationAttemptInstance = exports.VerificationAttemptContextImpl = void 0; 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 VerificationAttemptContextImpl { 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 = `/Attempts/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new VerificationAttemptInstance(operationVersion, payload, 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.VerificationAttemptContextImpl = VerificationAttemptContextImpl; class VerificationAttemptInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.verificationSid = payload.verification_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.conversionStatus = payload.conversion_status; this.channel = payload.channel; this.price = payload.price; this.channelData = payload.channel_data; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new VerificationAttemptContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a VerificationAttemptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VerificationAttemptInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, verificationSid: this.verificationSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, conversionStatus: this.conversionStatus, channel: this.channel, price: this.price, channelData: this.channelData, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.VerificationAttemptInstance = VerificationAttemptInstance; function VerificationAttemptListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new VerificationAttemptContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Attempts`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["dateCreatedAfter"] !== undefined) data["DateCreatedAfter"] = serialize.iso8601DateTime(params["dateCreatedAfter"]); if (params["dateCreatedBefore"] !== undefined) data["DateCreatedBefore"] = serialize.iso8601DateTime(params["dateCreatedBefore"]); if (params["channelData.to"] !== undefined) data["ChannelData.To"] = params["channelData.to"]; if (params["country"] !== undefined) data["Country"] = params["country"]; if (params["channel"] !== undefined) data["Channel"] = params["channel"]; if (params["verifyServiceSid"] !== undefined) data["VerifyServiceSid"] = params["verifyServiceSid"]; if (params["verificationSid"] !== undefined) data["VerificationSid"] = params["verificationSid"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new VerificationAttemptPage(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 VerificationAttemptPage(instance._version, payload, 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; } exports.VerificationAttemptListInstance = VerificationAttemptListInstance; class VerificationAttemptPage extends Page_1.default { /** * Initialize the VerificationAttemptPage * * @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 VerificationAttemptInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new VerificationAttemptInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.VerificationAttemptPage = VerificationAttemptPage; rest/Marketplace.js000064400000000470151677225100010316 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const MarketplaceBase_1 = __importDefault(require("./MarketplaceBase")); class Marketplace extends MarketplaceBase_1.default { } module.exports = Marketplace; rest/Events.d.ts000064400000001367151677225100007574 0ustar00import { EventTypeListInstance } from "./events/v1/eventType"; import { SchemaListInstance } from "./events/v1/schema"; import { SinkListInstance } from "./events/v1/sink"; import { SubscriptionListInstance } from "./events/v1/subscription"; import EventsBase from "./EventsBase"; declare class Events extends EventsBase { /** * @deprecated - Use v1.eventTypes instead */ get eventTypes(): EventTypeListInstance; /** * @deprecated - Use v1.schemas instead */ get schemas(): SchemaListInstance; /** * @deprecated - Use v1.sinks instead */ get sinks(): SinkListInstance; /** * @deprecated - Use v1.subscriptions instead */ get subscriptions(): SubscriptionListInstance; } export = Events; rest/PreviewBase.js000064400000003710151677225100010302 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const DeployedDevices_1 = __importDefault(require("./preview/DeployedDevices")); const HostedNumbers_1 = __importDefault(require("./preview/HostedNumbers")); const Sync_1 = __importDefault(require("./preview/Sync")); const Marketplace_1 = __importDefault(require("./preview/Marketplace")); const Wireless_1 = __importDefault(require("./preview/Wireless")); class PreviewBase extends Domain_1.default { /** * Initialize preview domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://preview.twilio.com"); } get deployed_devices() { this._deployed_devices = this._deployed_devices || new DeployedDevices_1.default(this); return this._deployed_devices; } get hosted_numbers() { this._hosted_numbers = this._hosted_numbers || new HostedNumbers_1.default(this); return this._hosted_numbers; } get sync() { this._sync = this._sync || new Sync_1.default(this); return this._sync; } get marketplace() { this._marketplace = this._marketplace || new Marketplace_1.default(this); return this._marketplace; } get wireless() { this._wireless = this._wireless || new Wireless_1.default(this); return this._wireless; } } module.exports = PreviewBase; rest/Oauth.d.ts000064400000000137151677225100007402 0ustar00import OauthBase from "./OauthBase"; declare class Oauth extends OauthBase { } export = Oauth; rest/Lookups.d.ts000064400000000437151677225100007761 0ustar00import { PhoneNumberListInstance } from "./lookups/v1/phoneNumber"; import LookupsBase from "./LookupsBase"; declare class Lookups extends LookupsBase { /** * @deprecated - Use v1.phoneNumbers instead */ get phoneNumbers(): PhoneNumberListInstance; } export = Lookups; rest/Supersim.d.ts000064400000003260151677225100010131 0ustar00import { EsimProfileListInstance } from "./supersim/v1/esimProfile"; import { FleetListInstance } from "./supersim/v1/fleet"; import { IpCommandListInstance } from "./supersim/v1/ipCommand"; import { NetworkListInstance } from "./supersim/v1/network"; import { NetworkAccessProfileListInstance } from "./supersim/v1/networkAccessProfile"; import { SettingsUpdateListInstance } from "./supersim/v1/settingsUpdate"; import { SimListInstance } from "./supersim/v1/sim"; import { SmsCommandListInstance } from "./supersim/v1/smsCommand"; import { UsageRecordListInstance } from "./supersim/v1/usageRecord"; import SupersimBase from "./SupersimBase"; declare class Supersim extends SupersimBase { /** * @deprecated - Use v1.esimProfiles instead */ get esimProfiles(): EsimProfileListInstance; /** * @deprecated - Use v1.fleets instead */ get fleets(): FleetListInstance; /** * @deprecated - Use v1.ipCommands instead */ get ipCommands(): IpCommandListInstance; /** * @deprecated - Use v1.networks instead */ get networks(): NetworkListInstance; /** * @deprecated - Use v1.settingsUpdates instead */ get settingsUpdates(): SettingsUpdateListInstance; /** * @deprecated - Use v1.networkAccessProfiles instead */ get networkAccessProfiles(): NetworkAccessProfileListInstance; /** * @deprecated - Use v1.sims instead */ get sims(): SimListInstance; /** * @deprecated - Use v1.smsCommands instead */ get smsCommands(): SmsCommandListInstance; /** * @deprecated - Use v1.usageRecords instead */ get usageRecords(): UsageRecordListInstance; } export = Supersim; rest/ConversationsBase.js000064400000002103151677225100011511 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./conversations/V1")); class ConversationsBase extends Domain_1.default { /** * Initialize conversations domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://conversations.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = ConversationsBase; rest/messaging/V1.d.ts000064400000010241151677225100010562 0ustar00import MessagingBase from "../MessagingBase"; import Version from "../../base/Version"; import { BrandRegistrationListInstance } from "./v1/brandRegistration"; import { DeactivationsListInstance } from "./v1/deactivations"; import { DomainCertsListInstance } from "./v1/domainCerts"; import { DomainConfigListInstance } from "./v1/domainConfig"; import { DomainConfigMessagingServiceListInstance } from "./v1/domainConfigMessagingService"; import { ExternalCampaignListInstance } from "./v1/externalCampaign"; import { LinkshorteningMessagingServiceListInstance } from "./v1/linkshorteningMessagingService"; import { LinkshorteningMessagingServiceDomainAssociationListInstance } from "./v1/linkshorteningMessagingServiceDomainAssociation"; import { ServiceListInstance } from "./v1/service"; import { TollfreeVerificationListInstance } from "./v1/tollfreeVerification"; import { UsecaseListInstance } from "./v1/usecase"; export default class V1 extends Version { /** * Initialize the V1 version of Messaging * * @param domain - The Twilio (Twilio.Messaging) domain */ constructor(domain: MessagingBase); /** brandRegistrations - { Twilio.Messaging.V1.BrandRegistrationListInstance } resource */ protected _brandRegistrations?: BrandRegistrationListInstance; /** deactivations - { Twilio.Messaging.V1.DeactivationsListInstance } resource */ protected _deactivations?: DeactivationsListInstance; /** domainCerts - { Twilio.Messaging.V1.DomainCertsListInstance } resource */ protected _domainCerts?: DomainCertsListInstance; /** domainConfig - { Twilio.Messaging.V1.DomainConfigListInstance } resource */ protected _domainConfig?: DomainConfigListInstance; /** domainConfigMessagingService - { Twilio.Messaging.V1.DomainConfigMessagingServiceListInstance } resource */ protected _domainConfigMessagingService?: DomainConfigMessagingServiceListInstance; /** externalCampaign - { Twilio.Messaging.V1.ExternalCampaignListInstance } resource */ protected _externalCampaign?: ExternalCampaignListInstance; /** linkshorteningMessagingService - { Twilio.Messaging.V1.LinkshorteningMessagingServiceListInstance } resource */ protected _linkshorteningMessagingService?: LinkshorteningMessagingServiceListInstance; /** linkshorteningMessagingServiceDomainAssociation - { Twilio.Messaging.V1.LinkshorteningMessagingServiceDomainAssociationListInstance } resource */ protected _linkshorteningMessagingServiceDomainAssociation?: LinkshorteningMessagingServiceDomainAssociationListInstance; /** services - { Twilio.Messaging.V1.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** tollfreeVerifications - { Twilio.Messaging.V1.TollfreeVerificationListInstance } resource */ protected _tollfreeVerifications?: TollfreeVerificationListInstance; /** usecases - { Twilio.Messaging.V1.UsecaseListInstance } resource */ protected _usecases?: UsecaseListInstance; /** Getter for brandRegistrations resource */ get brandRegistrations(): BrandRegistrationListInstance; /** Getter for deactivations resource */ get deactivations(): DeactivationsListInstance; /** Getter for domainCerts resource */ get domainCerts(): DomainCertsListInstance; /** Getter for domainConfig resource */ get domainConfig(): DomainConfigListInstance; /** Getter for domainConfigMessagingService resource */ get domainConfigMessagingService(): DomainConfigMessagingServiceListInstance; /** Getter for externalCampaign resource */ get externalCampaign(): ExternalCampaignListInstance; /** Getter for linkshorteningMessagingService resource */ get linkshorteningMessagingService(): LinkshorteningMessagingServiceListInstance; /** Getter for linkshorteningMessagingServiceDomainAssociation resource */ get linkshorteningMessagingServiceDomainAssociation(): LinkshorteningMessagingServiceDomainAssociationListInstance; /** Getter for services resource */ get services(): ServiceListInstance; /** Getter for tollfreeVerifications resource */ get tollfreeVerifications(): TollfreeVerificationListInstance; /** Getter for usecases resource */ get usecases(): UsecaseListInstance; } rest/messaging/v1/domainConfig.d.ts000064400000015420151677225100013223 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to update a DomainConfigInstance */ export interface DomainConfigContextUpdateOptions { /** Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. */ fallbackUrl?: string; /** URL to receive click events to your webhook whenever the recipients click on the shortened links */ callbackUrl?: string; /** Boolean field to set customer delivery preference when there is a failure in linkShortening service */ continueOnFailure?: boolean; /** Customer\\\'s choice to send links with/without \\\"https://\\\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified. */ disableHttps?: boolean; } export interface DomainConfigContext { /** * Fetch a DomainConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigInstance */ fetch(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>; /** * Update a DomainConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigInstance */ update(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>; /** * Update a DomainConfigInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigInstance */ update(params: DomainConfigContextUpdateOptions, callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DomainConfigContextSolution { domainSid: string; } export declare class DomainConfigContextImpl implements DomainConfigContext { protected _version: V1; protected _solution: DomainConfigContextSolution; protected _uri: string; constructor(_version: V1, domainSid: string); fetch(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>; update(params?: DomainConfigContextUpdateOptions | ((error: Error | null, item?: DomainConfigInstance) => any), callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DomainConfigContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DomainConfigResource { domain_sid: string; config_sid: string; fallback_url: string; callback_url: string; continue_on_failure: boolean; date_created: Date; date_updated: Date; url: string; disable_https: boolean; } export declare class DomainConfigInstance { protected _version: V1; protected _solution: DomainConfigContextSolution; protected _context?: DomainConfigContext; constructor(_version: V1, payload: DomainConfigResource, domainSid?: string); /** * The unique string that we created to identify the Domain resource. */ domainSid: string; /** * The unique string that we created to identify the Domain config (prefix ZK). */ configSid: string; /** * Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. */ fallbackUrl: string; /** * URL to receive click events to your webhook whenever the recipients click on the shortened links. */ callbackUrl: string; /** * Boolean field to set customer delivery preference when there is a failure in linkShortening service */ continueOnFailure: boolean; /** * Date this Domain Config was created. */ dateCreated: Date; /** * Date that this Domain Config was last updated. */ dateUpdated: Date; url: string; /** * Customer\'s choice to send links with/without \"https://\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified. */ disableHttps: boolean; private get _proxy(); /** * Fetch a DomainConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigInstance */ fetch(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>; /** * Update a DomainConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigInstance */ update(callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>; /** * Update a DomainConfigInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigInstance */ update(params: DomainConfigContextUpdateOptions, callback?: (error: Error | null, item?: DomainConfigInstance) => any): Promise<DomainConfigInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { domainSid: string; configSid: string; fallbackUrl: string; callbackUrl: string; continueOnFailure: boolean; dateCreated: Date; dateUpdated: Date; url: string; disableHttps: boolean; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DomainConfigSolution { } export interface DomainConfigListInstance { _version: V1; _solution: DomainConfigSolution; _uri: string; (domainSid: string): DomainConfigContext; get(domainSid: string): DomainConfigContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DomainConfigListInstance(version: V1): DomainConfigListInstance; export {}; rest/messaging/v1/usecase.d.ts000064400000002425151677225100012257 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export interface UsecaseSolution { } export interface UsecaseListInstance { _version: V1; _solution: UsecaseSolution; _uri: string; /** * Fetch a UsecaseInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UsecaseInstance */ fetch(callback?: (error: Error | null, item?: UsecaseInstance) => any): Promise<UsecaseInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UsecaseListInstance(version: V1): UsecaseListInstance; interface UsecaseResource { usecases: Array<any>; } export declare class UsecaseInstance { protected _version: V1; constructor(_version: V1, payload: UsecaseResource); /** * Human readable use case details (usecase, description and purpose) of Messaging Service Use Cases. */ usecases: Array<any>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { usecases: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/tollfreeVerification.d.ts000064400000061070151677225100015007 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type TollfreeVerificationOptInType = "VERBAL" | "WEB_FORM" | "PAPER_FORM" | "VIA_TEXT" | "MOBILE_QR_CODE" | "IMPORT"; export type TollfreeVerificationStatus = "PENDING_REVIEW" | "IN_REVIEW" | "TWILIO_APPROVED" | "TWILIO_REJECTED"; /** * Options to pass to update a TollfreeVerificationInstance */ export interface TollfreeVerificationContextUpdateOptions { /** The name of the business or organization using the Tollfree number. */ businessName?: string; /** The website of the business or organization using the Tollfree number. */ businessWebsite?: string; /** The email address to receive the notification about the verification result. . */ notificationEmail?: string; /** The category of the use case for the Tollfree Number. List as many are applicable.. */ useCaseCategories?: Array<string>; /** Use this to further explain how messaging is used by the business or organization. */ useCaseSummary?: string; /** An example of message content, i.e. a sample message. */ productionMessageSample?: string; /** Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. */ optInImageUrls?: Array<string>; /** */ optInType?: TollfreeVerificationOptInType; /** Estimate monthly volume of messages from the Tollfree Number. */ messageVolume?: string; /** The address of the business or organization using the Tollfree number. */ businessStreetAddress?: string; /** The address of the business or organization using the Tollfree number. */ businessStreetAddress2?: string; /** The city of the business or organization using the Tollfree number. */ businessCity?: string; /** The state/province/region of the business or organization using the Tollfree number. */ businessStateProvinceRegion?: string; /** The postal code of the business or organization using the Tollfree number. */ businessPostalCode?: string; /** The country of the business or organization using the Tollfree number. */ businessCountry?: string; /** Additional information to be provided for verification. */ additionalInformation?: string; /** The first name of the contact for the business or organization using the Tollfree number. */ businessContactFirstName?: string; /** The last name of the contact for the business or organization using the Tollfree number. */ businessContactLastName?: string; /** The email address of the contact for the business or organization using the Tollfree number. */ businessContactEmail?: string; /** The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. */ businessContactPhone?: string; /** Describe why the verification is being edited. If the verification was rejected because of a technical issue, such as the website being down, and the issue has been resolved this parameter should be set to something similar to \\\'Website fixed\\\'. */ editReason?: string; } /** * Options to pass to create a TollfreeVerificationInstance */ export interface TollfreeVerificationListInstanceCreateOptions { /** The name of the business or organization using the Tollfree number. */ businessName: string; /** The website of the business or organization using the Tollfree number. */ businessWebsite: string; /** The email address to receive the notification about the verification result. . */ notificationEmail: string; /** The category of the use case for the Tollfree Number. List as many are applicable.. */ useCaseCategories: Array<string>; /** Use this to further explain how messaging is used by the business or organization. */ useCaseSummary: string; /** An example of message content, i.e. a sample message. */ productionMessageSample: string; /** Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. */ optInImageUrls: Array<string>; /** */ optInType: TollfreeVerificationOptInType; /** Estimate monthly volume of messages from the Tollfree Number. */ messageVolume: string; /** The SID of the Phone Number associated with the Tollfree Verification. */ tollfreePhoneNumberSid: string; /** Customer\\\'s Profile Bundle BundleSid. */ customerProfileSid?: string; /** The address of the business or organization using the Tollfree number. */ businessStreetAddress?: string; /** The address of the business or organization using the Tollfree number. */ businessStreetAddress2?: string; /** The city of the business or organization using the Tollfree number. */ businessCity?: string; /** The state/province/region of the business or organization using the Tollfree number. */ businessStateProvinceRegion?: string; /** The postal code of the business or organization using the Tollfree number. */ businessPostalCode?: string; /** The country of the business or organization using the Tollfree number. */ businessCountry?: string; /** Additional information to be provided for verification. */ additionalInformation?: string; /** The first name of the contact for the business or organization using the Tollfree number. */ businessContactFirstName?: string; /** The last name of the contact for the business or organization using the Tollfree number. */ businessContactLastName?: string; /** The email address of the contact for the business or organization using the Tollfree number. */ businessContactEmail?: string; /** The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. */ businessContactPhone?: string; /** An optional external reference ID supplied by customer and echoed back on status retrieval. */ externalReferenceId?: string; } /** * Options to pass to each */ export interface TollfreeVerificationListInstanceEachOptions { /** The SID of the Phone Number associated with the Tollfree Verification. */ tollfreePhoneNumberSid?: string; /** The compliance status of the Tollfree Verification record. */ status?: TollfreeVerificationStatus; /** Customer supplied reference id for the Tollfree Verification record. */ externalReferenceId?: string; /** Whether to include Tollfree Verifications from sub accounts in list response. */ includeSubAccounts?: boolean; /** 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: TollfreeVerificationInstance, 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 TollfreeVerificationListInstanceOptions { /** The SID of the Phone Number associated with the Tollfree Verification. */ tollfreePhoneNumberSid?: string; /** The compliance status of the Tollfree Verification record. */ status?: TollfreeVerificationStatus; /** Customer supplied reference id for the Tollfree Verification record. */ externalReferenceId?: string; /** Whether to include Tollfree Verifications from sub accounts in list response. */ includeSubAccounts?: boolean; /** 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 TollfreeVerificationListInstancePageOptions { /** The SID of the Phone Number associated with the Tollfree Verification. */ tollfreePhoneNumberSid?: string; /** The compliance status of the Tollfree Verification record. */ status?: TollfreeVerificationStatus; /** Customer supplied reference id for the Tollfree Verification record. */ externalReferenceId?: string; /** Whether to include Tollfree Verifications from sub accounts in list response. */ includeSubAccounts?: boolean; /** 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 TollfreeVerificationContext { /** * Remove a TollfreeVerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TollfreeVerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TollfreeVerificationInstance */ fetch(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>; /** * Update a TollfreeVerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TollfreeVerificationInstance */ update(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>; /** * Update a TollfreeVerificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TollfreeVerificationInstance */ update(params: TollfreeVerificationContextUpdateOptions, callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TollfreeVerificationContextSolution { sid: string; } export declare class TollfreeVerificationContextImpl implements TollfreeVerificationContext { protected _version: V1; protected _solution: TollfreeVerificationContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>; update(params?: TollfreeVerificationContextUpdateOptions | ((error: Error | null, item?: TollfreeVerificationInstance) => any), callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TollfreeVerificationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TollfreeVerificationPayload extends TwilioResponsePayload { verifications: TollfreeVerificationResource[]; } interface TollfreeVerificationResource { sid: string; account_sid: string; customer_profile_sid: string; trust_product_sid: string; date_created: Date; date_updated: Date; regulated_item_sid: string; business_name: string; business_street_address: string; business_street_address2: string; business_city: string; business_state_province_region: string; business_postal_code: string; business_country: string; business_website: string; business_contact_first_name: string; business_contact_last_name: string; business_contact_email: string; business_contact_phone: string; notification_email: string; use_case_categories: Array<string>; use_case_summary: string; production_message_sample: string; opt_in_image_urls: Array<string>; opt_in_type: TollfreeVerificationOptInType; message_volume: string; additional_information: string; tollfree_phone_number_sid: string; status: TollfreeVerificationStatus; url: string; rejection_reason: string; error_code: number; edit_expiration: Date; edit_allowed: boolean; rejection_reasons: Array<any>; resource_links: any; external_reference_id: string; } export declare class TollfreeVerificationInstance { protected _version: V1; protected _solution: TollfreeVerificationContextSolution; protected _context?: TollfreeVerificationContext; constructor(_version: V1, payload: TollfreeVerificationResource, sid?: string); /** * The unique string to identify Tollfree Verification. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tollfree Verification resource. */ accountSid: string; /** * Customer\'s Profile Bundle BundleSid. */ customerProfileSid: string; /** * Tollfree TrustProduct Bundle BundleSid. */ trustProductSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The SID of the Regulated Item. */ regulatedItemSid: string; /** * The name of the business or organization using the Tollfree number. */ businessName: string; /** * The address of the business or organization using the Tollfree number. */ businessStreetAddress: string; /** * The address of the business or organization using the Tollfree number. */ businessStreetAddress2: string; /** * The city of the business or organization using the Tollfree number. */ businessCity: string; /** * The state/province/region of the business or organization using the Tollfree number. */ businessStateProvinceRegion: string; /** * The postal code of the business or organization using the Tollfree number. */ businessPostalCode: string; /** * The country of the business or organization using the Tollfree number. */ businessCountry: string; /** * The website of the business or organization using the Tollfree number. */ businessWebsite: string; /** * The first name of the contact for the business or organization using the Tollfree number. */ businessContactFirstName: string; /** * The last name of the contact for the business or organization using the Tollfree number. */ businessContactLastName: string; /** * The email address of the contact for the business or organization using the Tollfree number. */ businessContactEmail: string; /** * The E.164 formatted phone number of the contact for the business or organization using the Tollfree number. */ businessContactPhone: string; /** * The email address to receive the notification about the verification result. . */ notificationEmail: string; /** * The category of the use case for the Tollfree Number. List as many are applicable.. */ useCaseCategories: Array<string>; /** * Use this to further explain how messaging is used by the business or organization. */ useCaseSummary: string; /** * An example of message content, i.e. a sample message. */ productionMessageSample: string; /** * Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. */ optInImageUrls: Array<string>; optInType: TollfreeVerificationOptInType; /** * Estimate monthly volume of messages from the Tollfree Number. */ messageVolume: string; /** * Additional information to be provided for verification. */ additionalInformation: string; /** * The SID of the Phone Number associated with the Tollfree Verification. */ tollfreePhoneNumberSid: string; status: TollfreeVerificationStatus; /** * The absolute URL of the Tollfree Verification resource. */ url: string; /** * The rejection reason given when a Tollfree Verification has been rejected. */ rejectionReason: string; /** * The error code given when a Tollfree Verification has been rejected. */ errorCode: number; /** * The date and time when the ability to edit a rejected verification expires. */ editExpiration: Date; /** * If a rejected verification is allowed to be edited/resubmitted. Some rejection reasons allow editing and some do not. */ editAllowed: boolean; /** * A list of rejection reasons and codes describing why a Tollfree Verification has been rejected. */ rejectionReasons: Array<any>; /** * The URLs of the documents associated with the Tollfree Verification resource. */ resourceLinks: any; /** * An optional external reference ID supplied by customer and echoed back on status retrieval. */ externalReferenceId: string; private get _proxy(); /** * Remove a TollfreeVerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TollfreeVerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TollfreeVerificationInstance */ fetch(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>; /** * Update a TollfreeVerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TollfreeVerificationInstance */ update(callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>; /** * Update a TollfreeVerificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TollfreeVerificationInstance */ update(params: TollfreeVerificationContextUpdateOptions, callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; customerProfileSid: string; trustProductSid: string; dateCreated: Date; dateUpdated: Date; regulatedItemSid: string; businessName: string; businessStreetAddress: string; businessStreetAddress2: string; businessCity: string; businessStateProvinceRegion: string; businessPostalCode: string; businessCountry: string; businessWebsite: string; businessContactFirstName: string; businessContactLastName: string; businessContactEmail: string; businessContactPhone: string; notificationEmail: string; useCaseCategories: string[]; useCaseSummary: string; productionMessageSample: string; optInImageUrls: string[]; optInType: TollfreeVerificationOptInType; messageVolume: string; additionalInformation: string; tollfreePhoneNumberSid: string; status: TollfreeVerificationStatus; url: string; rejectionReason: string; errorCode: number; editExpiration: Date; editAllowed: boolean; rejectionReasons: any[]; resourceLinks: any; externalReferenceId: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TollfreeVerificationSolution { } export interface TollfreeVerificationListInstance { _version: V1; _solution: TollfreeVerificationSolution; _uri: string; (sid: string): TollfreeVerificationContext; get(sid: string): TollfreeVerificationContext; /** * Create a TollfreeVerificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TollfreeVerificationInstance */ create(params: TollfreeVerificationListInstanceCreateOptions, callback?: (error: Error | null, item?: TollfreeVerificationInstance) => any): Promise<TollfreeVerificationInstance>; /** * Streams TollfreeVerificationInstance 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 { TollfreeVerificationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TollfreeVerificationInstance, done: (err?: Error) => void) => void): void; each(params: TollfreeVerificationListInstanceEachOptions, callback?: (item: TollfreeVerificationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TollfreeVerificationInstance 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: TollfreeVerificationPage) => any): Promise<TollfreeVerificationPage>; /** * Lists TollfreeVerificationInstance 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 { TollfreeVerificationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TollfreeVerificationInstance[]) => any): Promise<TollfreeVerificationInstance[]>; list(params: TollfreeVerificationListInstanceOptions, callback?: (error: Error | null, items: TollfreeVerificationInstance[]) => any): Promise<TollfreeVerificationInstance[]>; /** * Retrieve a single page of TollfreeVerificationInstance 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 { TollfreeVerificationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TollfreeVerificationPage) => any): Promise<TollfreeVerificationPage>; page(params: TollfreeVerificationListInstancePageOptions, callback?: (error: Error | null, items: TollfreeVerificationPage) => any): Promise<TollfreeVerificationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TollfreeVerificationListInstance(version: V1): TollfreeVerificationListInstance; export declare class TollfreeVerificationPage extends Page<V1, TollfreeVerificationPayload, TollfreeVerificationResource, TollfreeVerificationInstance> { /** * Initialize the TollfreeVerificationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TollfreeVerificationSolution); /** * Build an instance of TollfreeVerificationInstance * * @param payload - Payload response from the API */ getInstance(payload: TollfreeVerificationResource): TollfreeVerificationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/service.d.ts000064400000056260151677225100012275 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { AlphaSenderListInstance } from "./service/alphaSender"; import { ChannelSenderListInstance } from "./service/channelSender"; import { PhoneNumberListInstance } from "./service/phoneNumber"; import { ShortCodeListInstance } from "./service/shortCode"; import { UsAppToPersonListInstance } from "./service/usAppToPerson"; import { UsAppToPersonUsecaseListInstance } from "./service/usAppToPersonUsecase"; export type ServiceScanMessageContent = "inherit" | "enable" | "disable"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. */ inboundRequestUrl?: string; /** The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. */ inboundMethod?: string; /** The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. */ fallbackUrl?: string; /** The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. */ fallbackMethod?: string; /** The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. */ statusCallback?: string; /** Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. */ stickySender?: boolean; /** Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. */ mmsConverter?: boolean; /** Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. */ smartEncoding?: boolean; /** */ scanMessageContent?: ServiceScanMessageContent; /** [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. */ fallbackToLongCode?: boolean; /** Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. */ areaCodeGeomatch?: boolean; /** How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. */ validityPeriod?: number; /** Reserved. */ synchronousValidation?: boolean; /** A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. */ usecase?: string; /** A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. */ useInboundWebhookOnNumber?: boolean; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName: string; /** The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. */ inboundRequestUrl?: string; /** The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. */ inboundMethod?: string; /** The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. */ fallbackUrl?: string; /** The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. */ fallbackMethod?: string; /** The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. */ statusCallback?: string; /** Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. */ stickySender?: boolean; /** Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. */ mmsConverter?: boolean; /** Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. */ smartEncoding?: boolean; /** */ scanMessageContent?: ServiceScanMessageContent; /** [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. */ fallbackToLongCode?: boolean; /** Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. */ areaCodeGeomatch?: boolean; /** How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. */ validityPeriod?: number; /** Reserved. */ synchronousValidation?: boolean; /** A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. */ usecase?: string; /** A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. */ useInboundWebhookOnNumber?: boolean; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { alphaSenders: AlphaSenderListInstance; channelSenders: ChannelSenderListInstance; phoneNumbers: PhoneNumberListInstance; shortCodes: ShortCodeListInstance; usAppToPerson: UsAppToPersonListInstance; usAppToPersonUsecases: UsAppToPersonUsecaseListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V1; protected _solution: ServiceContextSolution; protected _uri: string; protected _alphaSenders?: AlphaSenderListInstance; protected _channelSenders?: ChannelSenderListInstance; protected _phoneNumbers?: PhoneNumberListInstance; protected _shortCodes?: ShortCodeListInstance; protected _usAppToPerson?: UsAppToPersonListInstance; protected _usAppToPersonUsecases?: UsAppToPersonUsecaseListInstance; constructor(_version: V1, sid: string); get alphaSenders(): AlphaSenderListInstance; get channelSenders(): ChannelSenderListInstance; get phoneNumbers(): PhoneNumberListInstance; get shortCodes(): ShortCodeListInstance; get usAppToPerson(): UsAppToPersonListInstance; get usAppToPersonUsecases(): UsAppToPersonUsecaseListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; date_created: Date; date_updated: Date; inbound_request_url: string; inbound_method: string; fallback_url: string; fallback_method: string; status_callback: string; sticky_sender: boolean; mms_converter: boolean; smart_encoding: boolean; scan_message_content: ServiceScanMessageContent; fallback_to_long_code: boolean; area_code_geomatch: boolean; synchronous_validation: boolean; validity_period: number; url: string; links: Record<string, string>; usecase: string; us_app_to_person_registered: boolean; use_inbound_webhook_on_number: boolean; } export declare class ServiceInstance { protected _version: V1; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V1, payload: ServiceResource, sid?: string); /** * The unique string that we created to identify the Service resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service 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 [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 URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. */ inboundRequestUrl: string; /** * The HTTP method we use to call `inbound_request_url`. Can be `GET` or `POST`. */ inboundMethod: string; /** * The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. */ fallbackUrl: string; /** * The HTTP method we use to call `fallback_url`. Can be: `GET` or `POST`. */ fallbackMethod: string; /** * The URL we call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. */ statusCallback: string; /** * Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. */ stickySender: boolean; /** * Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. */ mmsConverter: boolean; /** * Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. */ smartEncoding: boolean; scanMessageContent: ServiceScanMessageContent; /** * [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. */ fallbackToLongCode: boolean; /** * Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. */ areaCodeGeomatch: boolean; /** * Reserved. */ synchronousValidation: boolean; /** * How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. */ validityPeriod: number; /** * The absolute URL of the Service resource. */ url: string; /** * The absolute URLs of related resources. */ links: Record<string, string>; /** * A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. */ usecase: string; /** * Whether US A2P campaign is registered for this Service. */ usAppToPersonRegistered: boolean; /** * A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. */ useInboundWebhookOnNumber: boolean; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the alphaSenders. */ alphaSenders(): AlphaSenderListInstance; /** * Access the channelSenders. */ channelSenders(): ChannelSenderListInstance; /** * Access the phoneNumbers. */ phoneNumbers(): PhoneNumberListInstance; /** * Access the shortCodes. */ shortCodes(): ShortCodeListInstance; /** * Access the usAppToPerson. */ usAppToPerson(): UsAppToPersonListInstance; /** * Access the usAppToPersonUsecases. */ usAppToPersonUsecases(): UsAppToPersonUsecaseListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; inboundRequestUrl: string; inboundMethod: string; fallbackUrl: string; fallbackMethod: string; statusCallback: string; stickySender: boolean; mmsConverter: boolean; smartEncoding: boolean; scanMessageContent: ServiceScanMessageContent; fallbackToLongCode: boolean; areaCodeGeomatch: boolean; synchronousValidation: boolean; validityPeriod: number; url: string; links: Record<string, string>; usecase: string; usAppToPersonRegistered: boolean; useInboundWebhookOnNumber: boolean; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V1; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V1): ServiceListInstance; export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/brandRegistration/brandVetting.js000064400000021420151677225100016477 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.BrandVettingPage = exports.BrandVettingListInstance = exports.BrandVettingInstance = exports.BrandVettingContextImpl = void 0; 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 BrandVettingContextImpl { constructor(_version, brandSid, brandVettingSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(brandSid)) { throw new Error("Parameter 'brandSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(brandVettingSid)) { throw new Error("Parameter 'brandVettingSid' is not valid."); } this._solution = { brandSid, brandVettingSid }; this._uri = `/a2p/BrandRegistrations/${brandSid}/Vettings/${brandVettingSid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BrandVettingInstance(operationVersion, payload, instance._solution.brandSid, instance._solution.brandVettingSid)); 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.BrandVettingContextImpl = BrandVettingContextImpl; class BrandVettingInstance { constructor(_version, payload, brandSid, brandVettingSid) { this._version = _version; this.accountSid = payload.account_sid; this.brandSid = payload.brand_sid; this.brandVettingSid = payload.brand_vetting_sid; this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.vettingId = payload.vetting_id; this.vettingClass = payload.vetting_class; this.vettingStatus = payload.vetting_status; this.vettingProvider = payload.vetting_provider; this.url = payload.url; this._solution = { brandSid, brandVettingSid: brandVettingSid || this.brandVettingSid, }; } get _proxy() { this._context = this._context || new BrandVettingContextImpl(this._version, this._solution.brandSid, this._solution.brandVettingSid); return this._context; } /** * Fetch a BrandVettingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandVettingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, brandSid: this.brandSid, brandVettingSid: this.brandVettingSid, dateUpdated: this.dateUpdated, dateCreated: this.dateCreated, vettingId: this.vettingId, vettingClass: this.vettingClass, vettingStatus: this.vettingStatus, vettingProvider: this.vettingProvider, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BrandVettingInstance = BrandVettingInstance; function BrandVettingListInstance(version, brandSid) { if (!(0, utility_1.isValidPathParam)(brandSid)) { throw new Error("Parameter 'brandSid' is not valid."); } const instance = ((brandVettingSid) => instance.get(brandVettingSid)); instance.get = function get(brandVettingSid) { return new BrandVettingContextImpl(version, brandSid, brandVettingSid); }; instance._version = version; instance._solution = { brandSid }; instance._uri = `/a2p/BrandRegistrations/${brandSid}/Vettings`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["vettingProvider"] === null || params["vettingProvider"] === undefined) { throw new Error("Required parameter \"params['vettingProvider']\" missing."); } let data = {}; data["VettingProvider"] = params["vettingProvider"]; if (params["vettingId"] !== undefined) data["VettingId"] = params["vettingId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BrandVettingInstance(operationVersion, payload, instance._solution.brandSid)); 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["vettingProvider"] !== undefined) data["VettingProvider"] = params["vettingProvider"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BrandVettingPage(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 BrandVettingPage(instance._version, payload, 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; } exports.BrandVettingListInstance = BrandVettingListInstance; class BrandVettingPage extends Page_1.default { /** * Initialize the BrandVettingPage * * @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 BrandVettingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BrandVettingInstance(this._version, payload, this._solution.brandSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BrandVettingPage = BrandVettingPage; rest/messaging/v1/brandRegistration/brandRegistrationOtp.js000064400000005351151677225100020221 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.BrandRegistrationOtpInstance = exports.BrandRegistrationOtpListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function BrandRegistrationOtpListInstance(version, brandRegistrationSid) { if (!(0, utility_1.isValidPathParam)(brandRegistrationSid)) { throw new Error("Parameter 'brandRegistrationSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { brandRegistrationSid }; instance._uri = `/a2p/BrandRegistrations/${brandRegistrationSid}/SmsOtp`; instance.create = function create(callback) { let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", }); operationPromise = operationPromise.then((payload) => new BrandRegistrationOtpInstance(operationVersion, payload, instance._solution.brandRegistrationSid)); 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; } exports.BrandRegistrationOtpListInstance = BrandRegistrationOtpListInstance; class BrandRegistrationOtpInstance { constructor(_version, payload, brandRegistrationSid) { this._version = _version; this.accountSid = payload.account_sid; this.brandRegistrationSid = payload.brand_registration_sid; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, brandRegistrationSid: this.brandRegistrationSid, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BrandRegistrationOtpInstance = BrandRegistrationOtpInstance; rest/messaging/v1/brandRegistration/brandVetting.d.ts000064400000024120151677225100016733 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type BrandVettingVettingProvider = "campaign-verify"; /** * Options to pass to create a BrandVettingInstance */ export interface BrandVettingListInstanceCreateOptions { /** */ vettingProvider: BrandVettingVettingProvider; /** The unique ID of the vetting */ vettingId?: string; } /** * Options to pass to each */ export interface BrandVettingListInstanceEachOptions { /** The third-party provider of the vettings to read */ vettingProvider?: BrandVettingVettingProvider; /** 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: BrandVettingInstance, 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 BrandVettingListInstanceOptions { /** The third-party provider of the vettings to read */ vettingProvider?: BrandVettingVettingProvider; /** 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 BrandVettingListInstancePageOptions { /** The third-party provider of the vettings to read */ vettingProvider?: BrandVettingVettingProvider; /** 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 BrandVettingContext { /** * Fetch a BrandVettingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandVettingInstance */ fetch(callback?: (error: Error | null, item?: BrandVettingInstance) => any): Promise<BrandVettingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BrandVettingContextSolution { brandSid: string; brandVettingSid: string; } export declare class BrandVettingContextImpl implements BrandVettingContext { protected _version: V1; protected _solution: BrandVettingContextSolution; protected _uri: string; constructor(_version: V1, brandSid: string, brandVettingSid: string); fetch(callback?: (error: Error | null, item?: BrandVettingInstance) => any): Promise<BrandVettingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BrandVettingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BrandVettingPayload extends TwilioResponsePayload { data: BrandVettingResource[]; } interface BrandVettingResource { account_sid: string; brand_sid: string; brand_vetting_sid: string; date_updated: Date; date_created: Date; vetting_id: string; vetting_class: string; vetting_status: string; vetting_provider: BrandVettingVettingProvider; url: string; } export declare class BrandVettingInstance { protected _version: V1; protected _solution: BrandVettingContextSolution; protected _context?: BrandVettingContext; constructor(_version: V1, payload: BrandVettingResource, brandSid: string, brandVettingSid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the vetting record. */ accountSid: string; /** * The unique string to identify Brand Registration. */ brandSid: string; /** * The Twilio SID of the third-party vetting record. */ brandVettingSid: string; /** * 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 date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The unique identifier of the vetting from the third-party provider. */ vettingId: string; /** * The type of vetting that has been conducted. One of “STANDARD” (Aegis) or “POLITICAL” (Campaign Verify). */ vettingClass: string; /** * The status of the import vetting attempt. One of “PENDING,” “SUCCESS,” or “FAILED”. */ vettingStatus: string; vettingProvider: BrandVettingVettingProvider; /** * The absolute URL of the Brand Vetting resource. */ url: string; private get _proxy(); /** * Fetch a BrandVettingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandVettingInstance */ fetch(callback?: (error: Error | null, item?: BrandVettingInstance) => any): Promise<BrandVettingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; brandSid: string; brandVettingSid: string; dateUpdated: Date; dateCreated: Date; vettingId: string; vettingClass: string; vettingStatus: string; vettingProvider: "campaign-verify"; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BrandVettingSolution { brandSid: string; } export interface BrandVettingListInstance { _version: V1; _solution: BrandVettingSolution; _uri: string; (brandVettingSid: string): BrandVettingContext; get(brandVettingSid: string): BrandVettingContext; /** * Create a BrandVettingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandVettingInstance */ create(params: BrandVettingListInstanceCreateOptions, callback?: (error: Error | null, item?: BrandVettingInstance) => any): Promise<BrandVettingInstance>; /** * Streams BrandVettingInstance 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 { BrandVettingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BrandVettingInstance, done: (err?: Error) => void) => void): void; each(params: BrandVettingListInstanceEachOptions, callback?: (item: BrandVettingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BrandVettingInstance 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: BrandVettingPage) => any): Promise<BrandVettingPage>; /** * Lists BrandVettingInstance 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 { BrandVettingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BrandVettingInstance[]) => any): Promise<BrandVettingInstance[]>; list(params: BrandVettingListInstanceOptions, callback?: (error: Error | null, items: BrandVettingInstance[]) => any): Promise<BrandVettingInstance[]>; /** * Retrieve a single page of BrandVettingInstance 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 { BrandVettingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BrandVettingPage) => any): Promise<BrandVettingPage>; page(params: BrandVettingListInstancePageOptions, callback?: (error: Error | null, items: BrandVettingPage) => any): Promise<BrandVettingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BrandVettingListInstance(version: V1, brandSid: string): BrandVettingListInstance; export declare class BrandVettingPage extends Page<V1, BrandVettingPayload, BrandVettingResource, BrandVettingInstance> { /** * Initialize the BrandVettingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: BrandVettingSolution); /** * Build an instance of BrandVettingInstance * * @param payload - Payload response from the API */ getInstance(payload: BrandVettingResource): BrandVettingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/brandRegistration/brandRegistrationOtp.d.ts000064400000003362151677225100020455 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export interface BrandRegistrationOtpSolution { brandRegistrationSid: string; } export interface BrandRegistrationOtpListInstance { _version: V1; _solution: BrandRegistrationOtpSolution; _uri: string; /** * Create a BrandRegistrationOtpInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandRegistrationOtpInstance */ create(callback?: (error: Error | null, item?: BrandRegistrationOtpInstance) => any): Promise<BrandRegistrationOtpInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BrandRegistrationOtpListInstance(version: V1, brandRegistrationSid: string): BrandRegistrationOtpListInstance; interface BrandRegistrationOtpResource { account_sid: string; brand_registration_sid: string; } export declare class BrandRegistrationOtpInstance { protected _version: V1; constructor(_version: V1, payload: BrandRegistrationOtpResource, brandRegistrationSid: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. */ accountSid: string; /** * The unique string to identify Brand Registration of Sole Proprietor Brand */ brandRegistrationSid: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; brandRegistrationSid: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/domainConfig.js000064400000013401151677225100012764 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.DomainConfigListInstance = exports.DomainConfigInstance = exports.DomainConfigContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class DomainConfigContextImpl { constructor(_version, domainSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } this._solution = { domainSid }; this._uri = `/LinkShortening/Domains/${domainSid}/Config`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DomainConfigInstance(operationVersion, payload, instance._solution.domainSid)); 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["fallbackUrl"] !== undefined) data["FallbackUrl"] = params["fallbackUrl"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["continueOnFailure"] !== undefined) data["ContinueOnFailure"] = serialize.bool(params["continueOnFailure"]); if (params["disableHttps"] !== undefined) data["DisableHttps"] = serialize.bool(params["disableHttps"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DomainConfigInstance(operationVersion, payload, instance._solution.domainSid)); 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.DomainConfigContextImpl = DomainConfigContextImpl; class DomainConfigInstance { constructor(_version, payload, domainSid) { this._version = _version; this.domainSid = payload.domain_sid; this.configSid = payload.config_sid; this.fallbackUrl = payload.fallback_url; this.callbackUrl = payload.callback_url; this.continueOnFailure = payload.continue_on_failure; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.disableHttps = payload.disable_https; this._solution = { domainSid: domainSid || this.domainSid }; } get _proxy() { this._context = this._context || new DomainConfigContextImpl(this._version, this._solution.domainSid); return this._context; } /** * Fetch a DomainConfigInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { domainSid: this.domainSid, configSid: this.configSid, fallbackUrl: this.fallbackUrl, callbackUrl: this.callbackUrl, continueOnFailure: this.continueOnFailure, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, disableHttps: this.disableHttps, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DomainConfigInstance = DomainConfigInstance; function DomainConfigListInstance(version) { const instance = ((domainSid) => instance.get(domainSid)); instance.get = function get(domainSid) { return new DomainConfigContextImpl(version, domainSid); }; 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; } exports.DomainConfigListInstance = DomainConfigListInstance; rest/messaging/v1/externalCampaign.d.ts000064400000005167151677225100014117 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to create a ExternalCampaignInstance */ export interface ExternalCampaignListInstanceCreateOptions { /** ID of the preregistered campaign. */ campaignId: string; /** The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. */ messagingServiceSid: string; } export interface ExternalCampaignSolution { } export interface ExternalCampaignListInstance { _version: V1; _solution: ExternalCampaignSolution; _uri: string; /** * Create a ExternalCampaignInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExternalCampaignInstance */ create(params: ExternalCampaignListInstanceCreateOptions, callback?: (error: Error | null, item?: ExternalCampaignInstance) => any): Promise<ExternalCampaignInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExternalCampaignListInstance(version: V1): ExternalCampaignListInstance; interface ExternalCampaignResource { sid: string; account_sid: string; campaign_id: string; messaging_service_sid: string; date_created: Date; } export declare class ExternalCampaignInstance { protected _version: V1; constructor(_version: V1, payload: ExternalCampaignResource); /** * The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. */ accountSid: string; /** * ID of the preregistered campaign. */ campaignId: string; /** * The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. */ messagingServiceSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; campaignId: string; messagingServiceSid: string; dateCreated: Date; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/deactivations.js000064400000006716151677225100013237 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.DeactivationsListInstance = exports.DeactivationsInstance = exports.DeactivationsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); class DeactivationsContextImpl { constructor(_version) { this._version = _version; this._solution = {}; this._uri = `/Deactivations`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["date"] !== undefined) data["Date"] = serialize.iso8601Date(params["date"]); const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DeactivationsInstance(operationVersion, payload)); 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.DeactivationsContextImpl = DeactivationsContextImpl; class DeactivationsInstance { constructor(_version, payload) { this._version = _version; this.redirectTo = payload.redirect_to; this._solution = {}; } get _proxy() { this._context = this._context || new DeactivationsContextImpl(this._version); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { redirectTo: this.redirectTo, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeactivationsInstance = DeactivationsInstance; function DeactivationsListInstance(version) { const instance = (() => instance.get()); instance.get = function get() { return new DeactivationsContextImpl(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; } exports.DeactivationsListInstance = DeactivationsListInstance; rest/messaging/v1/service.js000064400000041445151677225100012040 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const alphaSender_1 = require("./service/alphaSender"); const channelSender_1 = require("./service/channelSender"); const phoneNumber_1 = require("./service/phoneNumber"); const shortCode_1 = require("./service/shortCode"); const usAppToPerson_1 = require("./service/usAppToPerson"); const usAppToPersonUsecase_1 = require("./service/usAppToPersonUsecase"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get alphaSenders() { this._alphaSenders = this._alphaSenders || (0, alphaSender_1.AlphaSenderListInstance)(this._version, this._solution.sid); return this._alphaSenders; } get channelSenders() { this._channelSenders = this._channelSenders || (0, channelSender_1.ChannelSenderListInstance)(this._version, this._solution.sid); return this._channelSenders; } get phoneNumbers() { this._phoneNumbers = this._phoneNumbers || (0, phoneNumber_1.PhoneNumberListInstance)(this._version, this._solution.sid); return this._phoneNumbers; } get shortCodes() { this._shortCodes = this._shortCodes || (0, shortCode_1.ShortCodeListInstance)(this._version, this._solution.sid); return this._shortCodes; } get usAppToPerson() { this._usAppToPerson = this._usAppToPerson || (0, usAppToPerson_1.UsAppToPersonListInstance)(this._version, this._solution.sid); return this._usAppToPerson; } get usAppToPersonUsecases() { this._usAppToPersonUsecases = this._usAppToPersonUsecases || (0, usAppToPersonUsecase_1.UsAppToPersonUsecaseListInstance)(this._version, this._solution.sid); return this._usAppToPersonUsecases; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["inboundRequestUrl"] !== undefined) data["InboundRequestUrl"] = params["inboundRequestUrl"]; if (params["inboundMethod"] !== undefined) data["InboundMethod"] = params["inboundMethod"]; if (params["fallbackUrl"] !== undefined) data["FallbackUrl"] = params["fallbackUrl"]; if (params["fallbackMethod"] !== undefined) data["FallbackMethod"] = params["fallbackMethod"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["stickySender"] !== undefined) data["StickySender"] = serialize.bool(params["stickySender"]); if (params["mmsConverter"] !== undefined) data["MmsConverter"] = serialize.bool(params["mmsConverter"]); if (params["smartEncoding"] !== undefined) data["SmartEncoding"] = serialize.bool(params["smartEncoding"]); if (params["scanMessageContent"] !== undefined) data["ScanMessageContent"] = params["scanMessageContent"]; if (params["fallbackToLongCode"] !== undefined) data["FallbackToLongCode"] = serialize.bool(params["fallbackToLongCode"]); if (params["areaCodeGeomatch"] !== undefined) data["AreaCodeGeomatch"] = serialize.bool(params["areaCodeGeomatch"]); if (params["validityPeriod"] !== undefined) data["ValidityPeriod"] = params["validityPeriod"]; if (params["synchronousValidation"] !== undefined) data["SynchronousValidation"] = serialize.bool(params["synchronousValidation"]); if (params["usecase"] !== undefined) data["Usecase"] = params["usecase"]; if (params["useInboundWebhookOnNumber"] !== undefined) data["UseInboundWebhookOnNumber"] = serialize.bool(params["useInboundWebhookOnNumber"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { 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.inboundRequestUrl = payload.inbound_request_url; this.inboundMethod = payload.inbound_method; this.fallbackUrl = payload.fallback_url; this.fallbackMethod = payload.fallback_method; this.statusCallback = payload.status_callback; this.stickySender = payload.sticky_sender; this.mmsConverter = payload.mms_converter; this.smartEncoding = payload.smart_encoding; this.scanMessageContent = payload.scan_message_content; this.fallbackToLongCode = payload.fallback_to_long_code; this.areaCodeGeomatch = payload.area_code_geomatch; this.synchronousValidation = payload.synchronous_validation; this.validityPeriod = deserialize.integer(payload.validity_period); this.url = payload.url; this.links = payload.links; this.usecase = payload.usecase; this.usAppToPersonRegistered = payload.us_app_to_person_registered; this.useInboundWebhookOnNumber = payload.use_inbound_webhook_on_number; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the alphaSenders. */ alphaSenders() { return this._proxy.alphaSenders; } /** * Access the channelSenders. */ channelSenders() { return this._proxy.channelSenders; } /** * Access the phoneNumbers. */ phoneNumbers() { return this._proxy.phoneNumbers; } /** * Access the shortCodes. */ shortCodes() { return this._proxy.shortCodes; } /** * Access the usAppToPerson. */ usAppToPerson() { return this._proxy.usAppToPerson; } /** * Access the usAppToPersonUsecases. */ usAppToPersonUsecases() { return this._proxy.usAppToPersonUsecases; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, inboundRequestUrl: this.inboundRequestUrl, inboundMethod: this.inboundMethod, fallbackUrl: this.fallbackUrl, fallbackMethod: this.fallbackMethod, statusCallback: this.statusCallback, stickySender: this.stickySender, mmsConverter: this.mmsConverter, smartEncoding: this.smartEncoding, scanMessageContent: this.scanMessageContent, fallbackToLongCode: this.fallbackToLongCode, areaCodeGeomatch: this.areaCodeGeomatch, synchronousValidation: this.synchronousValidation, validityPeriod: this.validityPeriod, url: this.url, links: this.links, usecase: this.usecase, usAppToPersonRegistered: this.usAppToPersonRegistered, useInboundWebhookOnNumber: this.useInboundWebhookOnNumber, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; if (params["inboundRequestUrl"] !== undefined) data["InboundRequestUrl"] = params["inboundRequestUrl"]; if (params["inboundMethod"] !== undefined) data["InboundMethod"] = params["inboundMethod"]; if (params["fallbackUrl"] !== undefined) data["FallbackUrl"] = params["fallbackUrl"]; if (params["fallbackMethod"] !== undefined) data["FallbackMethod"] = params["fallbackMethod"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["stickySender"] !== undefined) data["StickySender"] = serialize.bool(params["stickySender"]); if (params["mmsConverter"] !== undefined) data["MmsConverter"] = serialize.bool(params["mmsConverter"]); if (params["smartEncoding"] !== undefined) data["SmartEncoding"] = serialize.bool(params["smartEncoding"]); if (params["scanMessageContent"] !== undefined) data["ScanMessageContent"] = params["scanMessageContent"]; if (params["fallbackToLongCode"] !== undefined) data["FallbackToLongCode"] = serialize.bool(params["fallbackToLongCode"]); if (params["areaCodeGeomatch"] !== undefined) data["AreaCodeGeomatch"] = serialize.bool(params["areaCodeGeomatch"]); if (params["validityPeriod"] !== undefined) data["ValidityPeriod"] = params["validityPeriod"]; if (params["synchronousValidation"] !== undefined) data["SynchronousValidation"] = serialize.bool(params["synchronousValidation"]); if (params["usecase"] !== undefined) data["Usecase"] = params["usecase"]; if (params["useInboundWebhookOnNumber"] !== undefined) data["UseInboundWebhookOnNumber"] = serialize.bool(params["useInboundWebhookOnNumber"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/messaging/v1/domainCerts.d.ts000064400000013124151677225100013075 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to update a DomainCertsInstance */ export interface DomainCertsContextUpdateOptions { /** Contains the full TLS certificate and private for this domain in PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail. Twilio uses this information to process HTTPS traffic sent to your domain. */ tlsCert: string; } export interface DomainCertsContext { /** * Remove a DomainCertsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DomainCertsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainCertsInstance */ fetch(callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>; /** * Update a DomainCertsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainCertsInstance */ update(params: DomainCertsContextUpdateOptions, callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DomainCertsContextSolution { domainSid: string; } export declare class DomainCertsContextImpl implements DomainCertsContext { protected _version: V1; protected _solution: DomainCertsContextSolution; protected _uri: string; constructor(_version: V1, domainSid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>; update(params: DomainCertsContextUpdateOptions, callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DomainCertsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DomainCertsResource { domain_sid: string; date_updated: Date; date_expires: Date; date_created: Date; domain_name: string; certificate_sid: string; url: string; cert_in_validation: any; } export declare class DomainCertsInstance { protected _version: V1; protected _solution: DomainCertsContextSolution; protected _context?: DomainCertsContext; constructor(_version: V1, payload: DomainCertsResource, domainSid?: string); /** * The unique string that we created to identify the Domain resource. */ domainSid: string; /** * Date that this Domain was last updated. */ dateUpdated: Date; /** * Date that the private certificate associated with this domain expires. You will need to update the certificate before that date to ensure your shortened links will continue to work. */ dateExpires: Date; /** * Date that this Domain was registered to the Twilio platform to create a new Domain object. */ dateCreated: Date; /** * Full url path for this domain. */ domainName: string; /** * The unique string that we created to identify this Certificate resource. */ certificateSid: string; url: string; /** * Optional JSON field describing the status and upload date of a new certificate in the process of validation */ certInValidation: any; private get _proxy(); /** * Remove a DomainCertsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a DomainCertsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainCertsInstance */ fetch(callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>; /** * Update a DomainCertsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainCertsInstance */ update(params: DomainCertsContextUpdateOptions, callback?: (error: Error | null, item?: DomainCertsInstance) => any): Promise<DomainCertsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { domainSid: string; dateUpdated: Date; dateExpires: Date; dateCreated: Date; domainName: string; certificateSid: string; url: string; certInValidation: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DomainCertsSolution { } export interface DomainCertsListInstance { _version: V1; _solution: DomainCertsSolution; _uri: string; (domainSid: string): DomainCertsContext; get(domainSid: string): DomainCertsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DomainCertsListInstance(version: V1): DomainCertsListInstance; export {}; rest/messaging/v1/linkshorteningMessagingServiceDomainAssociation.js000064400000011070151677225100022131 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.LinkshorteningMessagingServiceDomainAssociationListInstance = exports.LinkshorteningMessagingServiceDomainAssociationInstance = exports.LinkshorteningMessagingServiceDomainAssociationContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class LinkshorteningMessagingServiceDomainAssociationContextImpl { constructor(_version, messagingServiceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) { throw new Error("Parameter 'messagingServiceSid' is not valid."); } this._solution = { messagingServiceSid }; this._uri = `/LinkShortening/MessagingServices/${messagingServiceSid}/Domain`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new LinkshorteningMessagingServiceDomainAssociationInstance(operationVersion, payload, instance._solution.messagingServiceSid)); 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.LinkshorteningMessagingServiceDomainAssociationContextImpl = LinkshorteningMessagingServiceDomainAssociationContextImpl; class LinkshorteningMessagingServiceDomainAssociationInstance { constructor(_version, payload, messagingServiceSid) { this._version = _version; this.domainSid = payload.domain_sid; this.messagingServiceSid = payload.messaging_service_sid; this.url = payload.url; this._solution = { messagingServiceSid: messagingServiceSid || this.messagingServiceSid, }; } get _proxy() { this._context = this._context || new LinkshorteningMessagingServiceDomainAssociationContextImpl(this._version, this._solution.messagingServiceSid); return this._context; } /** * Fetch a LinkshorteningMessagingServiceDomainAssociationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed LinkshorteningMessagingServiceDomainAssociationInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { domainSid: this.domainSid, messagingServiceSid: this.messagingServiceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LinkshorteningMessagingServiceDomainAssociationInstance = LinkshorteningMessagingServiceDomainAssociationInstance; function LinkshorteningMessagingServiceDomainAssociationListInstance(version) { const instance = ((messagingServiceSid) => instance.get(messagingServiceSid)); instance.get = function get(messagingServiceSid) { return new LinkshorteningMessagingServiceDomainAssociationContextImpl(version, messagingServiceSid); }; 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; } exports.LinkshorteningMessagingServiceDomainAssociationListInstance = LinkshorteningMessagingServiceDomainAssociationListInstance; rest/messaging/v1/brandRegistration.d.ts000064400000034723151677225100014316 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { BrandRegistrationOtpListInstance } from "./brandRegistration/brandRegistrationOtp"; import { BrandVettingListInstance } from "./brandRegistration/brandVetting"; export type BrandRegistrationBrandFeedback = "TAX_ID" | "STOCK_SYMBOL" | "NONPROFIT" | "GOVERNMENT_ENTITY" | "OTHERS"; export type BrandRegistrationIdentityStatus = "SELF_DECLARED" | "UNVERIFIED" | "VERIFIED" | "VETTED_VERIFIED"; export type BrandRegistrationStatus = "PENDING" | "APPROVED" | "FAILED" | "IN_REVIEW" | "DELETED"; /** * Options to pass to create a BrandRegistrationInstance */ export interface BrandRegistrationListInstanceCreateOptions { /** Customer Profile Bundle Sid. */ customerProfileBundleSid: string; /** A2P Messaging Profile Bundle Sid. */ a2PProfileBundleSid: string; /** Type of brand being created. One of: \\\"STANDARD\\\", \\\"SOLE_PROPRIETOR\\\". SOLE_PROPRIETOR is for low volume, SOLE_PROPRIETOR use cases. STANDARD is for all other use cases. */ brandType?: string; /** A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. */ mock?: boolean; /** A flag to disable automatic secondary vetting for brands which it would otherwise be done. */ skipAutomaticSecVet?: boolean; } /** * Options to pass to each */ export interface BrandRegistrationListInstanceEachOptions { /** 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: BrandRegistrationInstance, 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 BrandRegistrationListInstanceOptions { /** 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 BrandRegistrationListInstancePageOptions { /** 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 BrandRegistrationContext { brandRegistrationOtps: BrandRegistrationOtpListInstance; brandVettings: BrandVettingListInstance; /** * Fetch a BrandRegistrationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandRegistrationInstance */ fetch(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>; /** * Update a BrandRegistrationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandRegistrationInstance */ update(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BrandRegistrationContextSolution { sid: string; } export declare class BrandRegistrationContextImpl implements BrandRegistrationContext { protected _version: V1; protected _solution: BrandRegistrationContextSolution; protected _uri: string; protected _brandRegistrationOtps?: BrandRegistrationOtpListInstance; protected _brandVettings?: BrandVettingListInstance; constructor(_version: V1, sid: string); get brandRegistrationOtps(): BrandRegistrationOtpListInstance; get brandVettings(): BrandVettingListInstance; fetch(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>; update(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BrandRegistrationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BrandRegistrationPayload extends TwilioResponsePayload { data: BrandRegistrationResource[]; } interface BrandRegistrationResource { sid: string; account_sid: string; customer_profile_bundle_sid: string; a2p_profile_bundle_sid: string; date_created: Date; date_updated: Date; brand_type: string; status: BrandRegistrationStatus; tcr_id: string; failure_reason: string; errors: Array<any>; url: string; brand_score: number; brand_feedback: Array<BrandRegistrationBrandFeedback>; identity_status: BrandRegistrationIdentityStatus; russell_3000: boolean; government_entity: boolean; tax_exempt_status: string; skip_automatic_sec_vet: boolean; mock: boolean; links: Record<string, string>; } export declare class BrandRegistrationInstance { protected _version: V1; protected _solution: BrandRegistrationContextSolution; protected _context?: BrandRegistrationContext; constructor(_version: V1, payload: BrandRegistrationResource, sid?: string); /** * The unique string to identify Brand Registration. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. */ accountSid: string; /** * A2P Messaging Profile Bundle BundleSid. */ customerProfileBundleSid: string; /** * A2P Messaging Profile Bundle BundleSid. */ a2pProfileBundleSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * Type of brand. One of: \"STANDARD\", \"SOLE_PROPRIETOR\". SOLE_PROPRIETOR is for the low volume, SOLE_PROPRIETOR campaign use case. There can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand. */ brandType: string; status: BrandRegistrationStatus; /** * Campaign Registry (TCR) Brand ID. Assigned only after successful brand registration. */ tcrId: string; /** * DEPRECATED. A reason why brand registration has failed. Only applicable when status is FAILED. */ failureReason: string; /** * A list of errors that occurred during the brand registration process. */ errors: Array<any>; /** * The absolute URL of the Brand Registration resource. */ url: string; /** * The secondary vetting score if it was done. Otherwise, it will be the brand score if it\'s returned from TCR. It may be null if no score is available. */ brandScore: number; /** * DEPRECATED. Feedback on how to improve brand score */ brandFeedback: Array<BrandRegistrationBrandFeedback>; identityStatus: BrandRegistrationIdentityStatus; /** * Publicly traded company identified in the Russell 3000 Index */ russell3000: boolean; /** * Identified as a government entity */ governmentEntity: boolean; /** * Nonprofit organization tax-exempt status per section 501 of the U.S. tax code. */ taxExemptStatus: string; /** * A flag to disable automatic secondary vetting for brands which it would otherwise be done. */ skipAutomaticSecVet: boolean; /** * A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. */ mock: boolean; links: Record<string, string>; private get _proxy(); /** * Fetch a BrandRegistrationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandRegistrationInstance */ fetch(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>; /** * Update a BrandRegistrationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandRegistrationInstance */ update(callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>; /** * Access the brandRegistrationOtps. */ brandRegistrationOtps(): BrandRegistrationOtpListInstance; /** * Access the brandVettings. */ brandVettings(): BrandVettingListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; customerProfileBundleSid: string; a2pProfileBundleSid: string; dateCreated: Date; dateUpdated: Date; brandType: string; status: BrandRegistrationStatus; tcrId: string; failureReason: string; errors: any[]; url: string; brandScore: number; brandFeedback: BrandRegistrationBrandFeedback[]; identityStatus: BrandRegistrationIdentityStatus; russell3000: boolean; governmentEntity: boolean; taxExemptStatus: string; skipAutomaticSecVet: boolean; mock: boolean; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BrandRegistrationSolution { } export interface BrandRegistrationListInstance { _version: V1; _solution: BrandRegistrationSolution; _uri: string; (sid: string): BrandRegistrationContext; get(sid: string): BrandRegistrationContext; /** * Create a BrandRegistrationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandRegistrationInstance */ create(params: BrandRegistrationListInstanceCreateOptions, callback?: (error: Error | null, item?: BrandRegistrationInstance) => any): Promise<BrandRegistrationInstance>; /** * Streams BrandRegistrationInstance 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 { BrandRegistrationListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BrandRegistrationInstance, done: (err?: Error) => void) => void): void; each(params: BrandRegistrationListInstanceEachOptions, callback?: (item: BrandRegistrationInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BrandRegistrationInstance 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: BrandRegistrationPage) => any): Promise<BrandRegistrationPage>; /** * Lists BrandRegistrationInstance 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 { BrandRegistrationListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BrandRegistrationInstance[]) => any): Promise<BrandRegistrationInstance[]>; list(params: BrandRegistrationListInstanceOptions, callback?: (error: Error | null, items: BrandRegistrationInstance[]) => any): Promise<BrandRegistrationInstance[]>; /** * Retrieve a single page of BrandRegistrationInstance 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 { BrandRegistrationListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BrandRegistrationPage) => any): Promise<BrandRegistrationPage>; page(params: BrandRegistrationListInstancePageOptions, callback?: (error: Error | null, items: BrandRegistrationPage) => any): Promise<BrandRegistrationPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BrandRegistrationListInstance(version: V1): BrandRegistrationListInstance; export declare class BrandRegistrationPage extends Page<V1, BrandRegistrationPayload, BrandRegistrationResource, BrandRegistrationInstance> { /** * Initialize the BrandRegistrationPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: BrandRegistrationSolution); /** * Build an instance of BrandRegistrationInstance * * @param payload - Payload response from the API */ getInstance(payload: BrandRegistrationResource): BrandRegistrationInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/linkshorteningMessagingService.js000064400000012332151677225100016606 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.LinkshorteningMessagingServiceListInstance = exports.LinkshorteningMessagingServiceInstance = exports.LinkshorteningMessagingServiceContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class LinkshorteningMessagingServiceContextImpl { constructor(_version, domainSid, messagingServiceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) { throw new Error("Parameter 'messagingServiceSid' is not valid."); } this._solution = { domainSid, messagingServiceSid }; this._uri = `/LinkShortening/Domains/${domainSid}/MessagingServices/${messagingServiceSid}`; } create(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", }); operationPromise = operationPromise.then((payload) => new LinkshorteningMessagingServiceInstance(operationVersion, payload, instance._solution.domainSid, instance._solution.messagingServiceSid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); 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.LinkshorteningMessagingServiceContextImpl = LinkshorteningMessagingServiceContextImpl; class LinkshorteningMessagingServiceInstance { constructor(_version, payload, domainSid, messagingServiceSid) { this._version = _version; this.domainSid = payload.domain_sid; this.messagingServiceSid = payload.messaging_service_sid; this.url = payload.url; this._solution = { domainSid: domainSid || this.domainSid, messagingServiceSid: messagingServiceSid || this.messagingServiceSid, }; } get _proxy() { this._context = this._context || new LinkshorteningMessagingServiceContextImpl(this._version, this._solution.domainSid, this._solution.messagingServiceSid); return this._context; } /** * Create a LinkshorteningMessagingServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed LinkshorteningMessagingServiceInstance */ create(callback) { return this._proxy.create(callback); } /** * Remove a LinkshorteningMessagingServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { domainSid: this.domainSid, messagingServiceSid: this.messagingServiceSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LinkshorteningMessagingServiceInstance = LinkshorteningMessagingServiceInstance; function LinkshorteningMessagingServiceListInstance(version) { const instance = ((domainSid, messagingServiceSid) => instance.get(domainSid, messagingServiceSid)); instance.get = function get(domainSid, messagingServiceSid) { return new LinkshorteningMessagingServiceContextImpl(version, domainSid, messagingServiceSid); }; 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; } exports.LinkshorteningMessagingServiceListInstance = LinkshorteningMessagingServiceListInstance; rest/messaging/v1/deactivations.d.ts000064400000007502151677225100013465 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to fetch a DeactivationsInstance */ export interface DeactivationsContextFetchOptions { /** The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format. */ date?: Date; } export interface DeactivationsContext { /** * Fetch a DeactivationsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeactivationsInstance */ fetch(callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>; /** * Fetch a DeactivationsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeactivationsInstance */ fetch(params: DeactivationsContextFetchOptions, callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DeactivationsContextSolution { } export declare class DeactivationsContextImpl implements DeactivationsContext { protected _version: V1; protected _solution: DeactivationsContextSolution; protected _uri: string; constructor(_version: V1); fetch(params?: DeactivationsContextFetchOptions | ((error: Error | null, item?: DeactivationsInstance) => any), callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DeactivationsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DeactivationsResource { redirect_to: string; } export declare class DeactivationsInstance { protected _version: V1; protected _solution: DeactivationsContextSolution; protected _context?: DeactivationsContext; constructor(_version: V1, payload: DeactivationsResource); /** * Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes. */ redirectTo: string; private get _proxy(); /** * Fetch a DeactivationsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeactivationsInstance */ fetch(callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>; /** * Fetch a DeactivationsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeactivationsInstance */ fetch(params: DeactivationsContextFetchOptions, callback?: (error: Error | null, item?: DeactivationsInstance) => any): Promise<DeactivationsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { redirectTo: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DeactivationsSolution { } export interface DeactivationsListInstance { _version: V1; _solution: DeactivationsSolution; _uri: string; (): DeactivationsContext; get(): DeactivationsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DeactivationsListInstance(version: V1): DeactivationsListInstance; export {}; rest/messaging/v1/linkshorteningMessagingServiceDomainAssociation.d.ts000064400000007554151677225100022401 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export interface LinkshorteningMessagingServiceDomainAssociationContext { /** * Fetch a LinkshorteningMessagingServiceDomainAssociationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed LinkshorteningMessagingServiceDomainAssociationInstance */ fetch(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceDomainAssociationInstance) => any): Promise<LinkshorteningMessagingServiceDomainAssociationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface LinkshorteningMessagingServiceDomainAssociationContextSolution { messagingServiceSid: string; } export declare class LinkshorteningMessagingServiceDomainAssociationContextImpl implements LinkshorteningMessagingServiceDomainAssociationContext { protected _version: V1; protected _solution: LinkshorteningMessagingServiceDomainAssociationContextSolution; protected _uri: string; constructor(_version: V1, messagingServiceSid: string); fetch(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceDomainAssociationInstance) => any): Promise<LinkshorteningMessagingServiceDomainAssociationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): LinkshorteningMessagingServiceDomainAssociationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface LinkshorteningMessagingServiceDomainAssociationResource { domain_sid: string; messaging_service_sid: string; url: string; } export declare class LinkshorteningMessagingServiceDomainAssociationInstance { protected _version: V1; protected _solution: LinkshorteningMessagingServiceDomainAssociationContextSolution; protected _context?: LinkshorteningMessagingServiceDomainAssociationContext; constructor(_version: V1, payload: LinkshorteningMessagingServiceDomainAssociationResource, messagingServiceSid?: string); /** * The unique string that we created to identify the Domain resource. */ domainSid: string; /** * The unique string that identifies the messaging service */ messagingServiceSid: string; url: string; private get _proxy(); /** * Fetch a LinkshorteningMessagingServiceDomainAssociationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed LinkshorteningMessagingServiceDomainAssociationInstance */ fetch(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceDomainAssociationInstance) => any): Promise<LinkshorteningMessagingServiceDomainAssociationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { domainSid: string; messagingServiceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface LinkshorteningMessagingServiceDomainAssociationSolution { } export interface LinkshorteningMessagingServiceDomainAssociationListInstance { _version: V1; _solution: LinkshorteningMessagingServiceDomainAssociationSolution; _uri: string; (messagingServiceSid: string): LinkshorteningMessagingServiceDomainAssociationContext; get(messagingServiceSid: string): LinkshorteningMessagingServiceDomainAssociationContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function LinkshorteningMessagingServiceDomainAssociationListInstance(version: V1): LinkshorteningMessagingServiceDomainAssociationListInstance; export {}; rest/messaging/v1/brandRegistration.js000064400000026505151677225100014061 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.BrandRegistrationPage = exports.BrandRegistrationListInstance = exports.BrandRegistrationInstance = exports.BrandRegistrationContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const brandRegistrationOtp_1 = require("./brandRegistration/brandRegistrationOtp"); const brandVetting_1 = require("./brandRegistration/brandVetting"); class BrandRegistrationContextImpl { 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 = `/a2p/BrandRegistrations/${sid}`; } get brandRegistrationOtps() { this._brandRegistrationOtps = this._brandRegistrationOtps || (0, brandRegistrationOtp_1.BrandRegistrationOtpListInstance)(this._version, this._solution.sid); return this._brandRegistrationOtps; } get brandVettings() { this._brandVettings = this._brandVettings || (0, brandVetting_1.BrandVettingListInstance)(this._version, this._solution.sid); return this._brandVettings; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BrandRegistrationInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", }); operationPromise = operationPromise.then((payload) => new BrandRegistrationInstance(operationVersion, payload, 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.BrandRegistrationContextImpl = BrandRegistrationContextImpl; class BrandRegistrationInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.customerProfileBundleSid = payload.customer_profile_bundle_sid; this.a2pProfileBundleSid = payload.a2p_profile_bundle_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.brandType = payload.brand_type; this.status = payload.status; this.tcrId = payload.tcr_id; this.failureReason = payload.failure_reason; this.errors = payload.errors; this.url = payload.url; this.brandScore = deserialize.integer(payload.brand_score); this.brandFeedback = payload.brand_feedback; this.identityStatus = payload.identity_status; this.russell3000 = payload.russell_3000; this.governmentEntity = payload.government_entity; this.taxExemptStatus = payload.tax_exempt_status; this.skipAutomaticSecVet = payload.skip_automatic_sec_vet; this.mock = payload.mock; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new BrandRegistrationContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a BrandRegistrationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandRegistrationInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Update a BrandRegistrationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BrandRegistrationInstance */ update(callback) { return this._proxy.update(callback); } /** * Access the brandRegistrationOtps. */ brandRegistrationOtps() { return this._proxy.brandRegistrationOtps; } /** * Access the brandVettings. */ brandVettings() { return this._proxy.brandVettings; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, customerProfileBundleSid: this.customerProfileBundleSid, a2pProfileBundleSid: this.a2pProfileBundleSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, brandType: this.brandType, status: this.status, tcrId: this.tcrId, failureReason: this.failureReason, errors: this.errors, url: this.url, brandScore: this.brandScore, brandFeedback: this.brandFeedback, identityStatus: this.identityStatus, russell3000: this.russell3000, governmentEntity: this.governmentEntity, taxExemptStatus: this.taxExemptStatus, skipAutomaticSecVet: this.skipAutomaticSecVet, mock: this.mock, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BrandRegistrationInstance = BrandRegistrationInstance; function BrandRegistrationListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new BrandRegistrationContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/a2p/BrandRegistrations`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["customerProfileBundleSid"] === null || params["customerProfileBundleSid"] === undefined) { throw new Error("Required parameter \"params['customerProfileBundleSid']\" missing."); } if (params["a2PProfileBundleSid"] === null || params["a2PProfileBundleSid"] === undefined) { throw new Error("Required parameter \"params['a2PProfileBundleSid']\" missing."); } let data = {}; data["CustomerProfileBundleSid"] = params["customerProfileBundleSid"]; data["A2PProfileBundleSid"] = params["a2PProfileBundleSid"]; if (params["brandType"] !== undefined) data["BrandType"] = params["brandType"]; if (params["mock"] !== undefined) data["Mock"] = serialize.bool(params["mock"]); if (params["skipAutomaticSecVet"] !== undefined) data["SkipAutomaticSecVet"] = serialize.bool(params["skipAutomaticSecVet"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BrandRegistrationInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BrandRegistrationPage(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 BrandRegistrationPage(instance._version, payload, 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; } exports.BrandRegistrationListInstance = BrandRegistrationListInstance; class BrandRegistrationPage extends Page_1.default { /** * Initialize the BrandRegistrationPage * * @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 BrandRegistrationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BrandRegistrationInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BrandRegistrationPage = BrandRegistrationPage; rest/messaging/v1/service/usAppToPerson.js000064400000040452151677225100014617 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.UsAppToPersonPage = exports.UsAppToPersonListInstance = exports.UsAppToPersonInstance = exports.UsAppToPersonContextImpl = void 0; 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 UsAppToPersonContextImpl { constructor(_version, messagingServiceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) { throw new Error("Parameter 'messagingServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { messagingServiceSid, sid }; this._uri = `/Services/${messagingServiceSid}/Compliance/Usa2p/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UsAppToPersonInstance(operationVersion, payload, instance._solution.messagingServiceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["hasEmbeddedLinks"] === null || params["hasEmbeddedLinks"] === undefined) { throw new Error("Required parameter \"params['hasEmbeddedLinks']\" missing."); } if (params["hasEmbeddedPhone"] === null || params["hasEmbeddedPhone"] === undefined) { throw new Error("Required parameter \"params['hasEmbeddedPhone']\" missing."); } if (params["messageSamples"] === null || params["messageSamples"] === undefined) { throw new Error("Required parameter \"params['messageSamples']\" missing."); } if (params["messageFlow"] === null || params["messageFlow"] === undefined) { throw new Error("Required parameter \"params['messageFlow']\" missing."); } if (params["description"] === null || params["description"] === undefined) { throw new Error("Required parameter \"params['description']\" missing."); } if (params["ageGated"] === null || params["ageGated"] === undefined) { throw new Error("Required parameter \"params['ageGated']\" missing."); } if (params["directLending"] === null || params["directLending"] === undefined) { throw new Error("Required parameter \"params['directLending']\" missing."); } let data = {}; data["HasEmbeddedLinks"] = serialize.bool(params["hasEmbeddedLinks"]); data["HasEmbeddedPhone"] = serialize.bool(params["hasEmbeddedPhone"]); data["MessageSamples"] = serialize.map(params["messageSamples"], (e) => e); data["MessageFlow"] = params["messageFlow"]; data["Description"] = params["description"]; data["AgeGated"] = serialize.bool(params["ageGated"]); data["DirectLending"] = serialize.bool(params["directLending"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UsAppToPersonInstance(operationVersion, payload, instance._solution.messagingServiceSid, 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.UsAppToPersonContextImpl = UsAppToPersonContextImpl; class UsAppToPersonInstance { constructor(_version, payload, messagingServiceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.brandRegistrationSid = payload.brand_registration_sid; this.messagingServiceSid = payload.messaging_service_sid; this.description = payload.description; this.messageSamples = payload.message_samples; this.usAppToPersonUsecase = payload.us_app_to_person_usecase; this.hasEmbeddedLinks = payload.has_embedded_links; this.hasEmbeddedPhone = payload.has_embedded_phone; this.subscriberOptIn = payload.subscriber_opt_in; this.ageGated = payload.age_gated; this.directLending = payload.direct_lending; this.campaignStatus = payload.campaign_status; this.campaignId = payload.campaign_id; this.isExternallyRegistered = payload.is_externally_registered; this.rateLimits = payload.rate_limits; this.messageFlow = payload.message_flow; this.optInMessage = payload.opt_in_message; this.optOutMessage = payload.opt_out_message; this.helpMessage = payload.help_message; this.optInKeywords = payload.opt_in_keywords; this.optOutKeywords = payload.opt_out_keywords; this.helpKeywords = payload.help_keywords; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.mock = payload.mock; this.errors = payload.errors; this._solution = { messagingServiceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new UsAppToPersonContextImpl(this._version, this._solution.messagingServiceSid, this._solution.sid); return this._context; } /** * Remove a UsAppToPersonInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a UsAppToPersonInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UsAppToPersonInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, brandRegistrationSid: this.brandRegistrationSid, messagingServiceSid: this.messagingServiceSid, description: this.description, messageSamples: this.messageSamples, usAppToPersonUsecase: this.usAppToPersonUsecase, hasEmbeddedLinks: this.hasEmbeddedLinks, hasEmbeddedPhone: this.hasEmbeddedPhone, subscriberOptIn: this.subscriberOptIn, ageGated: this.ageGated, directLending: this.directLending, campaignStatus: this.campaignStatus, campaignId: this.campaignId, isExternallyRegistered: this.isExternallyRegistered, rateLimits: this.rateLimits, messageFlow: this.messageFlow, optInMessage: this.optInMessage, optOutMessage: this.optOutMessage, helpMessage: this.helpMessage, optInKeywords: this.optInKeywords, optOutKeywords: this.optOutKeywords, helpKeywords: this.helpKeywords, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, mock: this.mock, errors: this.errors, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsAppToPersonInstance = UsAppToPersonInstance; function UsAppToPersonListInstance(version, messagingServiceSid) { if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) { throw new Error("Parameter 'messagingServiceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new UsAppToPersonContextImpl(version, messagingServiceSid, sid); }; instance._version = version; instance._solution = { messagingServiceSid }; instance._uri = `/Services/${messagingServiceSid}/Compliance/Usa2p`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["brandRegistrationSid"] === null || params["brandRegistrationSid"] === undefined) { throw new Error("Required parameter \"params['brandRegistrationSid']\" missing."); } if (params["description"] === null || params["description"] === undefined) { throw new Error("Required parameter \"params['description']\" missing."); } if (params["messageFlow"] === null || params["messageFlow"] === undefined) { throw new Error("Required parameter \"params['messageFlow']\" missing."); } if (params["messageSamples"] === null || params["messageSamples"] === undefined) { throw new Error("Required parameter \"params['messageSamples']\" missing."); } if (params["usAppToPersonUsecase"] === null || params["usAppToPersonUsecase"] === undefined) { throw new Error("Required parameter \"params['usAppToPersonUsecase']\" missing."); } if (params["hasEmbeddedLinks"] === null || params["hasEmbeddedLinks"] === undefined) { throw new Error("Required parameter \"params['hasEmbeddedLinks']\" missing."); } if (params["hasEmbeddedPhone"] === null || params["hasEmbeddedPhone"] === undefined) { throw new Error("Required parameter \"params['hasEmbeddedPhone']\" missing."); } let data = {}; data["BrandRegistrationSid"] = params["brandRegistrationSid"]; data["Description"] = params["description"]; data["MessageFlow"] = params["messageFlow"]; data["MessageSamples"] = serialize.map(params["messageSamples"], (e) => e); data["UsAppToPersonUsecase"] = params["usAppToPersonUsecase"]; data["HasEmbeddedLinks"] = serialize.bool(params["hasEmbeddedLinks"]); data["HasEmbeddedPhone"] = serialize.bool(params["hasEmbeddedPhone"]); if (params["optInMessage"] !== undefined) data["OptInMessage"] = params["optInMessage"]; if (params["optOutMessage"] !== undefined) data["OptOutMessage"] = params["optOutMessage"]; if (params["helpMessage"] !== undefined) data["HelpMessage"] = params["helpMessage"]; if (params["optInKeywords"] !== undefined) data["OptInKeywords"] = serialize.map(params["optInKeywords"], (e) => e); if (params["optOutKeywords"] !== undefined) data["OptOutKeywords"] = serialize.map(params["optOutKeywords"], (e) => e); if (params["helpKeywords"] !== undefined) data["HelpKeywords"] = serialize.map(params["helpKeywords"], (e) => e); if (params["subscriberOptIn"] !== undefined) data["SubscriberOptIn"] = serialize.bool(params["subscriberOptIn"]); if (params["ageGated"] !== undefined) data["AgeGated"] = serialize.bool(params["ageGated"]); if (params["directLending"] !== undefined) data["DirectLending"] = serialize.bool(params["directLending"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new UsAppToPersonInstance(operationVersion, payload, instance._solution.messagingServiceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UsAppToPersonPage(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 UsAppToPersonPage(instance._version, payload, 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; } exports.UsAppToPersonListInstance = UsAppToPersonListInstance; class UsAppToPersonPage extends Page_1.default { /** * Initialize the UsAppToPersonPage * * @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 UsAppToPersonInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UsAppToPersonInstance(this._version, payload, this._solution.messagingServiceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsAppToPersonPage = UsAppToPersonPage; rest/messaging/v1/service/usAppToPerson.d.ts000064400000053510151677225100015052 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to update a UsAppToPersonInstance */ export interface UsAppToPersonContextUpdateOptions { /** Indicates that this SMS campaign will send messages that contain links. */ hasEmbeddedLinks: boolean; /** Indicates that this SMS campaign will send messages that contain phone numbers. */ hasEmbeddedPhone: boolean; /** An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. */ messageSamples: Array<string>; /** Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. */ messageFlow: string; /** A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. */ description: string; /** A boolean that specifies whether campaign requires age gate for federally legal content. */ ageGated: boolean; /** A boolean that specifies whether campaign allows direct lending or not. */ directLending: boolean; } /** * Options to pass to create a UsAppToPersonInstance */ export interface UsAppToPersonListInstanceCreateOptions { /** A2P Brand Registration SID */ brandRegistrationSid: string; /** A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. */ description: string; /** Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. */ messageFlow: string; /** An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. */ messageSamples: Array<string>; /** A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] */ usAppToPersonUsecase: string; /** Indicates that this SMS campaign will send messages that contain links. */ hasEmbeddedLinks: boolean; /** Indicates that this SMS campaign will send messages that contain phone numbers. */ hasEmbeddedPhone: boolean; /** If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. */ optInMessage?: string; /** Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio\\\'s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. */ optOutMessage?: string; /** When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio\\\'s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. */ helpMessage?: string; /** If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. */ optInKeywords?: Array<string>; /** End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio\\\'s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. */ optOutKeywords?: Array<string>; /** End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio\\\'s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. */ helpKeywords?: Array<string>; /** A boolean that specifies whether campaign has Subscriber Optin or not. */ subscriberOptIn?: boolean; /** A boolean that specifies whether campaign is age gated or not. */ ageGated?: boolean; /** A boolean that specifies whether campaign allows direct lending or not. */ directLending?: boolean; } /** * Options to pass to each */ export interface UsAppToPersonListInstanceEachOptions { /** 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: UsAppToPersonInstance, 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 UsAppToPersonListInstanceOptions { /** 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 UsAppToPersonListInstancePageOptions { /** 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 UsAppToPersonContext { /** * Remove a UsAppToPersonInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UsAppToPersonInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UsAppToPersonInstance */ fetch(callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>; /** * Update a UsAppToPersonInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UsAppToPersonInstance */ update(params: UsAppToPersonContextUpdateOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface UsAppToPersonContextSolution { messagingServiceSid: string; sid: string; } export declare class UsAppToPersonContextImpl implements UsAppToPersonContext { protected _version: V1; protected _solution: UsAppToPersonContextSolution; protected _uri: string; constructor(_version: V1, messagingServiceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>; update(params: UsAppToPersonContextUpdateOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): UsAppToPersonContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface UsAppToPersonPayload extends TwilioResponsePayload { compliance: UsAppToPersonResource[]; } interface UsAppToPersonResource { sid: string; account_sid: string; brand_registration_sid: string; messaging_service_sid: string; description: string; message_samples: Array<string>; us_app_to_person_usecase: string; has_embedded_links: boolean; has_embedded_phone: boolean; subscriber_opt_in: boolean; age_gated: boolean; direct_lending: boolean; campaign_status: string; campaign_id: string; is_externally_registered: boolean; rate_limits: any; message_flow: string; opt_in_message: string; opt_out_message: string; help_message: string; opt_in_keywords: Array<string>; opt_out_keywords: Array<string>; help_keywords: Array<string>; date_created: Date; date_updated: Date; url: string; mock: boolean; errors: Array<any>; } export declare class UsAppToPersonInstance { protected _version: V1; protected _solution: UsAppToPersonContextSolution; protected _context?: UsAppToPersonContext; constructor(_version: V1, payload: UsAppToPersonResource, messagingServiceSid: string, sid?: string); /** * The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. */ accountSid: string; /** * The unique string to identify the A2P brand. */ brandRegistrationSid: string; /** * The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. */ messagingServiceSid: string; /** * A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. */ description: string; /** * An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. */ messageSamples: Array<string>; /** * A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand. */ usAppToPersonUsecase: string; /** * Indicate that this SMS campaign will send messages that contain links. */ hasEmbeddedLinks: boolean; /** * Indicates that this SMS campaign will send messages that contain phone numbers. */ hasEmbeddedPhone: boolean; /** * A boolean that specifies whether campaign has Subscriber Optin or not. */ subscriberOptIn: boolean; /** * A boolean that specifies whether campaign is age gated or not. */ ageGated: boolean; /** * A boolean that specifies whether campaign allows direct lending or not. */ directLending: boolean; /** * Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED. */ campaignStatus: string; /** * The Campaign Registry (TCR) Campaign ID. */ campaignId: string; /** * Indicates whether the campaign was registered externally or not. */ isExternallyRegistered: boolean; /** * Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile. */ rateLimits: any; /** * Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. */ messageFlow: string; /** * If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. */ optInMessage: string; /** * Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio\'s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. */ optOutMessage: string; /** * When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio\'s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. */ helpMessage: string; /** * If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. */ optInKeywords: Array<string>; /** * End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio\'s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. */ optOutKeywords: Array<string>; /** * End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio\'s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. */ helpKeywords: Array<string>; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the US App to Person resource. */ url: string; /** * A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes. */ mock: boolean; /** * Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements. */ errors: Array<any>; private get _proxy(); /** * Remove a UsAppToPersonInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a UsAppToPersonInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UsAppToPersonInstance */ fetch(callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>; /** * Update a UsAppToPersonInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UsAppToPersonInstance */ update(params: UsAppToPersonContextUpdateOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; brandRegistrationSid: string; messagingServiceSid: string; description: string; messageSamples: string[]; usAppToPersonUsecase: string; hasEmbeddedLinks: boolean; hasEmbeddedPhone: boolean; subscriberOptIn: boolean; ageGated: boolean; directLending: boolean; campaignStatus: string; campaignId: string; isExternallyRegistered: boolean; rateLimits: any; messageFlow: string; optInMessage: string; optOutMessage: string; helpMessage: string; optInKeywords: string[]; optOutKeywords: string[]; helpKeywords: string[]; dateCreated: Date; dateUpdated: Date; url: string; mock: boolean; errors: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface UsAppToPersonSolution { messagingServiceSid: string; } export interface UsAppToPersonListInstance { _version: V1; _solution: UsAppToPersonSolution; _uri: string; (sid: string): UsAppToPersonContext; get(sid: string): UsAppToPersonContext; /** * Create a UsAppToPersonInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UsAppToPersonInstance */ create(params: UsAppToPersonListInstanceCreateOptions, callback?: (error: Error | null, item?: UsAppToPersonInstance) => any): Promise<UsAppToPersonInstance>; /** * Streams UsAppToPersonInstance 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 { UsAppToPersonListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UsAppToPersonInstance, done: (err?: Error) => void) => void): void; each(params: UsAppToPersonListInstanceEachOptions, callback?: (item: UsAppToPersonInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UsAppToPersonInstance 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: UsAppToPersonPage) => any): Promise<UsAppToPersonPage>; /** * Lists UsAppToPersonInstance 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 { UsAppToPersonListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UsAppToPersonInstance[]) => any): Promise<UsAppToPersonInstance[]>; list(params: UsAppToPersonListInstanceOptions, callback?: (error: Error | null, items: UsAppToPersonInstance[]) => any): Promise<UsAppToPersonInstance[]>; /** * Retrieve a single page of UsAppToPersonInstance 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 { UsAppToPersonListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UsAppToPersonPage) => any): Promise<UsAppToPersonPage>; page(params: UsAppToPersonListInstancePageOptions, callback?: (error: Error | null, items: UsAppToPersonPage) => any): Promise<UsAppToPersonPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UsAppToPersonListInstance(version: V1, messagingServiceSid: string): UsAppToPersonListInstance; export declare class UsAppToPersonPage extends Page<V1, UsAppToPersonPayload, UsAppToPersonResource, UsAppToPersonInstance> { /** * Initialize the UsAppToPersonPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UsAppToPersonSolution); /** * Build an instance of UsAppToPersonInstance * * @param payload - Payload response from the API */ getInstance(payload: UsAppToPersonResource): UsAppToPersonInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/service/usAppToPersonUsecase.js000064400000006050151677225100016124 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.UsAppToPersonUsecaseInstance = exports.UsAppToPersonUsecaseListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function UsAppToPersonUsecaseListInstance(version, messagingServiceSid) { if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) { throw new Error("Parameter 'messagingServiceSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { messagingServiceSid }; instance._uri = `/Services/${messagingServiceSid}/Compliance/Usa2p/Usecases`; instance.fetch = function fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["brandRegistrationSid"] !== undefined) data["BrandRegistrationSid"] = params["brandRegistrationSid"]; const headers = {}; let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UsAppToPersonUsecaseInstance(operationVersion, payload, instance._solution.messagingServiceSid)); 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; } exports.UsAppToPersonUsecaseListInstance = UsAppToPersonUsecaseListInstance; class UsAppToPersonUsecaseInstance { constructor(_version, payload, messagingServiceSid) { this._version = _version; this.usAppToPersonUsecases = payload.us_app_to_person_usecases; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { usAppToPersonUsecases: this.usAppToPersonUsecases, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsAppToPersonUsecaseInstance = UsAppToPersonUsecaseInstance; rest/messaging/v1/service/usAppToPersonUsecase.d.ts000064400000004410151677225100016356 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; /** * Options to pass to fetch a UsAppToPersonUsecaseInstance */ export interface UsAppToPersonUsecaseListInstanceFetchOptions { /** The unique string to identify the A2P brand. */ brandRegistrationSid?: string; } export interface UsAppToPersonUsecaseSolution { messagingServiceSid: string; } export interface UsAppToPersonUsecaseListInstance { _version: V1; _solution: UsAppToPersonUsecaseSolution; _uri: string; /** * Fetch a UsAppToPersonUsecaseInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed UsAppToPersonUsecaseInstance */ fetch(callback?: (error: Error | null, item?: UsAppToPersonUsecaseInstance) => any): Promise<UsAppToPersonUsecaseInstance>; /** * Fetch a UsAppToPersonUsecaseInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed UsAppToPersonUsecaseInstance */ fetch(params: UsAppToPersonUsecaseListInstanceFetchOptions, callback?: (error: Error | null, item?: UsAppToPersonUsecaseInstance) => any): Promise<UsAppToPersonUsecaseInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UsAppToPersonUsecaseListInstance(version: V1, messagingServiceSid: string): UsAppToPersonUsecaseListInstance; interface UsAppToPersonUsecaseResource { us_app_to_person_usecases: Array<any>; } export declare class UsAppToPersonUsecaseInstance { protected _version: V1; constructor(_version: V1, payload: UsAppToPersonUsecaseResource, messagingServiceSid: string); /** * Human readable name, code, description and post_approval_required (indicates whether or not post approval is required for this Use Case) of A2P Campaign Use Cases. */ usAppToPersonUsecases: Array<any>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { usAppToPersonUsecases: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/service/phoneNumber.js000064400000021422151677225100014313 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.PhoneNumberPage = exports.PhoneNumberListInstance = exports.PhoneNumberInstance = exports.PhoneNumberContextImpl = void 0; 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 PhoneNumberContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/PhoneNumbers/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.serviceSid, 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.PhoneNumberContextImpl = PhoneNumberContextImpl; class PhoneNumberInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.phoneNumber = payload.phone_number; this.countryCode = payload.country_code; this.capabilities = payload.capabilities; this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PhoneNumberContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, phoneNumber: this.phoneNumber, countryCode: this.countryCode, capabilities: this.capabilities, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberInstance = PhoneNumberInstance; function PhoneNumberListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PhoneNumberContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/PhoneNumbers`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["phoneNumberSid"] === null || params["phoneNumberSid"] === undefined) { throw new Error("Required parameter \"params['phoneNumberSid']\" missing."); } let data = {}; data["PhoneNumberSid"] = params["phoneNumberSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PhoneNumberPage(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 PhoneNumberPage(instance._version, payload, 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; } exports.PhoneNumberListInstance = PhoneNumberListInstance; class PhoneNumberPage extends Page_1.default { /** * Initialize the PhoneNumberPage * * @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 PhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PhoneNumberInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PhoneNumberPage = PhoneNumberPage; rest/messaging/v1/service/alphaSender.js000064400000021233151677225100014257 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.AlphaSenderPage = exports.AlphaSenderListInstance = exports.AlphaSenderInstance = exports.AlphaSenderContextImpl = void 0; 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 AlphaSenderContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/AlphaSenders/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AlphaSenderInstance(operationVersion, payload, instance._solution.serviceSid, 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.AlphaSenderContextImpl = AlphaSenderContextImpl; class AlphaSenderInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.alphaSender = payload.alpha_sender; this.capabilities = payload.capabilities; this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AlphaSenderContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a AlphaSenderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AlphaSenderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AlphaSenderInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, alphaSender: this.alphaSender, capabilities: this.capabilities, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AlphaSenderInstance = AlphaSenderInstance; function AlphaSenderListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AlphaSenderContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/AlphaSenders`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["alphaSender"] === null || params["alphaSender"] === undefined) { throw new Error("Required parameter \"params['alphaSender']\" missing."); } let data = {}; data["AlphaSender"] = params["alphaSender"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AlphaSenderInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AlphaSenderPage(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 AlphaSenderPage(instance._version, payload, 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; } exports.AlphaSenderListInstance = AlphaSenderListInstance; class AlphaSenderPage extends Page_1.default { /** * Initialize the AlphaSenderPage * * @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 AlphaSenderInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AlphaSenderInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AlphaSenderPage = AlphaSenderPage; rest/messaging/v1/service/alphaSender.d.ts000064400000023752151677225100014523 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a AlphaSenderInstance */ export interface AlphaSenderListInstanceCreateOptions { /** The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers. */ alphaSender: string; } /** * Options to pass to each */ export interface AlphaSenderListInstanceEachOptions { /** 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: AlphaSenderInstance, 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 AlphaSenderListInstanceOptions { /** 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 AlphaSenderListInstancePageOptions { /** 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 AlphaSenderContext { /** * Remove a AlphaSenderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AlphaSenderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AlphaSenderInstance */ fetch(callback?: (error: Error | null, item?: AlphaSenderInstance) => any): Promise<AlphaSenderInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AlphaSenderContextSolution { serviceSid: string; sid: string; } export declare class AlphaSenderContextImpl implements AlphaSenderContext { protected _version: V1; protected _solution: AlphaSenderContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AlphaSenderInstance) => any): Promise<AlphaSenderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AlphaSenderContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AlphaSenderPayload extends TwilioResponsePayload { alpha_senders: AlphaSenderResource[]; } interface AlphaSenderResource { sid: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; alpha_sender: string; capabilities: Array<string>; url: string; } export declare class AlphaSenderInstance { protected _version: V1; protected _solution: AlphaSenderContextSolution; protected _context?: AlphaSenderContext; constructor(_version: V1, payload: AlphaSenderResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the AlphaSender resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. */ serviceSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The Alphanumeric Sender ID string. */ alphaSender: string; /** * An array of values that describe whether the number can receive calls or messages. Can be: `SMS`. */ capabilities: Array<string>; /** * The absolute URL of the AlphaSender resource. */ url: string; private get _proxy(); /** * Remove a AlphaSenderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AlphaSenderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AlphaSenderInstance */ fetch(callback?: (error: Error | null, item?: AlphaSenderInstance) => any): Promise<AlphaSenderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; alphaSender: string; capabilities: string[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AlphaSenderSolution { serviceSid: string; } export interface AlphaSenderListInstance { _version: V1; _solution: AlphaSenderSolution; _uri: string; (sid: string): AlphaSenderContext; get(sid: string): AlphaSenderContext; /** * Create a AlphaSenderInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AlphaSenderInstance */ create(params: AlphaSenderListInstanceCreateOptions, callback?: (error: Error | null, item?: AlphaSenderInstance) => any): Promise<AlphaSenderInstance>; /** * Streams AlphaSenderInstance 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 { AlphaSenderListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AlphaSenderInstance, done: (err?: Error) => void) => void): void; each(params: AlphaSenderListInstanceEachOptions, callback?: (item: AlphaSenderInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AlphaSenderInstance 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: AlphaSenderPage) => any): Promise<AlphaSenderPage>; /** * Lists AlphaSenderInstance 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 { AlphaSenderListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AlphaSenderInstance[]) => any): Promise<AlphaSenderInstance[]>; list(params: AlphaSenderListInstanceOptions, callback?: (error: Error | null, items: AlphaSenderInstance[]) => any): Promise<AlphaSenderInstance[]>; /** * Retrieve a single page of AlphaSenderInstance 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 { AlphaSenderListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AlphaSenderPage) => any): Promise<AlphaSenderPage>; page(params: AlphaSenderListInstancePageOptions, callback?: (error: Error | null, items: AlphaSenderPage) => any): Promise<AlphaSenderPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AlphaSenderListInstance(version: V1, serviceSid: string): AlphaSenderListInstance; export declare class AlphaSenderPage extends Page<V1, AlphaSenderPayload, AlphaSenderResource, AlphaSenderInstance> { /** * Initialize the AlphaSenderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AlphaSenderSolution); /** * Build an instance of AlphaSenderInstance * * @param payload - Payload response from the API */ getInstance(payload: AlphaSenderResource): AlphaSenderInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/service/phoneNumber.d.ts000064400000024257151677225100014560 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a PhoneNumberInstance */ export interface PhoneNumberListInstanceCreateOptions { /** The SID of the Phone Number being added to the Service. */ phoneNumberSid: string; } /** * Options to pass to each */ export interface PhoneNumberListInstanceEachOptions { /** 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: PhoneNumberInstance, 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 PhoneNumberListInstanceOptions { /** 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 PhoneNumberListInstancePageOptions { /** 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 PhoneNumberContext { /** * Remove a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PhoneNumberContextSolution { serviceSid: string; sid: string; } export declare class PhoneNumberContextImpl implements PhoneNumberContext { protected _version: V1; protected _solution: PhoneNumberContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PhoneNumberContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PhoneNumberPayload extends TwilioResponsePayload { phone_numbers: PhoneNumberResource[]; } interface PhoneNumberResource { sid: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; phone_number: string; country_code: string; capabilities: Array<string>; url: string; } export declare class PhoneNumberInstance { protected _version: V1; protected _solution: PhoneNumberContextSolution; protected _context?: PhoneNumberContext; constructor(_version: V1, payload: PhoneNumberResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the PhoneNumber resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. */ serviceSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. */ phoneNumber: string; /** * The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. */ countryCode: string; /** * An array of values that describe whether the number can receive calls or messages. Can be: `Voice`, `SMS`, and `MMS`. */ capabilities: Array<string>; /** * The absolute URL of the PhoneNumber resource. */ url: string; private get _proxy(); /** * Remove a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a PhoneNumberInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ fetch(callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; phoneNumber: string; countryCode: string; capabilities: string[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PhoneNumberSolution { serviceSid: string; } export interface PhoneNumberListInstance { _version: V1; _solution: PhoneNumberSolution; _uri: string; (sid: string): PhoneNumberContext; get(sid: string): PhoneNumberContext; /** * Create a PhoneNumberInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed PhoneNumberInstance */ create(params: PhoneNumberListInstanceCreateOptions, callback?: (error: Error | null, item?: PhoneNumberInstance) => any): Promise<PhoneNumberInstance>; /** * Streams PhoneNumberInstance 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 { PhoneNumberListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void; each(params: PhoneNumberListInstanceEachOptions, callback?: (item: PhoneNumberInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PhoneNumberInstance 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: PhoneNumberPage) => any): Promise<PhoneNumberPage>; /** * Lists PhoneNumberInstance 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 { PhoneNumberListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>; list(params: PhoneNumberListInstanceOptions, callback?: (error: Error | null, items: PhoneNumberInstance[]) => any): Promise<PhoneNumberInstance[]>; /** * Retrieve a single page of PhoneNumberInstance 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 { PhoneNumberListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>; page(params: PhoneNumberListInstancePageOptions, callback?: (error: Error | null, items: PhoneNumberPage) => any): Promise<PhoneNumberPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PhoneNumberListInstance(version: V1, serviceSid: string): PhoneNumberListInstance; export declare class PhoneNumberPage extends Page<V1, PhoneNumberPayload, PhoneNumberResource, PhoneNumberInstance> { /** * Initialize the PhoneNumberPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: PhoneNumberSolution); /** * Build an instance of PhoneNumberInstance * * @param payload - Payload response from the API */ getInstance(payload: PhoneNumberResource): PhoneNumberInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/service/shortCode.d.ts000064400000023677151677225100014235 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a ShortCodeInstance */ export interface ShortCodeListInstanceCreateOptions { /** The SID of the ShortCode resource being added to the Service. */ shortCodeSid: string; } /** * Options to pass to each */ export interface ShortCodeListInstanceEachOptions { /** 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: ShortCodeInstance, 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 ShortCodeListInstanceOptions { /** 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 ShortCodeListInstancePageOptions { /** 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 ShortCodeContext { /** * Remove a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ShortCodeContextSolution { serviceSid: string; sid: string; } export declare class ShortCodeContextImpl implements ShortCodeContext { protected _version: V1; protected _solution: ShortCodeContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ShortCodeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ShortCodePayload extends TwilioResponsePayload { short_codes: ShortCodeResource[]; } interface ShortCodeResource { sid: string; account_sid: string; service_sid: string; date_created: Date; date_updated: Date; short_code: string; country_code: string; capabilities: Array<string>; url: string; } export declare class ShortCodeInstance { protected _version: V1; protected _solution: ShortCodeContextSolution; protected _context?: ShortCodeContext; constructor(_version: V1, payload: ShortCodeResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the ShortCode resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. */ serviceSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The [E.164](https://www.twilio.com/docs/glossary/what-e164) format of the short code. */ shortCode: string; /** * The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. */ countryCode: string; /** * An array of values that describe whether the number can receive calls or messages. Can be: `SMS` and `MMS`. */ capabilities: Array<string>; /** * The absolute URL of the ShortCode resource. */ url: string; private get _proxy(); /** * Remove a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ fetch(callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; dateUpdated: Date; shortCode: string; countryCode: string; capabilities: string[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ShortCodeSolution { serviceSid: string; } export interface ShortCodeListInstance { _version: V1; _solution: ShortCodeSolution; _uri: string; (sid: string): ShortCodeContext; get(sid: string): ShortCodeContext; /** * Create a ShortCodeInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ create(params: ShortCodeListInstanceCreateOptions, callback?: (error: Error | null, item?: ShortCodeInstance) => any): Promise<ShortCodeInstance>; /** * Streams ShortCodeInstance 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 { ShortCodeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void; each(params: ShortCodeListInstanceEachOptions, callback?: (item: ShortCodeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ShortCodeInstance 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: ShortCodePage) => any): Promise<ShortCodePage>; /** * Lists ShortCodeInstance 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 { ShortCodeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ShortCodeInstance[]) => any): Promise<ShortCodeInstance[]>; list(params: ShortCodeListInstanceOptions, callback?: (error: Error | null, items: ShortCodeInstance[]) => any): Promise<ShortCodeInstance[]>; /** * Retrieve a single page of ShortCodeInstance 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 { ShortCodeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ShortCodePage) => any): Promise<ShortCodePage>; page(params: ShortCodeListInstancePageOptions, callback?: (error: Error | null, items: ShortCodePage) => any): Promise<ShortCodePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ShortCodeListInstance(version: V1, serviceSid: string): ShortCodeListInstance; export declare class ShortCodePage extends Page<V1, ShortCodePayload, ShortCodeResource, ShortCodeInstance> { /** * Initialize the ShortCodePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ShortCodeSolution); /** * Build an instance of ShortCodeInstance * * @param payload - Payload response from the API */ getInstance(payload: ShortCodeResource): ShortCodeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/service/channelSender.d.ts000064400000022022151677225100015033 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to each */ export interface ChannelSenderListInstanceEachOptions { /** 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: ChannelSenderInstance, 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 ChannelSenderListInstanceOptions { /** 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 ChannelSenderListInstancePageOptions { /** 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 ChannelSenderContext { /** * Fetch a ChannelSenderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelSenderInstance */ fetch(callback?: (error: Error | null, item?: ChannelSenderInstance) => any): Promise<ChannelSenderInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ChannelSenderContextSolution { messagingServiceSid: string; sid: string; } export declare class ChannelSenderContextImpl implements ChannelSenderContext { protected _version: V1; protected _solution: ChannelSenderContextSolution; protected _uri: string; constructor(_version: V1, messagingServiceSid: string, sid: string); fetch(callback?: (error: Error | null, item?: ChannelSenderInstance) => any): Promise<ChannelSenderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ChannelSenderContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ChannelSenderPayload extends TwilioResponsePayload { senders: ChannelSenderResource[]; } interface ChannelSenderResource { account_sid: string; messaging_service_sid: string; sid: string; sender: string; sender_type: string; country_code: string; date_created: Date; date_updated: Date; url: string; } export declare class ChannelSenderInstance { protected _version: V1; protected _solution: ChannelSenderContextSolution; protected _context?: ChannelSenderContext; constructor(_version: V1, payload: ChannelSenderResource, messagingServiceSid: string, sid?: string); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ChannelSender resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/messaging/services) the resource is associated with. */ messagingServiceSid: string; /** * The unique string that we created to identify the ChannelSender resource. */ sid: string; /** * The unique string that identifies the sender e.g whatsapp:+123456XXXX. */ sender: string; /** * A string value that identifies the sender type e.g WhatsApp, Messenger. */ senderType: string; /** * The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. */ countryCode: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the ChannelSender resource. */ url: string; private get _proxy(); /** * Fetch a ChannelSenderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelSenderInstance */ fetch(callback?: (error: Error | null, item?: ChannelSenderInstance) => any): Promise<ChannelSenderInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; messagingServiceSid: string; sid: string; sender: string; senderType: string; countryCode: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ChannelSenderSolution { messagingServiceSid: string; } export interface ChannelSenderListInstance { _version: V1; _solution: ChannelSenderSolution; _uri: string; (sid: string): ChannelSenderContext; get(sid: string): ChannelSenderContext; /** * Streams ChannelSenderInstance 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 { ChannelSenderListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ChannelSenderInstance, done: (err?: Error) => void) => void): void; each(params: ChannelSenderListInstanceEachOptions, callback?: (item: ChannelSenderInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ChannelSenderInstance 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: ChannelSenderPage) => any): Promise<ChannelSenderPage>; /** * Lists ChannelSenderInstance 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 { ChannelSenderListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ChannelSenderInstance[]) => any): Promise<ChannelSenderInstance[]>; list(params: ChannelSenderListInstanceOptions, callback?: (error: Error | null, items: ChannelSenderInstance[]) => any): Promise<ChannelSenderInstance[]>; /** * Retrieve a single page of ChannelSenderInstance 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 { ChannelSenderListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ChannelSenderPage) => any): Promise<ChannelSenderPage>; page(params: ChannelSenderListInstancePageOptions, callback?: (error: Error | null, items: ChannelSenderPage) => any): Promise<ChannelSenderPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ChannelSenderListInstance(version: V1, messagingServiceSid: string): ChannelSenderListInstance; export declare class ChannelSenderPage extends Page<V1, ChannelSenderPayload, ChannelSenderResource, ChannelSenderInstance> { /** * Initialize the ChannelSenderPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ChannelSenderSolution); /** * Build an instance of ChannelSenderInstance * * @param payload - Payload response from the API */ getInstance(payload: ChannelSenderResource): ChannelSenderInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/messaging/v1/service/channelSender.js000064400000016557151677225100014617 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.ChannelSenderPage = exports.ChannelSenderListInstance = exports.ChannelSenderInstance = exports.ChannelSenderContextImpl = void 0; 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 ChannelSenderContextImpl { constructor(_version, messagingServiceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) { throw new Error("Parameter 'messagingServiceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { messagingServiceSid, sid }; this._uri = `/Services/${messagingServiceSid}/ChannelSenders/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ChannelSenderInstance(operationVersion, payload, instance._solution.messagingServiceSid, 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.ChannelSenderContextImpl = ChannelSenderContextImpl; class ChannelSenderInstance { constructor(_version, payload, messagingServiceSid, sid) { this._version = _version; this.accountSid = payload.account_sid; this.messagingServiceSid = payload.messaging_service_sid; this.sid = payload.sid; this.sender = payload.sender; this.senderType = payload.sender_type; this.countryCode = payload.country_code; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { messagingServiceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ChannelSenderContextImpl(this._version, this._solution.messagingServiceSid, this._solution.sid); return this._context; } /** * Fetch a ChannelSenderInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ChannelSenderInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, messagingServiceSid: this.messagingServiceSid, sid: this.sid, sender: this.sender, senderType: this.senderType, countryCode: this.countryCode, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelSenderInstance = ChannelSenderInstance; function ChannelSenderListInstance(version, messagingServiceSid) { if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) { throw new Error("Parameter 'messagingServiceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ChannelSenderContextImpl(version, messagingServiceSid, sid); }; instance._version = version; instance._solution = { messagingServiceSid }; instance._uri = `/Services/${messagingServiceSid}/ChannelSenders`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ChannelSenderPage(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 ChannelSenderPage(instance._version, payload, 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; } exports.ChannelSenderListInstance = ChannelSenderListInstance; class ChannelSenderPage extends Page_1.default { /** * Initialize the ChannelSenderPage * * @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 ChannelSenderInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ChannelSenderInstance(this._version, payload, this._solution.messagingServiceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ChannelSenderPage = ChannelSenderPage; rest/messaging/v1/service/shortCode.js000064400000021304151677225100013762 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.ShortCodePage = exports.ShortCodeListInstance = exports.ShortCodeInstance = exports.ShortCodeContextImpl = void 0; 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 ShortCodeContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/ShortCodes/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ShortCodeInstance(operationVersion, payload, instance._solution.serviceSid, 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.ShortCodeContextImpl = ShortCodeContextImpl; class ShortCodeInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.shortCode = payload.short_code; this.countryCode = payload.country_code; this.capabilities = payload.capabilities; this.url = payload.url; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ShortCodeContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ShortCodeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ShortCodeInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, shortCode: this.shortCode, countryCode: this.countryCode, capabilities: this.capabilities, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ShortCodeInstance = ShortCodeInstance; function ShortCodeListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ShortCodeContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/ShortCodes`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["shortCodeSid"] === null || params["shortCodeSid"] === undefined) { throw new Error("Required parameter \"params['shortCodeSid']\" missing."); } let data = {}; data["ShortCodeSid"] = params["shortCodeSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ShortCodeInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ShortCodePage(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 ShortCodePage(instance._version, payload, 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; } exports.ShortCodeListInstance = ShortCodeListInstance; class ShortCodePage extends Page_1.default { /** * Initialize the ShortCodePage * * @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 ShortCodeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ShortCodeInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ShortCodePage = ShortCodePage; rest/messaging/v1/linkshorteningMessagingService.d.ts000064400000010154151677225100017042 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export interface LinkshorteningMessagingServiceContext { /** * Create a LinkshorteningMessagingServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed LinkshorteningMessagingServiceInstance */ create(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceInstance) => any): Promise<LinkshorteningMessagingServiceInstance>; /** * Remove a LinkshorteningMessagingServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface LinkshorteningMessagingServiceContextSolution { domainSid: string; messagingServiceSid: string; } export declare class LinkshorteningMessagingServiceContextImpl implements LinkshorteningMessagingServiceContext { protected _version: V1; protected _solution: LinkshorteningMessagingServiceContextSolution; protected _uri: string; constructor(_version: V1, domainSid: string, messagingServiceSid: string); create(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceInstance) => any): Promise<LinkshorteningMessagingServiceInstance>; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): LinkshorteningMessagingServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface LinkshorteningMessagingServiceResource { domain_sid: string; messaging_service_sid: string; url: string; } export declare class LinkshorteningMessagingServiceInstance { protected _version: V1; protected _solution: LinkshorteningMessagingServiceContextSolution; protected _context?: LinkshorteningMessagingServiceContext; constructor(_version: V1, payload: LinkshorteningMessagingServiceResource, domainSid?: string, messagingServiceSid?: string); /** * The unique string identifies the domain resource */ domainSid: string; /** * The unique string that identifies the messaging service */ messagingServiceSid: string; url: string; private get _proxy(); /** * Create a LinkshorteningMessagingServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed LinkshorteningMessagingServiceInstance */ create(callback?: (error: Error | null, item?: LinkshorteningMessagingServiceInstance) => any): Promise<LinkshorteningMessagingServiceInstance>; /** * Remove a LinkshorteningMessagingServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { domainSid: string; messagingServiceSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface LinkshorteningMessagingServiceSolution { } export interface LinkshorteningMessagingServiceListInstance { _version: V1; _solution: LinkshorteningMessagingServiceSolution; _uri: string; (domainSid: string, messagingServiceSid: string): LinkshorteningMessagingServiceContext; get(domainSid: string, messagingServiceSid: string): LinkshorteningMessagingServiceContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function LinkshorteningMessagingServiceListInstance(version: V1): LinkshorteningMessagingServiceListInstance; export {}; rest/messaging/v1/domainConfigMessagingService.js000064400000011555151677225100016153 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.DomainConfigMessagingServiceListInstance = exports.DomainConfigMessagingServiceInstance = exports.DomainConfigMessagingServiceContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class DomainConfigMessagingServiceContextImpl { constructor(_version, messagingServiceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(messagingServiceSid)) { throw new Error("Parameter 'messagingServiceSid' is not valid."); } this._solution = { messagingServiceSid }; this._uri = `/LinkShortening/MessagingService/${messagingServiceSid}/DomainConfig`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DomainConfigMessagingServiceInstance(operationVersion, payload, instance._solution.messagingServiceSid)); 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.DomainConfigMessagingServiceContextImpl = DomainConfigMessagingServiceContextImpl; class DomainConfigMessagingServiceInstance { constructor(_version, payload, messagingServiceSid) { this._version = _version; this.domainSid = payload.domain_sid; this.configSid = payload.config_sid; this.messagingServiceSid = payload.messaging_service_sid; this.fallbackUrl = payload.fallback_url; this.callbackUrl = payload.callback_url; this.continueOnFailure = payload.continue_on_failure; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { messagingServiceSid: messagingServiceSid || this.messagingServiceSid, }; } get _proxy() { this._context = this._context || new DomainConfigMessagingServiceContextImpl(this._version, this._solution.messagingServiceSid); return this._context; } /** * Fetch a DomainConfigMessagingServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigMessagingServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { domainSid: this.domainSid, configSid: this.configSid, messagingServiceSid: this.messagingServiceSid, fallbackUrl: this.fallbackUrl, callbackUrl: this.callbackUrl, continueOnFailure: this.continueOnFailure, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DomainConfigMessagingServiceInstance = DomainConfigMessagingServiceInstance; function DomainConfigMessagingServiceListInstance(version) { const instance = ((messagingServiceSid) => instance.get(messagingServiceSid)); instance.get = function get(messagingServiceSid) { return new DomainConfigMessagingServiceContextImpl(version, messagingServiceSid); }; 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; } exports.DomainConfigMessagingServiceListInstance = DomainConfigMessagingServiceListInstance; rest/messaging/v1/externalCampaign.js000064400000006652151677225100013663 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.ExternalCampaignInstance = exports.ExternalCampaignListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function ExternalCampaignListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Services/PreregisteredUsa2p`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["campaignId"] === null || params["campaignId"] === undefined) { throw new Error("Required parameter \"params['campaignId']\" missing."); } if (params["messagingServiceSid"] === null || params["messagingServiceSid"] === undefined) { throw new Error("Required parameter \"params['messagingServiceSid']\" missing."); } let data = {}; data["CampaignId"] = params["campaignId"]; data["MessagingServiceSid"] = params["messagingServiceSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ExternalCampaignInstance(operationVersion, payload)); 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; } exports.ExternalCampaignListInstance = ExternalCampaignListInstance; class ExternalCampaignInstance { constructor(_version, payload) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.campaignId = payload.campaign_id; this.messagingServiceSid = payload.messaging_service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, campaignId: this.campaignId, messagingServiceSid: this.messagingServiceSid, dateCreated: this.dateCreated, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExternalCampaignInstance = ExternalCampaignInstance; rest/messaging/v1/domainCerts.js000064400000013756151677225100012654 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.DomainCertsListInstance = exports.DomainCertsInstance = exports.DomainCertsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class DomainCertsContextImpl { constructor(_version, domainSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(domainSid)) { throw new Error("Parameter 'domainSid' is not valid."); } this._solution = { domainSid }; this._uri = `/LinkShortening/Domains/${domainSid}/Certificate`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DomainCertsInstance(operationVersion, payload, instance._solution.domainSid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["tlsCert"] === null || params["tlsCert"] === undefined) { throw new Error("Required parameter \"params['tlsCert']\" missing."); } let data = {}; data["TlsCert"] = params["tlsCert"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DomainCertsInstance(operationVersion, payload, instance._solution.domainSid)); 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.DomainCertsContextImpl = DomainCertsContextImpl; class DomainCertsInstance { constructor(_version, payload, domainSid) { this._version = _version; this.domainSid = payload.domain_sid; this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.dateExpires = deserialize.iso8601DateTime(payload.date_expires); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.domainName = payload.domain_name; this.certificateSid = payload.certificate_sid; this.url = payload.url; this.certInValidation = payload.cert_in_validation; this._solution = { domainSid: domainSid || this.domainSid }; } get _proxy() { this._context = this._context || new DomainCertsContextImpl(this._version, this._solution.domainSid); return this._context; } /** * Remove a DomainCertsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a DomainCertsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainCertsInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { domainSid: this.domainSid, dateUpdated: this.dateUpdated, dateExpires: this.dateExpires, dateCreated: this.dateCreated, domainName: this.domainName, certificateSid: this.certificateSid, url: this.url, certInValidation: this.certInValidation, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DomainCertsInstance = DomainCertsInstance; function DomainCertsListInstance(version) { const instance = ((domainSid) => instance.get(domainSid)); instance.get = function get(domainSid) { return new DomainCertsContextImpl(version, domainSid); }; 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; } exports.DomainCertsListInstance = DomainCertsListInstance; rest/messaging/v1/domainConfigMessagingService.d.ts000064400000011017151677225100016400 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export interface DomainConfigMessagingServiceContext { /** * Fetch a DomainConfigMessagingServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigMessagingServiceInstance */ fetch(callback?: (error: Error | null, item?: DomainConfigMessagingServiceInstance) => any): Promise<DomainConfigMessagingServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DomainConfigMessagingServiceContextSolution { messagingServiceSid: string; } export declare class DomainConfigMessagingServiceContextImpl implements DomainConfigMessagingServiceContext { protected _version: V1; protected _solution: DomainConfigMessagingServiceContextSolution; protected _uri: string; constructor(_version: V1, messagingServiceSid: string); fetch(callback?: (error: Error | null, item?: DomainConfigMessagingServiceInstance) => any): Promise<DomainConfigMessagingServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DomainConfigMessagingServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DomainConfigMessagingServiceResource { domain_sid: string; config_sid: string; messaging_service_sid: string; fallback_url: string; callback_url: string; continue_on_failure: boolean; date_created: Date; date_updated: Date; url: string; } export declare class DomainConfigMessagingServiceInstance { protected _version: V1; protected _solution: DomainConfigMessagingServiceContextSolution; protected _context?: DomainConfigMessagingServiceContext; constructor(_version: V1, payload: DomainConfigMessagingServiceResource, messagingServiceSid?: string); /** * The unique string that we created to identify the Domain resource. */ domainSid: string; /** * The unique string that we created to identify the Domain config (prefix ZK). */ configSid: string; /** * The unique string that identifies the messaging service */ messagingServiceSid: string; /** * Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. */ fallbackUrl: string; /** * URL to receive click events to your webhook whenever the recipients click on the shortened links. */ callbackUrl: string; /** * Boolean field to set customer delivery preference when there is a failure in linkShortening service */ continueOnFailure: boolean; /** * Date this Domain Config was created. */ dateCreated: Date; /** * Date that this Domain Config was last updated. */ dateUpdated: Date; url: string; private get _proxy(); /** * Fetch a DomainConfigMessagingServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DomainConfigMessagingServiceInstance */ fetch(callback?: (error: Error | null, item?: DomainConfigMessagingServiceInstance) => any): Promise<DomainConfigMessagingServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { domainSid: string; configSid: string; messagingServiceSid: string; fallbackUrl: string; callbackUrl: string; continueOnFailure: boolean; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DomainConfigMessagingServiceSolution { } export interface DomainConfigMessagingServiceListInstance { _version: V1; _solution: DomainConfigMessagingServiceSolution; _uri: string; (messagingServiceSid: string): DomainConfigMessagingServiceContext; get(messagingServiceSid: string): DomainConfigMessagingServiceContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DomainConfigMessagingServiceListInstance(version: V1): DomainConfigMessagingServiceListInstance; export {}; rest/messaging/v1/usecase.js000064400000004207151677225100012023 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.UsecaseInstance = exports.UsecaseListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function UsecaseListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/Services/Usecases`; instance.fetch = function fetch(callback) { let operationVersion = version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new UsecaseInstance(operationVersion, payload)); 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; } exports.UsecaseListInstance = UsecaseListInstance; class UsecaseInstance { constructor(_version, payload) { this._version = _version; this.usecases = payload.usecases; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { usecases: this.usecases, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsecaseInstance = UsecaseInstance; rest/messaging/v1/tollfreeVerification.js000064400000047722151677225100014563 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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.TollfreeVerificationPage = exports.TollfreeVerificationListInstance = exports.TollfreeVerificationInstance = exports.TollfreeVerificationContextImpl = void 0; 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 TollfreeVerificationContextImpl { 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 = `/Tollfree/Verifications/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TollfreeVerificationInstance(operationVersion, payload, 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["businessName"] !== undefined) data["BusinessName"] = params["businessName"]; if (params["businessWebsite"] !== undefined) data["BusinessWebsite"] = params["businessWebsite"]; if (params["notificationEmail"] !== undefined) data["NotificationEmail"] = params["notificationEmail"]; if (params["useCaseCategories"] !== undefined) data["UseCaseCategories"] = serialize.map(params["useCaseCategories"], (e) => e); if (params["useCaseSummary"] !== undefined) data["UseCaseSummary"] = params["useCaseSummary"]; if (params["productionMessageSample"] !== undefined) data["ProductionMessageSample"] = params["productionMessageSample"]; if (params["optInImageUrls"] !== undefined) data["OptInImageUrls"] = serialize.map(params["optInImageUrls"], (e) => e); if (params["optInType"] !== undefined) data["OptInType"] = params["optInType"]; if (params["messageVolume"] !== undefined) data["MessageVolume"] = params["messageVolume"]; if (params["businessStreetAddress"] !== undefined) data["BusinessStreetAddress"] = params["businessStreetAddress"]; if (params["businessStreetAddress2"] !== undefined) data["BusinessStreetAddress2"] = params["businessStreetAddress2"]; if (params["businessCity"] !== undefined) data["BusinessCity"] = params["businessCity"]; if (params["businessStateProvinceRegion"] !== undefined) data["BusinessStateProvinceRegion"] = params["businessStateProvinceRegion"]; if (params["businessPostalCode"] !== undefined) data["BusinessPostalCode"] = params["businessPostalCode"]; if (params["businessCountry"] !== undefined) data["BusinessCountry"] = params["businessCountry"]; if (params["additionalInformation"] !== undefined) data["AdditionalInformation"] = params["additionalInformation"]; if (params["businessContactFirstName"] !== undefined) data["BusinessContactFirstName"] = params["businessContactFirstName"]; if (params["businessContactLastName"] !== undefined) data["BusinessContactLastName"] = params["businessContactLastName"]; if (params["businessContactEmail"] !== undefined) data["BusinessContactEmail"] = params["businessContactEmail"]; if (params["businessContactPhone"] !== undefined) data["BusinessContactPhone"] = params["businessContactPhone"]; if (params["editReason"] !== undefined) data["EditReason"] = params["editReason"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TollfreeVerificationInstance(operationVersion, payload, 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.TollfreeVerificationContextImpl = TollfreeVerificationContextImpl; class TollfreeVerificationInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.customerProfileSid = payload.customer_profile_sid; this.trustProductSid = payload.trust_product_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.regulatedItemSid = payload.regulated_item_sid; this.businessName = payload.business_name; this.businessStreetAddress = payload.business_street_address; this.businessStreetAddress2 = payload.business_street_address2; this.businessCity = payload.business_city; this.businessStateProvinceRegion = payload.business_state_province_region; this.businessPostalCode = payload.business_postal_code; this.businessCountry = payload.business_country; this.businessWebsite = payload.business_website; this.businessContactFirstName = payload.business_contact_first_name; this.businessContactLastName = payload.business_contact_last_name; this.businessContactEmail = payload.business_contact_email; this.businessContactPhone = payload.business_contact_phone; this.notificationEmail = payload.notification_email; this.useCaseCategories = payload.use_case_categories; this.useCaseSummary = payload.use_case_summary; this.productionMessageSample = payload.production_message_sample; this.optInImageUrls = payload.opt_in_image_urls; this.optInType = payload.opt_in_type; this.messageVolume = payload.message_volume; this.additionalInformation = payload.additional_information; this.tollfreePhoneNumberSid = payload.tollfree_phone_number_sid; this.status = payload.status; this.url = payload.url; this.rejectionReason = payload.rejection_reason; this.errorCode = deserialize.integer(payload.error_code); this.editExpiration = deserialize.iso8601DateTime(payload.edit_expiration); this.editAllowed = payload.edit_allowed; this.rejectionReasons = payload.rejection_reasons; this.resourceLinks = payload.resource_links; this.externalReferenceId = payload.external_reference_id; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TollfreeVerificationContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a TollfreeVerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TollfreeVerificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TollfreeVerificationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, customerProfileSid: this.customerProfileSid, trustProductSid: this.trustProductSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, regulatedItemSid: this.regulatedItemSid, businessName: this.businessName, businessStreetAddress: this.businessStreetAddress, businessStreetAddress2: this.businessStreetAddress2, businessCity: this.businessCity, businessStateProvinceRegion: this.businessStateProvinceRegion, businessPostalCode: this.businessPostalCode, businessCountry: this.businessCountry, businessWebsite: this.businessWebsite, businessContactFirstName: this.businessContactFirstName, businessContactLastName: this.businessContactLastName, businessContactEmail: this.businessContactEmail, businessContactPhone: this.businessContactPhone, notificationEmail: this.notificationEmail, useCaseCategories: this.useCaseCategories, useCaseSummary: this.useCaseSummary, productionMessageSample: this.productionMessageSample, optInImageUrls: this.optInImageUrls, optInType: this.optInType, messageVolume: this.messageVolume, additionalInformation: this.additionalInformation, tollfreePhoneNumberSid: this.tollfreePhoneNumberSid, status: this.status, url: this.url, rejectionReason: this.rejectionReason, errorCode: this.errorCode, editExpiration: this.editExpiration, editAllowed: this.editAllowed, rejectionReasons: this.rejectionReasons, resourceLinks: this.resourceLinks, externalReferenceId: this.externalReferenceId, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TollfreeVerificationInstance = TollfreeVerificationInstance; function TollfreeVerificationListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TollfreeVerificationContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Tollfree/Verifications`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["businessName"] === null || params["businessName"] === undefined) { throw new Error("Required parameter \"params['businessName']\" missing."); } if (params["businessWebsite"] === null || params["businessWebsite"] === undefined) { throw new Error("Required parameter \"params['businessWebsite']\" missing."); } if (params["notificationEmail"] === null || params["notificationEmail"] === undefined) { throw new Error("Required parameter \"params['notificationEmail']\" missing."); } if (params["useCaseCategories"] === null || params["useCaseCategories"] === undefined) { throw new Error("Required parameter \"params['useCaseCategories']\" missing."); } if (params["useCaseSummary"] === null || params["useCaseSummary"] === undefined) { throw new Error("Required parameter \"params['useCaseSummary']\" missing."); } if (params["productionMessageSample"] === null || params["productionMessageSample"] === undefined) { throw new Error("Required parameter \"params['productionMessageSample']\" missing."); } if (params["optInImageUrls"] === null || params["optInImageUrls"] === undefined) { throw new Error("Required parameter \"params['optInImageUrls']\" missing."); } if (params["optInType"] === null || params["optInType"] === undefined) { throw new Error("Required parameter \"params['optInType']\" missing."); } if (params["messageVolume"] === null || params["messageVolume"] === undefined) { throw new Error("Required parameter \"params['messageVolume']\" missing."); } if (params["tollfreePhoneNumberSid"] === null || params["tollfreePhoneNumberSid"] === undefined) { throw new Error("Required parameter \"params['tollfreePhoneNumberSid']\" missing."); } let data = {}; data["BusinessName"] = params["businessName"]; data["BusinessWebsite"] = params["businessWebsite"]; data["NotificationEmail"] = params["notificationEmail"]; data["UseCaseCategories"] = serialize.map(params["useCaseCategories"], (e) => e); data["UseCaseSummary"] = params["useCaseSummary"]; data["ProductionMessageSample"] = params["productionMessageSample"]; data["OptInImageUrls"] = serialize.map(params["optInImageUrls"], (e) => e); data["OptInType"] = params["optInType"]; data["MessageVolume"] = params["messageVolume"]; data["TollfreePhoneNumberSid"] = params["tollfreePhoneNumberSid"]; if (params["customerProfileSid"] !== undefined) data["CustomerProfileSid"] = params["customerProfileSid"]; if (params["businessStreetAddress"] !== undefined) data["BusinessStreetAddress"] = params["businessStreetAddress"]; if (params["businessStreetAddress2"] !== undefined) data["BusinessStreetAddress2"] = params["businessStreetAddress2"]; if (params["businessCity"] !== undefined) data["BusinessCity"] = params["businessCity"]; if (params["businessStateProvinceRegion"] !== undefined) data["BusinessStateProvinceRegion"] = params["businessStateProvinceRegion"]; if (params["businessPostalCode"] !== undefined) data["BusinessPostalCode"] = params["businessPostalCode"]; if (params["businessCountry"] !== undefined) data["BusinessCountry"] = params["businessCountry"]; if (params["additionalInformation"] !== undefined) data["AdditionalInformation"] = params["additionalInformation"]; if (params["businessContactFirstName"] !== undefined) data["BusinessContactFirstName"] = params["businessContactFirstName"]; if (params["businessContactLastName"] !== undefined) data["BusinessContactLastName"] = params["businessContactLastName"]; if (params["businessContactEmail"] !== undefined) data["BusinessContactEmail"] = params["businessContactEmail"]; if (params["businessContactPhone"] !== undefined) data["BusinessContactPhone"] = params["businessContactPhone"]; if (params["externalReferenceId"] !== undefined) data["ExternalReferenceId"] = params["externalReferenceId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TollfreeVerificationInstance(operationVersion, payload)); 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["tollfreePhoneNumberSid"] !== undefined) data["TollfreePhoneNumberSid"] = params["tollfreePhoneNumberSid"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["externalReferenceId"] !== undefined) data["ExternalReferenceId"] = params["externalReferenceId"]; if (params["includeSubAccounts"] !== undefined) data["IncludeSubAccounts"] = serialize.bool(params["includeSubAccounts"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TollfreeVerificationPage(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 TollfreeVerificationPage(instance._version, payload, 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; } exports.TollfreeVerificationListInstance = TollfreeVerificationListInstance; class TollfreeVerificationPage extends Page_1.default { /** * Initialize the TollfreeVerificationPage * * @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 TollfreeVerificationInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TollfreeVerificationInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TollfreeVerificationPage = TollfreeVerificationPage; rest/messaging/V1.js000064400000011267151677225100010337 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Messaging * 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 brandRegistration_1 = require("./v1/brandRegistration"); const deactivations_1 = require("./v1/deactivations"); const domainCerts_1 = require("./v1/domainCerts"); const domainConfig_1 = require("./v1/domainConfig"); const domainConfigMessagingService_1 = require("./v1/domainConfigMessagingService"); const externalCampaign_1 = require("./v1/externalCampaign"); const linkshorteningMessagingService_1 = require("./v1/linkshorteningMessagingService"); const linkshorteningMessagingServiceDomainAssociation_1 = require("./v1/linkshorteningMessagingServiceDomainAssociation"); const service_1 = require("./v1/service"); const tollfreeVerification_1 = require("./v1/tollfreeVerification"); const usecase_1 = require("./v1/usecase"); class V1 extends Version_1.default { /** * Initialize the V1 version of Messaging * * @param domain - The Twilio (Twilio.Messaging) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for brandRegistrations resource */ get brandRegistrations() { this._brandRegistrations = this._brandRegistrations || (0, brandRegistration_1.BrandRegistrationListInstance)(this); return this._brandRegistrations; } /** Getter for deactivations resource */ get deactivations() { this._deactivations = this._deactivations || (0, deactivations_1.DeactivationsListInstance)(this); return this._deactivations; } /** Getter for domainCerts resource */ get domainCerts() { this._domainCerts = this._domainCerts || (0, domainCerts_1.DomainCertsListInstance)(this); return this._domainCerts; } /** Getter for domainConfig resource */ get domainConfig() { this._domainConfig = this._domainConfig || (0, domainConfig_1.DomainConfigListInstance)(this); return this._domainConfig; } /** Getter for domainConfigMessagingService resource */ get domainConfigMessagingService() { this._domainConfigMessagingService = this._domainConfigMessagingService || (0, domainConfigMessagingService_1.DomainConfigMessagingServiceListInstance)(this); return this._domainConfigMessagingService; } /** Getter for externalCampaign resource */ get externalCampaign() { this._externalCampaign = this._externalCampaign || (0, externalCampaign_1.ExternalCampaignListInstance)(this); return this._externalCampaign; } /** Getter for linkshorteningMessagingService resource */ get linkshorteningMessagingService() { this._linkshorteningMessagingService = this._linkshorteningMessagingService || (0, linkshorteningMessagingService_1.LinkshorteningMessagingServiceListInstance)(this); return this._linkshorteningMessagingService; } /** Getter for linkshorteningMessagingServiceDomainAssociation resource */ get linkshorteningMessagingServiceDomainAssociation() { this._linkshorteningMessagingServiceDomainAssociation = this._linkshorteningMessagingServiceDomainAssociation || (0, linkshorteningMessagingServiceDomainAssociation_1.LinkshorteningMessagingServiceDomainAssociationListInstance)(this); return this._linkshorteningMessagingServiceDomainAssociation; } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } /** Getter for tollfreeVerifications resource */ get tollfreeVerifications() { this._tollfreeVerifications = this._tollfreeVerifications || (0, tollfreeVerification_1.TollfreeVerificationListInstance)(this); return this._tollfreeVerifications; } /** Getter for usecases resource */ get usecases() { this._usecases = this._usecases || (0, usecase_1.UsecaseListInstance)(this); return this._usecases; } } exports.default = V1; rest/Preview.js000064400000004610151677225100007507 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const PreviewBase_1 = __importDefault(require("./PreviewBase")); class Preview extends PreviewBase_1.default { /** * @deprecated - Use deployed_devices.fleets instead */ get fleets() { console.warn("fleets is deprecated. Use deployed_devices.fleets instead."); return this.deployed_devices.fleets; } /** * @deprecated - Use hosted_numbers.authorizationDocuments instead */ get authorizationDocuments() { console.warn("authorizationDocuments is deprecated. Use hosted_numbers.authorizationDocuments instead."); return this.hosted_numbers.authorizationDocuments; } /** * @deprecated - Use hosted_numbers.hostedNumberOrders instead */ get hostedNumberOrders() { console.warn("hostedNumberOrders is deprecated. Use hosted_numbers.hostedNumberOrders instead."); return this.hosted_numbers.hostedNumberOrders; } /** * @deprecated - Use marketplace.availableAddOns instead */ get availableAddOns() { console.warn("availableAddOns is deprecated. Use marketplace.availableAddOns instead."); return this.marketplace.availableAddOns; } /** * @deprecated - Use marketplace.installedAddOns instead */ get installedAddOns() { console.warn("installedAddOns is deprecated. Use marketplace.installedAddOns instead."); return this.marketplace.installedAddOns; } /** * @deprecated - Use sync.services instead */ get services() { console.warn("services is deprecated. Use sync.services instead."); return this.sync.services; } /** * @deprecated - Use wireless.commands instead */ get commands() { console.warn("commands is deprecated. Use wireless.commands instead."); return this.wireless.commands; } /** * @deprecated - Use wireless.ratePlans instead */ get ratePlans() { console.warn("ratePlans is deprecated. Use wireless.ratePlans instead."); return this.wireless.ratePlans; } /** * @deprecated - Use wireless.sims instead */ get sims() { console.warn("sims is deprecated. Use wireless.sims instead."); return this.wireless.sims; } } module.exports = Preview; rest/Notify.d.ts000064400000000665151677225100007600 0ustar00import { CredentialListInstance } from "./notify/v1/credential"; import { ServiceListInstance } from "./notify/v1/service"; import NotifyBase from "./NotifyBase"; declare class Notify extends NotifyBase { /** * @deprecated - Use v1.credentials instead */ get credentials(): CredentialListInstance; /** * @deprecated - Use v1.services instead */ get services(): ServiceListInstance; } export = Notify; rest/MarketplaceBase.d.ts000064400000000466151677225100011352 0ustar00import Domain from "../base/Domain"; import V1 from "./marketplace/V1"; declare class MarketplaceBase extends Domain { _v1?: V1; /** * Initialize marketplace domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = MarketplaceBase; rest/IpMessaging.d.ts000064400000000730151677225100010527 0ustar00import { CredentialListInstance } from "./ipMessaging/v2/credential"; import { ServiceListInstance } from "./ipMessaging/v2/service"; import IpMessagingBase from "./IpMessagingBase"; declare class IpMessaging extends IpMessagingBase { /** * @deprecated - Use v2.credentials instead */ get credentials(): CredentialListInstance; /** * @deprecated - Use v2.services instead */ get services(): ServiceListInstance; } export = IpMessaging; rest/AccountsBase.d.ts000064400000000452151677225100010674 0ustar00import Domain from "../base/Domain"; import V1 from "./accounts/V1"; declare class AccountsBase extends Domain { _v1?: V1; /** * Initialize accounts domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = AccountsBase; rest/EventsBase.js000064400000002040151677225100010120 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./events/V1")); class EventsBase extends Domain_1.default { /** * Initialize events domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://events.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = EventsBase; rest/serverless/V1.d.ts000064400000001062151677225100011003 0ustar00import ServerlessBase from "../ServerlessBase"; import Version from "../../base/Version"; import { ServiceListInstance } from "./v1/service"; export default class V1 extends Version { /** * Initialize the V1 version of Serverless * * @param domain - The Twilio (Twilio.Serverless) domain */ constructor(domain: ServerlessBase); /** services - { Twilio.Serverless.V1.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** Getter for services resource */ get services(): ServiceListInstance; } rest/serverless/v1/service.d.ts000064400000033233151677225100012510 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { AssetListInstance } from "./service/asset"; import { BuildListInstance } from "./service/build"; import { EnvironmentListInstance } from "./service/environment"; import { FunctionListInstance } from "./service/function"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** Whether to inject Account credentials into a function invocation context. */ includeCredentials?: boolean; /** A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. */ friendlyName?: string; /** Whether the Service resource\\\'s properties and subresources can be edited via the UI. The default value is `false`. */ uiEditable?: boolean; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** A user-defined string that uniquely identifies the Service resource. It can be used as an alternative to the `sid` in the URL path to address the Service resource. This value must be 50 characters or less in length and be unique. */ uniqueName: string; /** A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. */ friendlyName: string; /** Whether to inject Account credentials into a function invocation context. The default value is `true`. */ includeCredentials?: boolean; /** Whether the Service\\\'s properties and subresources can be edited via the UI. The default value is `false`. */ uiEditable?: boolean; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { assets: AssetListInstance; builds: BuildListInstance; environments: EnvironmentListInstance; functions: FunctionListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V1; protected _solution: ServiceContextSolution; protected _uri: string; protected _assets?: AssetListInstance; protected _builds?: BuildListInstance; protected _environments?: EnvironmentListInstance; protected _functions?: FunctionListInstance; constructor(_version: V1, sid: string); get assets(): AssetListInstance; get builds(): BuildListInstance; get environments(): EnvironmentListInstance; get functions(): FunctionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; unique_name: string; include_credentials: boolean; ui_editable: boolean; domain_base: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class ServiceInstance { protected _version: V1; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V1, payload: ServiceResource, sid?: string); /** * The unique string that we created to identify the Service resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. */ accountSid: string; /** * The string that you assigned to describe the Service resource. */ friendlyName: string; /** * A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource\'s `sid` in the URL to address the Service resource. */ uniqueName: string; /** * Whether to inject Account credentials into a function invocation context. */ includeCredentials: boolean; /** * Whether the Service resource\'s properties and subresources can be edited via the UI. */ uiEditable: boolean; /** * The base domain name for this Service, which is a combination of the unique name and a randomly generated string. */ domainBase: string; /** * The date and time in GMT when the Service 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 Service resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Service resource. */ url: string; /** * The URLs of the Service\'s nested resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the assets. */ assets(): AssetListInstance; /** * Access the builds. */ builds(): BuildListInstance; /** * Access the environments. */ environments(): EnvironmentListInstance; /** * Access the functions. */ functions(): FunctionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; uniqueName: string; includeCredentials: boolean; uiEditable: boolean; domainBase: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V1; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V1): ServiceListInstance; export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service.js000064400000026625151677225100012263 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const asset_1 = require("./service/asset"); const build_1 = require("./service/build"); const environment_1 = require("./service/environment"); const function_1 = require("./service/function"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get assets() { this._assets = this._assets || (0, asset_1.AssetListInstance)(this._version, this._solution.sid); return this._assets; } get builds() { this._builds = this._builds || (0, build_1.BuildListInstance)(this._version, this._solution.sid); return this._builds; } get environments() { this._environments = this._environments || (0, environment_1.EnvironmentListInstance)(this._version, this._solution.sid); return this._environments; } get functions() { this._functions = this._functions || (0, function_1.FunctionListInstance)(this._version, this._solution.sid); return this._functions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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["includeCredentials"] !== undefined) data["IncludeCredentials"] = serialize.bool(params["includeCredentials"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uiEditable"] !== undefined) data["UiEditable"] = serialize.bool(params["uiEditable"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.uniqueName = payload.unique_name; this.includeCredentials = payload.include_credentials; this.uiEditable = payload.ui_editable; this.domainBase = payload.domain_base; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the assets. */ assets() { return this._proxy.assets; } /** * Access the builds. */ builds() { return this._proxy.builds; } /** * Access the environments. */ environments() { return this._proxy.environments; } /** * Access the functions. */ functions() { return this._proxy.functions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, uniqueName: this.uniqueName, includeCredentials: this.includeCredentials, uiEditable: this.uiEditable, domainBase: this.domainBase, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["uniqueName"] === null || params["uniqueName"] === undefined) { throw new Error("Required parameter \"params['uniqueName']\" missing."); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["UniqueName"] = params["uniqueName"]; data["FriendlyName"] = params["friendlyName"]; if (params["includeCredentials"] !== undefined) data["IncludeCredentials"] = serialize.bool(params["includeCredentials"]); if (params["uiEditable"] !== undefined) data["UiEditable"] = serialize.bool(params["uiEditable"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/serverless/v1/service/function.js000064400000024233151677225100014101 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.FunctionPage = exports.FunctionListInstance = exports.FunctionInstance = exports.FunctionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const functionVersion_1 = require("./function/functionVersion"); class FunctionContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Functions/${sid}`; } get functionVersions() { this._functionVersions = this._functionVersions || (0, functionVersion_1.FunctionVersionListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._functionVersions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FunctionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FunctionInstance(operationVersion, payload, instance._solution.serviceSid, 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.FunctionContextImpl = FunctionContextImpl; class FunctionInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_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.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new FunctionContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a FunctionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a FunctionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the functionVersions. */ functionVersions() { return this._proxy.functionVersions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FunctionInstance = FunctionInstance; function FunctionListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new FunctionContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Functions`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new FunctionInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new FunctionPage(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 FunctionPage(instance._version, payload, 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; } exports.FunctionListInstance = FunctionListInstance; class FunctionPage extends Page_1.default { /** * Initialize the FunctionPage * * @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 FunctionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new FunctionInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FunctionPage = FunctionPage; rest/serverless/v1/service/environment.js000064400000024151151677225100014617 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.EnvironmentPage = exports.EnvironmentListInstance = exports.EnvironmentInstance = exports.EnvironmentContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const deployment_1 = require("./environment/deployment"); const log_1 = require("./environment/log"); const variable_1 = require("./environment/variable"); class EnvironmentContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Environments/${sid}`; } get deployments() { this._deployments = this._deployments || (0, deployment_1.DeploymentListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._deployments; } get logs() { this._logs = this._logs || (0, log_1.LogListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._logs; } get variables() { this._variables = this._variables || (0, variable_1.VariableListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._variables; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EnvironmentInstance(operationVersion, payload, instance._solution.serviceSid, 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.EnvironmentContextImpl = EnvironmentContextImpl; class EnvironmentInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.buildSid = payload.build_sid; this.uniqueName = payload.unique_name; this.domainSuffix = payload.domain_suffix; this.domainName = payload.domain_name; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new EnvironmentContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a EnvironmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a EnvironmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EnvironmentInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the deployments. */ deployments() { return this._proxy.deployments; } /** * Access the logs. */ logs() { return this._proxy.logs; } /** * Access the variables. */ variables() { return this._proxy.variables; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, buildSid: this.buildSid, uniqueName: this.uniqueName, domainSuffix: this.domainSuffix, domainName: this.domainName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EnvironmentInstance = EnvironmentInstance; function EnvironmentListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EnvironmentContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Environments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["uniqueName"] === null || params["uniqueName"] === undefined) { throw new Error("Required parameter \"params['uniqueName']\" missing."); } let data = {}; data["UniqueName"] = params["uniqueName"]; if (params["domainSuffix"] !== undefined) data["DomainSuffix"] = params["domainSuffix"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new EnvironmentInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EnvironmentPage(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 EnvironmentPage(instance._version, payload, 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; } exports.EnvironmentListInstance = EnvironmentListInstance; class EnvironmentPage extends Page_1.default { /** * Initialize the EnvironmentPage * * @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 EnvironmentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EnvironmentInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EnvironmentPage = EnvironmentPage; rest/serverless/v1/service/asset/assetVersion.d.ts000064400000021727151677225100016321 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type AssetVersionVisibility = "public" | "private" | "protected"; /** * Options to pass to each */ export interface AssetVersionListInstanceEachOptions { /** 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: AssetVersionInstance, 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 AssetVersionListInstanceOptions { /** 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 AssetVersionListInstancePageOptions { /** 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 AssetVersionContext { /** * Fetch a AssetVersionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssetVersionInstance */ fetch(callback?: (error: Error | null, item?: AssetVersionInstance) => any): Promise<AssetVersionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AssetVersionContextSolution { serviceSid: string; assetSid: string; sid: string; } export declare class AssetVersionContextImpl implements AssetVersionContext { protected _version: V1; protected _solution: AssetVersionContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, assetSid: string, sid: string); fetch(callback?: (error: Error | null, item?: AssetVersionInstance) => any): Promise<AssetVersionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AssetVersionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AssetVersionPayload extends TwilioResponsePayload { asset_versions: AssetVersionResource[]; } interface AssetVersionResource { sid: string; account_sid: string; service_sid: string; asset_sid: string; path: string; visibility: AssetVersionVisibility; date_created: Date; url: string; } export declare class AssetVersionInstance { protected _version: V1; protected _solution: AssetVersionContextSolution; protected _context?: AssetVersionContext; constructor(_version: V1, payload: AssetVersionResource, serviceSid: string, assetSid: string, sid?: string); /** * The unique string that we created to identify the Asset Version resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset Version resource. */ accountSid: string; /** * The SID of the Service that the Asset Version resource is associated with. */ serviceSid: string; /** * The SID of the Asset resource that is the parent of the Asset Version. */ assetSid: string; /** * The URL-friendly string by which the Asset Version can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash (\'/\'). If an Asset Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. */ path: string; visibility: AssetVersionVisibility; /** * The date and time in GMT when the Asset Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Asset Version resource. */ url: string; private get _proxy(); /** * Fetch a AssetVersionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssetVersionInstance */ fetch(callback?: (error: Error | null, item?: AssetVersionInstance) => any): Promise<AssetVersionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; assetSid: string; path: string; visibility: AssetVersionVisibility; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AssetVersionSolution { serviceSid: string; assetSid: string; } export interface AssetVersionListInstance { _version: V1; _solution: AssetVersionSolution; _uri: string; (sid: string): AssetVersionContext; get(sid: string): AssetVersionContext; /** * Streams AssetVersionInstance 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 { AssetVersionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AssetVersionInstance, done: (err?: Error) => void) => void): void; each(params: AssetVersionListInstanceEachOptions, callback?: (item: AssetVersionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AssetVersionInstance 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: AssetVersionPage) => any): Promise<AssetVersionPage>; /** * Lists AssetVersionInstance 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 { AssetVersionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AssetVersionInstance[]) => any): Promise<AssetVersionInstance[]>; list(params: AssetVersionListInstanceOptions, callback?: (error: Error | null, items: AssetVersionInstance[]) => any): Promise<AssetVersionInstance[]>; /** * Retrieve a single page of AssetVersionInstance 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 { AssetVersionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AssetVersionPage) => any): Promise<AssetVersionPage>; page(params: AssetVersionListInstancePageOptions, callback?: (error: Error | null, items: AssetVersionPage) => any): Promise<AssetVersionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AssetVersionListInstance(version: V1, serviceSid: string, assetSid: string): AssetVersionListInstance; export declare class AssetVersionPage extends Page<V1, AssetVersionPayload, AssetVersionResource, AssetVersionInstance> { /** * Initialize the AssetVersionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AssetVersionSolution); /** * Build an instance of AssetVersionInstance * * @param payload - Payload response from the API */ getInstance(payload: AssetVersionResource): AssetVersionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service/asset/assetVersion.js000064400000016720151677225100016062 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.AssetVersionPage = exports.AssetVersionListInstance = exports.AssetVersionInstance = exports.AssetVersionContextImpl = void 0; 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 AssetVersionContextImpl { constructor(_version, serviceSid, assetSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(assetSid)) { throw new Error("Parameter 'assetSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, assetSid, sid }; this._uri = `/Services/${serviceSid}/Assets/${assetSid}/Versions/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AssetVersionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.assetSid, 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.AssetVersionContextImpl = AssetVersionContextImpl; class AssetVersionInstance { constructor(_version, payload, serviceSid, assetSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.assetSid = payload.asset_sid; this.path = payload.path; this.visibility = payload.visibility; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { serviceSid, assetSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AssetVersionContextImpl(this._version, this._solution.serviceSid, this._solution.assetSid, this._solution.sid); return this._context; } /** * Fetch a AssetVersionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssetVersionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, assetSid: this.assetSid, path: this.path, visibility: this.visibility, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssetVersionInstance = AssetVersionInstance; function AssetVersionListInstance(version, serviceSid, assetSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(assetSid)) { throw new Error("Parameter 'assetSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AssetVersionContextImpl(version, serviceSid, assetSid, sid); }; instance._version = version; instance._solution = { serviceSid, assetSid }; instance._uri = `/Services/${serviceSid}/Assets/${assetSid}/Versions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AssetVersionPage(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 AssetVersionPage(instance._version, payload, 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; } exports.AssetVersionListInstance = AssetVersionListInstance; class AssetVersionPage extends Page_1.default { /** * Initialize the AssetVersionPage * * @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 AssetVersionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AssetVersionInstance(this._version, payload, this._solution.serviceSid, this._solution.assetSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssetVersionPage = AssetVersionPage; rest/serverless/v1/service/asset.d.ts000064400000025446151677225100013636 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { AssetVersionListInstance } from "./asset/assetVersion"; /** * Options to pass to update a AssetInstance */ export interface AssetContextUpdateOptions { /** A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters. */ friendlyName: string; } /** * Options to pass to create a AssetInstance */ export interface AssetListInstanceCreateOptions { /** A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters. */ friendlyName: string; } /** * Options to pass to each */ export interface AssetListInstanceEachOptions { /** 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: AssetInstance, 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 AssetListInstanceOptions { /** 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 AssetListInstancePageOptions { /** 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 AssetContext { assetVersions: AssetVersionListInstance; /** * Remove a AssetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AssetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssetInstance */ fetch(callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>; /** * Update a AssetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssetInstance */ update(params: AssetContextUpdateOptions, callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface AssetContextSolution { serviceSid: string; sid: string; } export declare class AssetContextImpl implements AssetContext { protected _version: V1; protected _solution: AssetContextSolution; protected _uri: string; protected _assetVersions?: AssetVersionListInstance; constructor(_version: V1, serviceSid: string, sid: string); get assetVersions(): AssetVersionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>; update(params: AssetContextUpdateOptions, callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): AssetContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface AssetPayload extends TwilioResponsePayload { assets: AssetResource[]; } interface AssetResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class AssetInstance { protected _version: V1; protected _solution: AssetContextSolution; protected _context?: AssetContext; constructor(_version: V1, payload: AssetResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Asset resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset resource. */ accountSid: string; /** * The SID of the Service that the Asset resource is associated with. */ serviceSid: string; /** * The string that you assigned to describe the Asset resource. It can be a maximum of 255 characters. */ friendlyName: string; /** * The date and time in GMT when the Asset 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 Asset resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Asset resource. */ url: string; /** * The URLs of the Asset resource\'s nested resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a AssetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a AssetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssetInstance */ fetch(callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>; /** * Update a AssetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssetInstance */ update(params: AssetContextUpdateOptions, callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>; /** * Access the assetVersions. */ assetVersions(): AssetVersionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface AssetSolution { serviceSid: string; } export interface AssetListInstance { _version: V1; _solution: AssetSolution; _uri: string; (sid: string): AssetContext; get(sid: string): AssetContext; /** * Create a AssetInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed AssetInstance */ create(params: AssetListInstanceCreateOptions, callback?: (error: Error | null, item?: AssetInstance) => any): Promise<AssetInstance>; /** * Streams AssetInstance 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 { AssetListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: AssetInstance, done: (err?: Error) => void) => void): void; each(params: AssetListInstanceEachOptions, callback?: (item: AssetInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of AssetInstance 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: AssetPage) => any): Promise<AssetPage>; /** * Lists AssetInstance 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 { AssetListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: AssetInstance[]) => any): Promise<AssetInstance[]>; list(params: AssetListInstanceOptions, callback?: (error: Error | null, items: AssetInstance[]) => any): Promise<AssetInstance[]>; /** * Retrieve a single page of AssetInstance 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 { AssetListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: AssetPage) => any): Promise<AssetPage>; page(params: AssetListInstancePageOptions, callback?: (error: Error | null, items: AssetPage) => any): Promise<AssetPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function AssetListInstance(version: V1, serviceSid: string): AssetListInstance; export declare class AssetPage extends Page<V1, AssetPayload, AssetResource, AssetInstance> { /** * Initialize the AssetPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: AssetSolution); /** * Build an instance of AssetInstance * * @param payload - Payload response from the API */ getInstance(payload: AssetResource): AssetInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service/build/buildStatus.js000064400000010471151677225100015655 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.BuildStatusListInstance = exports.BuildStatusInstance = exports.BuildStatusContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); class BuildStatusContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Builds/${sid}/Status`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BuildStatusInstance(operationVersion, payload, instance._solution.serviceSid, 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.BuildStatusContextImpl = BuildStatusContextImpl; class BuildStatusInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.status = payload.status; this.url = payload.url; this._solution = { serviceSid, sid }; } get _proxy() { this._context = this._context || new BuildStatusContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Fetch a BuildStatusInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BuildStatusInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, status: this.status, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BuildStatusInstance = BuildStatusInstance; function BuildStatusListInstance(version, serviceSid, sid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new BuildStatusContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid, sid }; 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; } exports.BuildStatusListInstance = BuildStatusListInstance; rest/serverless/v1/service/build/buildStatus.d.ts000064400000006467151677225100016123 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../V1"; export type BuildStatusStatus = "building" | "completed" | "failed"; export interface BuildStatusContext { /** * Fetch a BuildStatusInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BuildStatusInstance */ fetch(callback?: (error: Error | null, item?: BuildStatusInstance) => any): Promise<BuildStatusInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BuildStatusContextSolution { serviceSid: string; sid: string; } export declare class BuildStatusContextImpl implements BuildStatusContext { protected _version: V1; protected _solution: BuildStatusContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sid: string); fetch(callback?: (error: Error | null, item?: BuildStatusInstance) => any): Promise<BuildStatusInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BuildStatusContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BuildStatusResource { sid: string; account_sid: string; service_sid: string; status: BuildStatusStatus; url: string; } export declare class BuildStatusInstance { protected _version: V1; protected _solution: BuildStatusContextSolution; protected _context?: BuildStatusContext; constructor(_version: V1, payload: BuildStatusResource, serviceSid: string, sid: string); /** * The unique string that we created to identify the Build resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. */ accountSid: string; /** * The SID of the Service that the Build resource is associated with. */ serviceSid: string; status: BuildStatusStatus; /** * The absolute URL of the Build Status resource. */ url: string; private get _proxy(); /** * Fetch a BuildStatusInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BuildStatusInstance */ fetch(callback?: (error: Error | null, item?: BuildStatusInstance) => any): Promise<BuildStatusInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; status: BuildStatusStatus; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BuildStatusSolution { serviceSid: string; sid: string; } export interface BuildStatusListInstance { _version: V1; _solution: BuildStatusSolution; _uri: string; (): BuildStatusContext; get(): BuildStatusContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BuildStatusListInstance(version: V1, serviceSid: string, sid: string): BuildStatusListInstance; export {}; rest/serverless/v1/service/build.d.ts000064400000026011151677225100013603 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { BuildStatusListInstance } from "./build/buildStatus"; export type BuildRuntime = "node8" | "node10" | "node12" | "node14" | "node16" | "node18"; export type BuildStatus = "building" | "completed" | "failed"; /** * Options to pass to create a BuildInstance */ export interface BuildListInstanceCreateOptions { /** The list of Asset Version resource SIDs to include in the Build. */ assetVersions?: Array<string>; /** The list of the Function Version resource SIDs to include in the Build. */ functionVersions?: Array<string>; /** A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. */ dependencies?: string; /** The Runtime version that will be used to run the Build resource when it is deployed. */ runtime?: string; } /** * Options to pass to each */ export interface BuildListInstanceEachOptions { /** 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: BuildInstance, 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 BuildListInstanceOptions { /** 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 BuildListInstancePageOptions { /** 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 BuildContext { buildStatus: BuildStatusListInstance; /** * Remove a BuildInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BuildInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BuildInstance */ fetch(callback?: (error: Error | null, item?: BuildInstance) => any): Promise<BuildInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BuildContextSolution { serviceSid: string; sid: string; } export declare class BuildContextImpl implements BuildContext { protected _version: V1; protected _solution: BuildContextSolution; protected _uri: string; protected _buildStatus?: BuildStatusListInstance; constructor(_version: V1, serviceSid: string, sid: string); get buildStatus(): BuildStatusListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: BuildInstance) => any): Promise<BuildInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BuildContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BuildPayload extends TwilioResponsePayload { builds: BuildResource[]; } interface BuildResource { sid: string; account_sid: string; service_sid: string; status: BuildStatus; asset_versions: Array<any>; function_versions: Array<any>; dependencies: Array<any>; runtime: BuildRuntime; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class BuildInstance { protected _version: V1; protected _solution: BuildContextSolution; protected _context?: BuildContext; constructor(_version: V1, payload: BuildResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Build resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. */ accountSid: string; /** * The SID of the Service that the Build resource is associated with. */ serviceSid: string; status: BuildStatus; /** * The list of Asset Version resource SIDs that are included in the Build. */ assetVersions: Array<any>; /** * The list of Function Version resource SIDs that are included in the Build. */ functionVersions: Array<any>; /** * A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. */ dependencies: Array<any>; runtime: BuildRuntime; /** * The date and time in GMT when the Build 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 Build resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Build resource. */ url: string; links: Record<string, string>; private get _proxy(); /** * Remove a BuildInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BuildInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BuildInstance */ fetch(callback?: (error: Error | null, item?: BuildInstance) => any): Promise<BuildInstance>; /** * Access the buildStatus. */ buildStatus(): BuildStatusListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; status: BuildStatus; assetVersions: any[]; functionVersions: any[]; dependencies: any[]; runtime: BuildRuntime; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BuildSolution { serviceSid: string; } export interface BuildListInstance { _version: V1; _solution: BuildSolution; _uri: string; (sid: string): BuildContext; get(sid: string): BuildContext; /** * Create a BuildInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BuildInstance */ create(callback?: (error: Error | null, item?: BuildInstance) => any): Promise<BuildInstance>; /** * Create a BuildInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BuildInstance */ create(params: BuildListInstanceCreateOptions, callback?: (error: Error | null, item?: BuildInstance) => any): Promise<BuildInstance>; /** * Streams BuildInstance 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 { BuildListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BuildInstance, done: (err?: Error) => void) => void): void; each(params: BuildListInstanceEachOptions, callback?: (item: BuildInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BuildInstance 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: BuildPage) => any): Promise<BuildPage>; /** * Lists BuildInstance 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 { BuildListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BuildInstance[]) => any): Promise<BuildInstance[]>; list(params: BuildListInstanceOptions, callback?: (error: Error | null, items: BuildInstance[]) => any): Promise<BuildInstance[]>; /** * Retrieve a single page of BuildInstance 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 { BuildListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BuildPage) => any): Promise<BuildPage>; page(params: BuildListInstancePageOptions, callback?: (error: Error | null, items: BuildPage) => any): Promise<BuildPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BuildListInstance(version: V1, serviceSid: string): BuildListInstance; export declare class BuildPage extends Page<V1, BuildPayload, BuildResource, BuildInstance> { /** * Initialize the BuildPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: BuildSolution); /** * Build an instance of BuildInstance * * @param payload - Payload response from the API */ getInstance(payload: BuildResource): BuildInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service/function.d.ts000064400000026166151677225100014344 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { FunctionVersionListInstance } from "./function/functionVersion"; /** * Options to pass to update a FunctionInstance */ export interface FunctionContextUpdateOptions { /** A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. */ friendlyName: string; } /** * Options to pass to create a FunctionInstance */ export interface FunctionListInstanceCreateOptions { /** A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. */ friendlyName: string; } /** * Options to pass to each */ export interface FunctionListInstanceEachOptions { /** 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: FunctionInstance, 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 FunctionListInstanceOptions { /** 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 FunctionListInstancePageOptions { /** 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 FunctionContext { functionVersions: FunctionVersionListInstance; /** * Remove a FunctionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FunctionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionInstance */ fetch(callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>; /** * Update a FunctionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionInstance */ update(params: FunctionContextUpdateOptions, callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FunctionContextSolution { serviceSid: string; sid: string; } export declare class FunctionContextImpl implements FunctionContext { protected _version: V1; protected _solution: FunctionContextSolution; protected _uri: string; protected _functionVersions?: FunctionVersionListInstance; constructor(_version: V1, serviceSid: string, sid: string); get functionVersions(): FunctionVersionListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>; update(params: FunctionContextUpdateOptions, callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FunctionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FunctionPayload extends TwilioResponsePayload { functions: FunctionResource[]; } interface FunctionResource { sid: string; account_sid: string; service_sid: string; friendly_name: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class FunctionInstance { protected _version: V1; protected _solution: FunctionContextSolution; protected _context?: FunctionContext; constructor(_version: V1, payload: FunctionResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Function resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function resource. */ accountSid: string; /** * The SID of the Service that the Function resource is associated with. */ serviceSid: string; /** * The string that you assigned to describe the Function resource. It can be a maximum of 255 characters. */ friendlyName: string; /** * The date and time in GMT when the Function 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 Function resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Function resource. */ url: string; /** * The URLs of nested resources of the Function resource. */ links: Record<string, string>; private get _proxy(); /** * Remove a FunctionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a FunctionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionInstance */ fetch(callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>; /** * Update a FunctionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionInstance */ update(params: FunctionContextUpdateOptions, callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>; /** * Access the functionVersions. */ functionVersions(): FunctionVersionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FunctionSolution { serviceSid: string; } export interface FunctionListInstance { _version: V1; _solution: FunctionSolution; _uri: string; (sid: string): FunctionContext; get(sid: string): FunctionContext; /** * Create a FunctionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionInstance */ create(params: FunctionListInstanceCreateOptions, callback?: (error: Error | null, item?: FunctionInstance) => any): Promise<FunctionInstance>; /** * Streams FunctionInstance 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 { FunctionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: FunctionInstance, done: (err?: Error) => void) => void): void; each(params: FunctionListInstanceEachOptions, callback?: (item: FunctionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of FunctionInstance 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: FunctionPage) => any): Promise<FunctionPage>; /** * Lists FunctionInstance 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 { FunctionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: FunctionInstance[]) => any): Promise<FunctionInstance[]>; list(params: FunctionListInstanceOptions, callback?: (error: Error | null, items: FunctionInstance[]) => any): Promise<FunctionInstance[]>; /** * Retrieve a single page of FunctionInstance 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 { FunctionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: FunctionPage) => any): Promise<FunctionPage>; page(params: FunctionListInstancePageOptions, callback?: (error: Error | null, items: FunctionPage) => any): Promise<FunctionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FunctionListInstance(version: V1, serviceSid: string): FunctionListInstance; export declare class FunctionPage extends Page<V1, FunctionPayload, FunctionResource, FunctionInstance> { /** * Initialize the FunctionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: FunctionSolution); /** * Build an instance of FunctionInstance * * @param payload - Payload response from the API */ getInstance(payload: FunctionResource): FunctionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service/environment/log.d.ts000064400000023603151677225100015635 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; export type LogLevel = "info" | "warn" | "error"; /** * Options to pass to each */ export interface LogListInstanceEachOptions { /** The SID of the function whose invocation produced the Log resources to read. */ functionSid?: string; /** The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time. */ startDate?: Date; /** The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time. */ endDate?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: LogInstance, 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 LogListInstanceOptions { /** The SID of the function whose invocation produced the Log resources to read. */ functionSid?: string; /** The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time. */ startDate?: Date; /** The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time. */ endDate?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface LogListInstancePageOptions { /** The SID of the function whose invocation produced the Log resources to read. */ functionSid?: string; /** The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time. */ startDate?: Date; /** The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time. */ endDate?: Date; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface LogContext { /** * Fetch a LogInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed LogInstance */ fetch(callback?: (error: Error | null, item?: LogInstance) => any): Promise<LogInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface LogContextSolution { serviceSid: string; environmentSid: string; sid: string; } export declare class LogContextImpl implements LogContext { protected _version: V1; protected _solution: LogContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, environmentSid: string, sid: string); fetch(callback?: (error: Error | null, item?: LogInstance) => any): Promise<LogInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): LogContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface LogPayload extends TwilioResponsePayload { logs: LogResource[]; } interface LogResource { sid: string; account_sid: string; service_sid: string; environment_sid: string; build_sid: string; deployment_sid: string; function_sid: string; request_sid: string; level: LogLevel; message: string; date_created: Date; url: string; } export declare class LogInstance { protected _version: V1; protected _solution: LogContextSolution; protected _context?: LogContext; constructor(_version: V1, payload: LogResource, serviceSid: string, environmentSid: string, sid?: string); /** * The unique string that we created to identify the Log resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Log resource. */ accountSid: string; /** * The SID of the Service that the Log resource is associated with. */ serviceSid: string; /** * The SID of the environment in which the log occurred. */ environmentSid: string; /** * The SID of the build that corresponds to the log. */ buildSid: string; /** * The SID of the deployment that corresponds to the log. */ deploymentSid: string; /** * The SID of the function whose invocation produced the log. */ functionSid: string; /** * The SID of the request associated with the log. */ requestSid: string; level: LogLevel; /** * The log message. */ message: string; /** * The date and time in GMT when the Log resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Log resource. */ url: string; private get _proxy(); /** * Fetch a LogInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed LogInstance */ fetch(callback?: (error: Error | null, item?: LogInstance) => any): Promise<LogInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; environmentSid: string; buildSid: string; deploymentSid: string; functionSid: string; requestSid: string; level: LogLevel; message: string; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface LogSolution { serviceSid: string; environmentSid: string; } export interface LogListInstance { _version: V1; _solution: LogSolution; _uri: string; (sid: string): LogContext; get(sid: string): LogContext; /** * Streams LogInstance 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 { LogListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: LogInstance, done: (err?: Error) => void) => void): void; each(params: LogListInstanceEachOptions, callback?: (item: LogInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of LogInstance 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: LogPage) => any): Promise<LogPage>; /** * Lists LogInstance 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 { LogListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: LogInstance[]) => any): Promise<LogInstance[]>; list(params: LogListInstanceOptions, callback?: (error: Error | null, items: LogInstance[]) => any): Promise<LogInstance[]>; /** * Retrieve a single page of LogInstance 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 { LogListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: LogPage) => any): Promise<LogPage>; page(params: LogListInstancePageOptions, callback?: (error: Error | null, items: LogPage) => any): Promise<LogPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function LogListInstance(version: V1, serviceSid: string, environmentSid: string): LogListInstance; export declare class LogPage extends Page<V1, LogPayload, LogResource, LogInstance> { /** * Initialize the LogPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: LogSolution); /** * Build an instance of LogInstance * * @param payload - Payload response from the API */ getInstance(payload: LogResource): LogInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service/environment/deployment.js000064400000021023151677225100016772 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.DeploymentPage = exports.DeploymentListInstance = exports.DeploymentInstance = exports.DeploymentContextImpl = void 0; 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 DeploymentContextImpl { constructor(_version, serviceSid, environmentSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(environmentSid)) { throw new Error("Parameter 'environmentSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, environmentSid, sid }; this._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Deployments/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DeploymentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid, 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.DeploymentContextImpl = DeploymentContextImpl; class DeploymentInstance { constructor(_version, payload, serviceSid, environmentSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.environmentSid = payload.environment_sid; this.buildSid = payload.build_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, environmentSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new DeploymentContextImpl(this._version, this._solution.serviceSid, this._solution.environmentSid, this._solution.sid); return this._context; } /** * Fetch a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, environmentSid: this.environmentSid, buildSid: this.buildSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeploymentInstance = DeploymentInstance; function DeploymentListInstance(version, serviceSid, environmentSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(environmentSid)) { throw new Error("Parameter 'environmentSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new DeploymentContextImpl(version, serviceSid, environmentSid, sid); }; instance._version = version; instance._solution = { serviceSid, environmentSid }; instance._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Deployments`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["buildSid"] !== undefined) data["BuildSid"] = params["buildSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new DeploymentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DeploymentPage(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 DeploymentPage(instance._version, payload, 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; } exports.DeploymentListInstance = DeploymentListInstance; class DeploymentPage extends Page_1.default { /** * Initialize the DeploymentPage * * @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 DeploymentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DeploymentInstance(this._version, payload, this._solution.serviceSid, this._solution.environmentSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DeploymentPage = DeploymentPage; rest/serverless/v1/service/environment/deployment.d.ts000064400000022760151677225100017237 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to create a DeploymentInstance */ export interface DeploymentListInstanceCreateOptions { /** The SID of the Build for the Deployment. */ buildSid?: string; } /** * Options to pass to each */ export interface DeploymentListInstanceEachOptions { /** 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: DeploymentInstance, 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 DeploymentListInstanceOptions { /** 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 DeploymentListInstancePageOptions { /** 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 DeploymentContext { /** * Fetch a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ fetch(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DeploymentContextSolution { serviceSid: string; environmentSid: string; sid: string; } export declare class DeploymentContextImpl implements DeploymentContext { protected _version: V1; protected _solution: DeploymentContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, environmentSid: string, sid: string); fetch(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DeploymentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DeploymentPayload extends TwilioResponsePayload { deployments: DeploymentResource[]; } interface DeploymentResource { sid: string; account_sid: string; service_sid: string; environment_sid: string; build_sid: string; date_created: Date; date_updated: Date; url: string; } export declare class DeploymentInstance { protected _version: V1; protected _solution: DeploymentContextSolution; protected _context?: DeploymentContext; constructor(_version: V1, payload: DeploymentResource, serviceSid: string, environmentSid: string, sid?: string); /** * The unique string that we created to identify the Deployment resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Deployment resource. */ accountSid: string; /** * The SID of the Service that the Deployment resource is associated with. */ serviceSid: string; /** * The SID of the Environment for the Deployment. */ environmentSid: string; /** * The SID of the Build for the deployment. */ buildSid: string; /** * The date and time in GMT when the Deployment 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 Deployment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Deployment resource. */ url: string; private get _proxy(); /** * Fetch a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ fetch(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; environmentSid: string; buildSid: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DeploymentSolution { serviceSid: string; environmentSid: string; } export interface DeploymentListInstance { _version: V1; _solution: DeploymentSolution; _uri: string; (sid: string): DeploymentContext; get(sid: string): DeploymentContext; /** * Create a DeploymentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ create(callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Create a DeploymentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed DeploymentInstance */ create(params: DeploymentListInstanceCreateOptions, callback?: (error: Error | null, item?: DeploymentInstance) => any): Promise<DeploymentInstance>; /** * Streams DeploymentInstance 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 { DeploymentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void): void; each(params: DeploymentListInstanceEachOptions, callback?: (item: DeploymentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DeploymentInstance 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: DeploymentPage) => any): Promise<DeploymentPage>; /** * Lists DeploymentInstance 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 { DeploymentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DeploymentInstance[]) => any): Promise<DeploymentInstance[]>; list(params: DeploymentListInstanceOptions, callback?: (error: Error | null, items: DeploymentInstance[]) => any): Promise<DeploymentInstance[]>; /** * Retrieve a single page of DeploymentInstance 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 { DeploymentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DeploymentPage) => any): Promise<DeploymentPage>; page(params: DeploymentListInstancePageOptions, callback?: (error: Error | null, items: DeploymentPage) => any): Promise<DeploymentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DeploymentListInstance(version: V1, serviceSid: string, environmentSid: string): DeploymentListInstance; export declare class DeploymentPage extends Page<V1, DeploymentPayload, DeploymentResource, DeploymentInstance> { /** * Initialize the DeploymentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DeploymentSolution); /** * Build an instance of DeploymentInstance * * @param payload - Payload response from the API */ getInstance(payload: DeploymentResource): DeploymentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service/environment/variable.js000064400000024751151677225100016412 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.VariablePage = exports.VariableListInstance = exports.VariableInstance = exports.VariableContextImpl = void 0; 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 VariableContextImpl { constructor(_version, serviceSid, environmentSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(environmentSid)) { throw new Error("Parameter 'environmentSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, environmentSid, sid }; this._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Variables/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new VariableInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid, 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["key"] !== undefined) data["Key"] = params["key"]; if (params["value"] !== undefined) data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new VariableInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid, 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.VariableContextImpl = VariableContextImpl; class VariableInstance { constructor(_version, payload, serviceSid, environmentSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.environmentSid = payload.environment_sid; this.key = payload.key; this.value = payload.value; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { serviceSid, environmentSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new VariableContextImpl(this._version, this._solution.serviceSid, this._solution.environmentSid, this._solution.sid); return this._context; } /** * Remove a VariableInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a VariableInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VariableInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, environmentSid: this.environmentSid, key: this.key, value: this.value, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.VariableInstance = VariableInstance; function VariableListInstance(version, serviceSid, environmentSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(environmentSid)) { throw new Error("Parameter 'environmentSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new VariableContextImpl(version, serviceSid, environmentSid, sid); }; instance._version = version; instance._solution = { serviceSid, environmentSid }; instance._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Variables`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["key"] === null || params["key"] === undefined) { throw new Error("Required parameter \"params['key']\" missing."); } if (params["value"] === null || params["value"] === undefined) { throw new Error("Required parameter \"params['value']\" missing."); } let data = {}; data["Key"] = params["key"]; data["Value"] = params["value"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new VariableInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new VariablePage(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 VariablePage(instance._version, payload, 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; } exports.VariableListInstance = VariableListInstance; class VariablePage extends Page_1.default { /** * Initialize the VariablePage * * @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 VariableInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new VariableInstance(this._version, payload, this._solution.serviceSid, this._solution.environmentSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.VariablePage = VariablePage; rest/serverless/v1/service/environment/log.js000064400000020044151677225100015375 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.LogPage = exports.LogListInstance = exports.LogInstance = exports.LogContextImpl = void 0; 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 LogContextImpl { constructor(_version, serviceSid, environmentSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(environmentSid)) { throw new Error("Parameter 'environmentSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, environmentSid, sid }; this._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Logs/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new LogInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.environmentSid, 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.LogContextImpl = LogContextImpl; class LogInstance { constructor(_version, payload, serviceSid, environmentSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.environmentSid = payload.environment_sid; this.buildSid = payload.build_sid; this.deploymentSid = payload.deployment_sid; this.functionSid = payload.function_sid; this.requestSid = payload.request_sid; this.level = payload.level; this.message = payload.message; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { serviceSid, environmentSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new LogContextImpl(this._version, this._solution.serviceSid, this._solution.environmentSid, this._solution.sid); return this._context; } /** * Fetch a LogInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed LogInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, environmentSid: this.environmentSid, buildSid: this.buildSid, deploymentSid: this.deploymentSid, functionSid: this.functionSid, requestSid: this.requestSid, level: this.level, message: this.message, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LogInstance = LogInstance; function LogListInstance(version, serviceSid, environmentSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(environmentSid)) { throw new Error("Parameter 'environmentSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new LogContextImpl(version, serviceSid, environmentSid, sid); }; instance._version = version; instance._solution = { serviceSid, environmentSid }; instance._uri = `/Services/${serviceSid}/Environments/${environmentSid}/Logs`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["functionSid"] !== undefined) data["FunctionSid"] = params["functionSid"]; if (params["startDate"] !== undefined) data["StartDate"] = serialize.iso8601DateTime(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601DateTime(params["endDate"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new LogPage(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 LogPage(instance._version, payload, 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; } exports.LogListInstance = LogListInstance; class LogPage extends Page_1.default { /** * Initialize the LogPage * * @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 LogInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new LogInstance(this._version, payload, this._solution.serviceSid, this._solution.environmentSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.LogPage = LogPage; rest/serverless/v1/service/environment/variable.d.ts000064400000027437151677225100016652 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; /** * Options to pass to update a VariableInstance */ export interface VariableContextUpdateOptions { /** A string by which the Variable resource can be referenced. It can be a maximum of 128 characters. */ key?: string; /** A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size. */ value?: string; } /** * Options to pass to create a VariableInstance */ export interface VariableListInstanceCreateOptions { /** A string by which the Variable resource can be referenced. It can be a maximum of 128 characters. */ key: string; /** A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size. */ value: string; } /** * Options to pass to each */ export interface VariableListInstanceEachOptions { /** 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: VariableInstance, 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 VariableListInstanceOptions { /** 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 VariableListInstancePageOptions { /** 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 VariableContext { /** * Remove a VariableInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a VariableInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VariableInstance */ fetch(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>; /** * Update a VariableInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VariableInstance */ update(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>; /** * Update a VariableInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed VariableInstance */ update(params: VariableContextUpdateOptions, callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface VariableContextSolution { serviceSid: string; environmentSid: string; sid: string; } export declare class VariableContextImpl implements VariableContext { protected _version: V1; protected _solution: VariableContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, environmentSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>; update(params?: VariableContextUpdateOptions | ((error: Error | null, item?: VariableInstance) => any), callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): VariableContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface VariablePayload extends TwilioResponsePayload { variables: VariableResource[]; } interface VariableResource { sid: string; account_sid: string; service_sid: string; environment_sid: string; key: string; value: string; date_created: Date; date_updated: Date; url: string; } export declare class VariableInstance { protected _version: V1; protected _solution: VariableContextSolution; protected _context?: VariableContext; constructor(_version: V1, payload: VariableResource, serviceSid: string, environmentSid: string, sid?: string); /** * The unique string that we created to identify the Variable resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Variable resource. */ accountSid: string; /** * The SID of the Service that the Variable resource is associated with. */ serviceSid: string; /** * The SID of the Environment in which the Variable exists. */ environmentSid: string; /** * A string by which the Variable resource can be referenced. */ key: string; /** * A string that contains the actual value of the Variable. */ value: string; /** * The date and time in GMT when the Variable 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 Variable resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Variable resource. */ url: string; private get _proxy(); /** * Remove a VariableInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a VariableInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VariableInstance */ fetch(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>; /** * Update a VariableInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed VariableInstance */ update(callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>; /** * Update a VariableInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed VariableInstance */ update(params: VariableContextUpdateOptions, callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; environmentSid: string; key: string; value: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface VariableSolution { serviceSid: string; environmentSid: string; } export interface VariableListInstance { _version: V1; _solution: VariableSolution; _uri: string; (sid: string): VariableContext; get(sid: string): VariableContext; /** * Create a VariableInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed VariableInstance */ create(params: VariableListInstanceCreateOptions, callback?: (error: Error | null, item?: VariableInstance) => any): Promise<VariableInstance>; /** * Streams VariableInstance 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 { VariableListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: VariableInstance, done: (err?: Error) => void) => void): void; each(params: VariableListInstanceEachOptions, callback?: (item: VariableInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of VariableInstance 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: VariablePage) => any): Promise<VariablePage>; /** * Lists VariableInstance 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 { VariableListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: VariableInstance[]) => any): Promise<VariableInstance[]>; list(params: VariableListInstanceOptions, callback?: (error: Error | null, items: VariableInstance[]) => any): Promise<VariableInstance[]>; /** * Retrieve a single page of VariableInstance 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 { VariableListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: VariablePage) => any): Promise<VariablePage>; page(params: VariableListInstancePageOptions, callback?: (error: Error | null, items: VariablePage) => any): Promise<VariablePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function VariableListInstance(version: V1, serviceSid: string, environmentSid: string): VariableListInstance; export declare class VariablePage extends Page<V1, VariablePayload, VariableResource, VariableInstance> { /** * Initialize the VariablePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: VariableSolution); /** * Build an instance of VariableInstance * * @param payload - Payload response from the API */ getInstance(payload: VariableResource): VariableInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service/build.js000064400000022761151677225100013357 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.BuildPage = exports.BuildListInstance = exports.BuildInstance = exports.BuildContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const buildStatus_1 = require("./build/buildStatus"); class BuildContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Builds/${sid}`; } get buildStatus() { this._buildStatus = this._buildStatus || (0, buildStatus_1.BuildStatusListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._buildStatus; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BuildInstance(operationVersion, payload, instance._solution.serviceSid, 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.BuildContextImpl = BuildContextImpl; class BuildInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.status = payload.status; this.assetVersions = payload.asset_versions; this.functionVersions = payload.function_versions; this.dependencies = payload.dependencies; this.runtime = payload.runtime; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new BuildContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a BuildInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a BuildInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BuildInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the buildStatus. */ buildStatus() { return this._proxy.buildStatus; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, status: this.status, assetVersions: this.assetVersions, functionVersions: this.functionVersions, dependencies: this.dependencies, runtime: this.runtime, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BuildInstance = BuildInstance; function BuildListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new BuildContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Builds`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["assetVersions"] !== undefined) data["AssetVersions"] = serialize.map(params["assetVersions"], (e) => e); if (params["functionVersions"] !== undefined) data["FunctionVersions"] = serialize.map(params["functionVersions"], (e) => e); if (params["dependencies"] !== undefined) data["Dependencies"] = params["dependencies"]; if (params["runtime"] !== undefined) data["Runtime"] = params["runtime"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BuildInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BuildPage(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 BuildPage(instance._version, payload, 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; } exports.BuildListInstance = BuildListInstance; class BuildPage extends Page_1.default { /** * Initialize the BuildPage * * @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 BuildInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BuildInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BuildPage = BuildPage; rest/serverless/v1/service/asset.js000064400000024032151677225100013370 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.AssetPage = exports.AssetListInstance = exports.AssetInstance = exports.AssetContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); const assetVersion_1 = require("./asset/assetVersion"); class AssetContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Assets/${sid}`; } get assetVersions() { this._assetVersions = this._assetVersions || (0, assetVersion_1.AssetVersionListInstance)(this._version, this._solution.serviceSid, this._solution.sid); return this._assetVersions; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new AssetInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AssetInstance(operationVersion, payload, instance._solution.serviceSid, 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.AssetContextImpl = AssetContextImpl; class AssetInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_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.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new AssetContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a AssetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a AssetInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed AssetInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the assetVersions. */ assetVersions() { return this._proxy.assetVersions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssetInstance = AssetInstance; function AssetListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new AssetContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Assets`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new AssetInstance(operationVersion, payload, instance._solution.serviceSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new AssetPage(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 AssetPage(instance._version, payload, 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; } exports.AssetListInstance = AssetListInstance; class AssetPage extends Page_1.default { /** * Initialize the AssetPage * * @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 AssetInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new AssetInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.AssetPage = AssetPage; rest/serverless/v1/service/environment.d.ts000064400000026652151677225100015063 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; import { DeploymentListInstance } from "./environment/deployment"; import { LogListInstance } from "./environment/log"; import { VariableListInstance } from "./environment/variable"; /** * Options to pass to create a EnvironmentInstance */ export interface EnvironmentListInstanceCreateOptions { /** A user-defined string that uniquely identifies the Environment resource. It can be a maximum of 100 characters. */ uniqueName: string; /** A URL-friendly name that represents the environment and forms part of the domain name. It can be a maximum of 16 characters. */ domainSuffix?: string; } /** * Options to pass to each */ export interface EnvironmentListInstanceEachOptions { /** 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: EnvironmentInstance, 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 EnvironmentListInstanceOptions { /** 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 EnvironmentListInstancePageOptions { /** 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 EnvironmentContext { deployments: DeploymentListInstance; logs: LogListInstance; variables: VariableListInstance; /** * Remove a EnvironmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EnvironmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EnvironmentInstance */ fetch(callback?: (error: Error | null, item?: EnvironmentInstance) => any): Promise<EnvironmentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EnvironmentContextSolution { serviceSid: string; sid: string; } export declare class EnvironmentContextImpl implements EnvironmentContext { protected _version: V1; protected _solution: EnvironmentContextSolution; protected _uri: string; protected _deployments?: DeploymentListInstance; protected _logs?: LogListInstance; protected _variables?: VariableListInstance; constructor(_version: V1, serviceSid: string, sid: string); get deployments(): DeploymentListInstance; get logs(): LogListInstance; get variables(): VariableListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: EnvironmentInstance) => any): Promise<EnvironmentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EnvironmentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EnvironmentPayload extends TwilioResponsePayload { environments: EnvironmentResource[]; } interface EnvironmentResource { sid: string; account_sid: string; service_sid: string; build_sid: string; unique_name: string; domain_suffix: string; domain_name: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; } export declare class EnvironmentInstance { protected _version: V1; protected _solution: EnvironmentContextSolution; protected _context?: EnvironmentContext; constructor(_version: V1, payload: EnvironmentResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Environment resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Environment resource. */ accountSid: string; /** * The SID of the Service that the Environment resource is associated with. */ serviceSid: string; /** * The SID of the build deployed in the environment. */ buildSid: string; /** * A user-defined string that uniquely identifies the Environment resource. */ uniqueName: string; /** * A URL-friendly name that represents the environment and forms part of the domain name. */ domainSuffix: string; /** * The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix. */ domainName: string; /** * The date and time in GMT when the Environment 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 Environment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Environment resource. */ url: string; /** * The URLs of the Environment resource\'s nested resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a EnvironmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EnvironmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EnvironmentInstance */ fetch(callback?: (error: Error | null, item?: EnvironmentInstance) => any): Promise<EnvironmentInstance>; /** * Access the deployments. */ deployments(): DeploymentListInstance; /** * Access the logs. */ logs(): LogListInstance; /** * Access the variables. */ variables(): VariableListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; buildSid: string; uniqueName: string; domainSuffix: string; domainName: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EnvironmentSolution { serviceSid: string; } export interface EnvironmentListInstance { _version: V1; _solution: EnvironmentSolution; _uri: string; (sid: string): EnvironmentContext; get(sid: string): EnvironmentContext; /** * Create a EnvironmentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EnvironmentInstance */ create(params: EnvironmentListInstanceCreateOptions, callback?: (error: Error | null, item?: EnvironmentInstance) => any): Promise<EnvironmentInstance>; /** * Streams EnvironmentInstance 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 { EnvironmentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EnvironmentInstance, done: (err?: Error) => void) => void): void; each(params: EnvironmentListInstanceEachOptions, callback?: (item: EnvironmentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EnvironmentInstance 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: EnvironmentPage) => any): Promise<EnvironmentPage>; /** * Lists EnvironmentInstance 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 { EnvironmentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EnvironmentInstance[]) => any): Promise<EnvironmentInstance[]>; list(params: EnvironmentListInstanceOptions, callback?: (error: Error | null, items: EnvironmentInstance[]) => any): Promise<EnvironmentInstance[]>; /** * Retrieve a single page of EnvironmentInstance 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 { EnvironmentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EnvironmentPage) => any): Promise<EnvironmentPage>; page(params: EnvironmentListInstancePageOptions, callback?: (error: Error | null, items: EnvironmentPage) => any): Promise<EnvironmentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EnvironmentListInstance(version: V1, serviceSid: string): EnvironmentListInstance; export declare class EnvironmentPage extends Page<V1, EnvironmentPayload, EnvironmentResource, EnvironmentInstance> { /** * Initialize the EnvironmentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: EnvironmentSolution); /** * Build an instance of EnvironmentInstance * * @param payload - Payload response from the API */ getInstance(payload: EnvironmentResource): EnvironmentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service/function/functionVersion.d.ts000064400000023407151677225100017532 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../../base/Page"; import Response from "../../../../../http/response"; import V1 from "../../../V1"; import { FunctionVersionContentListInstance } from "./functionVersion/functionVersionContent"; export type FunctionVersionVisibility = "public" | "private" | "protected"; /** * Options to pass to each */ export interface FunctionVersionListInstanceEachOptions { /** 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: FunctionVersionInstance, 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 FunctionVersionListInstanceOptions { /** 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 FunctionVersionListInstancePageOptions { /** 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 FunctionVersionContext { functionVersionContent: FunctionVersionContentListInstance; /** * Fetch a FunctionVersionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionVersionInstance */ fetch(callback?: (error: Error | null, item?: FunctionVersionInstance) => any): Promise<FunctionVersionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FunctionVersionContextSolution { serviceSid: string; functionSid: string; sid: string; } export declare class FunctionVersionContextImpl implements FunctionVersionContext { protected _version: V1; protected _solution: FunctionVersionContextSolution; protected _uri: string; protected _functionVersionContent?: FunctionVersionContentListInstance; constructor(_version: V1, serviceSid: string, functionSid: string, sid: string); get functionVersionContent(): FunctionVersionContentListInstance; fetch(callback?: (error: Error | null, item?: FunctionVersionInstance) => any): Promise<FunctionVersionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FunctionVersionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FunctionVersionPayload extends TwilioResponsePayload { function_versions: FunctionVersionResource[]; } interface FunctionVersionResource { sid: string; account_sid: string; service_sid: string; function_sid: string; path: string; visibility: FunctionVersionVisibility; date_created: Date; url: string; links: Record<string, string>; } export declare class FunctionVersionInstance { protected _version: V1; protected _solution: FunctionVersionContextSolution; protected _context?: FunctionVersionContext; constructor(_version: V1, payload: FunctionVersionResource, serviceSid: string, functionSid: string, sid?: string); /** * The unique string that we created to identify the Function Version resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. */ accountSid: string; /** * The SID of the Service that the Function Version resource is associated with. */ serviceSid: string; /** * The SID of the Function resource that is the parent of the Function Version resource. */ functionSid: string; /** * The URL-friendly string by which the Function Version resource can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash (\'/\'). If a Function Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. */ path: string; visibility: FunctionVersionVisibility; /** * The date and time in GMT when the Function Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Function Version resource. */ url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a FunctionVersionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionVersionInstance */ fetch(callback?: (error: Error | null, item?: FunctionVersionInstance) => any): Promise<FunctionVersionInstance>; /** * Access the functionVersionContent. */ functionVersionContent(): FunctionVersionContentListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; functionSid: string; path: string; visibility: FunctionVersionVisibility; dateCreated: Date; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FunctionVersionSolution { serviceSid: string; functionSid: string; } export interface FunctionVersionListInstance { _version: V1; _solution: FunctionVersionSolution; _uri: string; (sid: string): FunctionVersionContext; get(sid: string): FunctionVersionContext; /** * Streams FunctionVersionInstance 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 { FunctionVersionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: FunctionVersionInstance, done: (err?: Error) => void) => void): void; each(params: FunctionVersionListInstanceEachOptions, callback?: (item: FunctionVersionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of FunctionVersionInstance 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: FunctionVersionPage) => any): Promise<FunctionVersionPage>; /** * Lists FunctionVersionInstance 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 { FunctionVersionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: FunctionVersionInstance[]) => any): Promise<FunctionVersionInstance[]>; list(params: FunctionVersionListInstanceOptions, callback?: (error: Error | null, items: FunctionVersionInstance[]) => any): Promise<FunctionVersionInstance[]>; /** * Retrieve a single page of FunctionVersionInstance 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 { FunctionVersionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: FunctionVersionPage) => any): Promise<FunctionVersionPage>; page(params: FunctionVersionListInstancePageOptions, callback?: (error: Error | null, items: FunctionVersionPage) => any): Promise<FunctionVersionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FunctionVersionListInstance(version: V1, serviceSid: string, functionSid: string): FunctionVersionListInstance; export declare class FunctionVersionPage extends Page<V1, FunctionVersionPayload, FunctionVersionResource, FunctionVersionInstance> { /** * Initialize the FunctionVersionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: FunctionVersionSolution); /** * Build an instance of FunctionVersionInstance * * @param payload - Payload response from the API */ getInstance(payload: FunctionVersionResource): FunctionVersionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/serverless/v1/service/function/functionVersion/functionVersionContent.d.ts000064400000007507151677225100024263 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../../../V1"; export interface FunctionVersionContentContext { /** * Fetch a FunctionVersionContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionVersionContentInstance */ fetch(callback?: (error: Error | null, item?: FunctionVersionContentInstance) => any): Promise<FunctionVersionContentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface FunctionVersionContentContextSolution { serviceSid: string; functionSid: string; sid: string; } export declare class FunctionVersionContentContextImpl implements FunctionVersionContentContext { protected _version: V1; protected _solution: FunctionVersionContentContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, functionSid: string, sid: string); fetch(callback?: (error: Error | null, item?: FunctionVersionContentInstance) => any): Promise<FunctionVersionContentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): FunctionVersionContentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface FunctionVersionContentResource { sid: string; account_sid: string; service_sid: string; function_sid: string; content: string; url: string; } export declare class FunctionVersionContentInstance { protected _version: V1; protected _solution: FunctionVersionContentContextSolution; protected _context?: FunctionVersionContentContext; constructor(_version: V1, payload: FunctionVersionContentResource, serviceSid: string, functionSid: string, sid: string); /** * The unique string that we created to identify the Function Version resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. */ accountSid: string; /** * The SID of the Service that the Function Version resource is associated with. */ serviceSid: string; /** * The SID of the Function that is the parent of the Function Version. */ functionSid: string; /** * The content of the Function Version resource. */ content: string; url: string; private get _proxy(); /** * Fetch a FunctionVersionContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionVersionContentInstance */ fetch(callback?: (error: Error | null, item?: FunctionVersionContentInstance) => any): Promise<FunctionVersionContentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; functionSid: string; content: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface FunctionVersionContentSolution { serviceSid: string; functionSid: string; sid: string; } export interface FunctionVersionContentListInstance { _version: V1; _solution: FunctionVersionContentSolution; _uri: string; (): FunctionVersionContentContext; get(): FunctionVersionContentContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function FunctionVersionContentListInstance(version: V1, serviceSid: string, functionSid: string, sid: string): FunctionVersionContentListInstance; export {}; rest/serverless/v1/service/function/functionVersion/functionVersionContent.js000064400000012036151677225100024020 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.FunctionVersionContentListInstance = exports.FunctionVersionContentInstance = exports.FunctionVersionContentContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../../../base/deserialize"); const serialize = require("../../../../../../base/serialize"); const utility_1 = require("../../../../../../base/utility"); class FunctionVersionContentContextImpl { constructor(_version, serviceSid, functionSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(functionSid)) { throw new Error("Parameter 'functionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, functionSid, sid }; this._uri = `/Services/${serviceSid}/Functions/${functionSid}/Versions/${sid}/Content`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FunctionVersionContentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.functionSid, 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.FunctionVersionContentContextImpl = FunctionVersionContentContextImpl; class FunctionVersionContentInstance { constructor(_version, payload, serviceSid, functionSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.functionSid = payload.function_sid; this.content = payload.content; this.url = payload.url; this._solution = { serviceSid, functionSid, sid }; } get _proxy() { this._context = this._context || new FunctionVersionContentContextImpl(this._version, this._solution.serviceSid, this._solution.functionSid, this._solution.sid); return this._context; } /** * Fetch a FunctionVersionContentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionVersionContentInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, functionSid: this.functionSid, content: this.content, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FunctionVersionContentInstance = FunctionVersionContentInstance; function FunctionVersionContentListInstance(version, serviceSid, functionSid, sid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(functionSid)) { throw new Error("Parameter 'functionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new FunctionVersionContentContextImpl(version, serviceSid, functionSid, sid); }; instance._version = version; instance._solution = { serviceSid, functionSid, sid }; 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; } exports.FunctionVersionContentListInstance = FunctionVersionContentListInstance; rest/serverless/v1/service/function/functionVersion.js000064400000020340151677225100017267 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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.FunctionVersionPage = exports.FunctionVersionListInstance = exports.FunctionVersionInstance = exports.FunctionVersionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../../base/Page")); const deserialize = require("../../../../../base/deserialize"); const serialize = require("../../../../../base/serialize"); const utility_1 = require("../../../../../base/utility"); const functionVersionContent_1 = require("./functionVersion/functionVersionContent"); class FunctionVersionContextImpl { constructor(_version, serviceSid, functionSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(functionSid)) { throw new Error("Parameter 'functionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, functionSid, sid }; this._uri = `/Services/${serviceSid}/Functions/${functionSid}/Versions/${sid}`; } get functionVersionContent() { this._functionVersionContent = this._functionVersionContent || (0, functionVersionContent_1.FunctionVersionContentListInstance)(this._version, this._solution.serviceSid, this._solution.functionSid, this._solution.sid); return this._functionVersionContent; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new FunctionVersionInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.functionSid, 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.FunctionVersionContextImpl = FunctionVersionContextImpl; class FunctionVersionInstance { constructor(_version, payload, serviceSid, functionSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.functionSid = payload.function_sid; this.path = payload.path; this.visibility = payload.visibility; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, functionSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new FunctionVersionContextImpl(this._version, this._solution.serviceSid, this._solution.functionSid, this._solution.sid); return this._context; } /** * Fetch a FunctionVersionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed FunctionVersionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the functionVersionContent. */ functionVersionContent() { return this._proxy.functionVersionContent; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, functionSid: this.functionSid, path: this.path, visibility: this.visibility, dateCreated: this.dateCreated, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FunctionVersionInstance = FunctionVersionInstance; function FunctionVersionListInstance(version, serviceSid, functionSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(functionSid)) { throw new Error("Parameter 'functionSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new FunctionVersionContextImpl(version, serviceSid, functionSid, sid); }; instance._version = version; instance._solution = { serviceSid, functionSid }; instance._uri = `/Services/${serviceSid}/Functions/${functionSid}/Versions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new FunctionVersionPage(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 FunctionVersionPage(instance._version, payload, 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; } exports.FunctionVersionListInstance = FunctionVersionListInstance; class FunctionVersionPage extends Page_1.default { /** * Initialize the FunctionVersionPage * * @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 FunctionVersionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new FunctionVersionInstance(this._version, payload, this._solution.serviceSid, this._solution.functionSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.FunctionVersionPage = FunctionVersionPage; rest/serverless/V1.js000064400000002352151677225100010552 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Serverless * 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 service_1 = require("./v1/service"); class V1 extends Version_1.default { /** * Initialize the V1 version of Serverless * * @param domain - The Twilio (Twilio.Serverless) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } } exports.default = V1; rest/Events.js000064400000002072151677225100007332 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const EventsBase_1 = __importDefault(require("./EventsBase")); class Events extends EventsBase_1.default { /** * @deprecated - Use v1.eventTypes instead */ get eventTypes() { console.warn("eventTypes is deprecated. Use v1.eventTypes instead."); return this.v1.eventTypes; } /** * @deprecated - Use v1.schemas instead */ get schemas() { console.warn("schemas is deprecated. Use v1.schemas instead."); return this.v1.schemas; } /** * @deprecated - Use v1.sinks instead */ get sinks() { console.warn("sinks is deprecated. Use v1.sinks instead."); return this.v1.sinks; } /** * @deprecated - Use v1.subscriptions instead */ get subscriptions() { console.warn("subscriptions is deprecated. Use v1.subscriptions instead."); return this.v1.subscriptions; } } module.exports = Events; rest/notify/V1.d.ts000064400000001461151677225100010121 0ustar00import NotifyBase from "../NotifyBase"; import Version from "../../base/Version"; import { CredentialListInstance } from "./v1/credential"; import { ServiceListInstance } from "./v1/service"; export default class V1 extends Version { /** * Initialize the V1 version of Notify * * @param domain - The Twilio (Twilio.Notify) domain */ constructor(domain: NotifyBase); /** credentials - { Twilio.Notify.V1.CredentialListInstance } resource */ protected _credentials?: CredentialListInstance; /** services - { Twilio.Notify.V1.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** Getter for credentials resource */ get credentials(): CredentialListInstance; /** Getter for services resource */ get services(): ServiceListInstance; } rest/notify/v1/service.d.ts000064400000046145151677225100011631 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { BindingListInstance } from "./service/binding"; import { NotificationListInstance } from "./service/notification"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. */ apnCredentialSid?: string; /** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. */ gcmCredentialSid?: string; /** The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. */ messagingServiceSid?: string; /** Deprecated. */ facebookMessengerPageId?: string; /** The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */ defaultApnNotificationProtocolVersion?: string; /** The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */ defaultGcmNotificationProtocolVersion?: string; /** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. */ fcmCredentialSid?: string; /** The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */ defaultFcmNotificationProtocolVersion?: string; /** Whether to log notifications. Can be: `true` or `false` and the default is `true`. */ logEnabled?: boolean; /** Deprecated. */ alexaSkillId?: string; /** Deprecated. */ defaultAlexaNotificationProtocolVersion?: string; /** URL to send delivery status callback. */ deliveryCallbackUrl?: string; /** Callback configuration that enables delivery callbacks, default false */ deliveryCallbackEnabled?: boolean; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. */ apnCredentialSid?: string; /** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. */ gcmCredentialSid?: string; /** The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. */ messagingServiceSid?: string; /** Deprecated. */ facebookMessengerPageId?: string; /** The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */ defaultApnNotificationProtocolVersion?: string; /** The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */ defaultGcmNotificationProtocolVersion?: string; /** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. */ fcmCredentialSid?: string; /** The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */ defaultFcmNotificationProtocolVersion?: string; /** Whether to log notifications. Can be: `true` or `false` and the default is `true`. */ logEnabled?: boolean; /** Deprecated. */ alexaSkillId?: string; /** Deprecated. */ defaultAlexaNotificationProtocolVersion?: string; /** URL to send delivery status callback. */ deliveryCallbackUrl?: string; /** Callback configuration that enables delivery callbacks, default false */ deliveryCallbackEnabled?: boolean; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** The string that identifies the Service resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: ServiceInstance, 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 ServiceListInstanceOptions { /** The string that identifies the Service resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface ServiceListInstancePageOptions { /** The string that identifies the Service resources to read. */ friendlyName?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface ServiceContext { bindings: BindingListInstance; notifications: NotificationListInstance; /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V1; protected _solution: ServiceContextSolution; protected _uri: string; protected _bindings?: BindingListInstance; protected _notifications?: NotificationListInstance; constructor(_version: V1, sid: string); get bindings(): BindingListInstance; get notifications(): NotificationListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { sid: string; account_sid: string; friendly_name: string; date_created: Date; date_updated: Date; apn_credential_sid: string; gcm_credential_sid: string; fcm_credential_sid: string; messaging_service_sid: string; facebook_messenger_page_id: string; default_apn_notification_protocol_version: string; default_gcm_notification_protocol_version: string; default_fcm_notification_protocol_version: string; log_enabled: boolean; url: string; links: Record<string, string>; alexa_skill_id: string; default_alexa_notification_protocol_version: string; delivery_callback_url: string; delivery_callback_enabled: boolean; } export declare class ServiceInstance { protected _version: V1; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V1, payload: ServiceResource, sid?: string); /** * The unique string that we created to identify the Service resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service 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 SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. */ apnCredentialSid: string; /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. */ gcmCredentialSid: string; /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. */ fcmCredentialSid: string; /** * The SID of the [Messaging Service](https://www.twilio.com/docs/sms/quickstart#messaging-services) to use for SMS Bindings. In order to send SMS notifications this parameter has to be set. */ messagingServiceSid: string; /** * Deprecated. */ facebookMessengerPageId: string; /** * The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */ defaultApnNotificationProtocolVersion: string; /** * The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */ defaultGcmNotificationProtocolVersion: string; /** * The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. */ defaultFcmNotificationProtocolVersion: string; /** * Whether to log notifications. Can be: `true` or `false` and the default is `true`. */ logEnabled: boolean; /** * The absolute URL of the Service resource. */ url: string; /** * The URLs of the Binding, Notification, Segment, and User resources related to the service. */ links: Record<string, string>; /** * Deprecated. */ alexaSkillId: string; /** * Deprecated. */ defaultAlexaNotificationProtocolVersion: string; /** * URL to send delivery status callback. */ deliveryCallbackUrl: string; /** * Callback configuration that enables delivery callbacks, default false */ deliveryCallbackEnabled: boolean; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Access the bindings. */ bindings(): BindingListInstance; /** * Access the notifications. */ notifications(): NotificationListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; dateCreated: Date; dateUpdated: Date; apnCredentialSid: string; gcmCredentialSid: string; fcmCredentialSid: string; messagingServiceSid: string; facebookMessengerPageId: string; defaultApnNotificationProtocolVersion: string; defaultGcmNotificationProtocolVersion: string; defaultFcmNotificationProtocolVersion: string; logEnabled: boolean; url: string; links: Record<string, string>; alexaSkillId: string; defaultAlexaNotificationProtocolVersion: string; deliveryCallbackUrl: string; deliveryCallbackEnabled: boolean; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V1; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V1): ServiceListInstance; export declare class ServicePage extends Page<V1, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/notify/v1/service.js000064400000036534151677225100011376 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Notify * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const binding_1 = require("./service/binding"); const notification_1 = require("./service/notification"); class ServiceContextImpl { 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 = `/Services/${sid}`; } get bindings() { this._bindings = this._bindings || (0, binding_1.BindingListInstance)(this._version, this._solution.sid); return this._bindings; } get notifications() { this._notifications = this._notifications || (0, notification_1.NotificationListInstance)(this._version, this._solution.sid); return this._notifications; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["apnCredentialSid"] !== undefined) data["ApnCredentialSid"] = params["apnCredentialSid"]; if (params["gcmCredentialSid"] !== undefined) data["GcmCredentialSid"] = params["gcmCredentialSid"]; if (params["messagingServiceSid"] !== undefined) data["MessagingServiceSid"] = params["messagingServiceSid"]; if (params["facebookMessengerPageId"] !== undefined) data["FacebookMessengerPageId"] = params["facebookMessengerPageId"]; if (params["defaultApnNotificationProtocolVersion"] !== undefined) data["DefaultApnNotificationProtocolVersion"] = params["defaultApnNotificationProtocolVersion"]; if (params["defaultGcmNotificationProtocolVersion"] !== undefined) data["DefaultGcmNotificationProtocolVersion"] = params["defaultGcmNotificationProtocolVersion"]; if (params["fcmCredentialSid"] !== undefined) data["FcmCredentialSid"] = params["fcmCredentialSid"]; if (params["defaultFcmNotificationProtocolVersion"] !== undefined) data["DefaultFcmNotificationProtocolVersion"] = params["defaultFcmNotificationProtocolVersion"]; if (params["logEnabled"] !== undefined) data["LogEnabled"] = serialize.bool(params["logEnabled"]); if (params["alexaSkillId"] !== undefined) data["AlexaSkillId"] = params["alexaSkillId"]; if (params["defaultAlexaNotificationProtocolVersion"] !== undefined) data["DefaultAlexaNotificationProtocolVersion"] = params["defaultAlexaNotificationProtocolVersion"]; if (params["deliveryCallbackUrl"] !== undefined) data["DeliveryCallbackUrl"] = params["deliveryCallbackUrl"]; if (params["deliveryCallbackEnabled"] !== undefined) data["DeliveryCallbackEnabled"] = serialize.bool(params["deliveryCallbackEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { 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.apnCredentialSid = payload.apn_credential_sid; this.gcmCredentialSid = payload.gcm_credential_sid; this.fcmCredentialSid = payload.fcm_credential_sid; this.messagingServiceSid = payload.messaging_service_sid; this.facebookMessengerPageId = payload.facebook_messenger_page_id; this.defaultApnNotificationProtocolVersion = payload.default_apn_notification_protocol_version; this.defaultGcmNotificationProtocolVersion = payload.default_gcm_notification_protocol_version; this.defaultFcmNotificationProtocolVersion = payload.default_fcm_notification_protocol_version; this.logEnabled = payload.log_enabled; this.url = payload.url; this.links = payload.links; this.alexaSkillId = payload.alexa_skill_id; this.defaultAlexaNotificationProtocolVersion = payload.default_alexa_notification_protocol_version; this.deliveryCallbackUrl = payload.delivery_callback_url; this.deliveryCallbackEnabled = payload.delivery_callback_enabled; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the bindings. */ bindings() { return this._proxy.bindings; } /** * Access the notifications. */ notifications() { return this._proxy.notifications; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, apnCredentialSid: this.apnCredentialSid, gcmCredentialSid: this.gcmCredentialSid, fcmCredentialSid: this.fcmCredentialSid, messagingServiceSid: this.messagingServiceSid, facebookMessengerPageId: this.facebookMessengerPageId, defaultApnNotificationProtocolVersion: this.defaultApnNotificationProtocolVersion, defaultGcmNotificationProtocolVersion: this.defaultGcmNotificationProtocolVersion, defaultFcmNotificationProtocolVersion: this.defaultFcmNotificationProtocolVersion, logEnabled: this.logEnabled, url: this.url, links: this.links, alexaSkillId: this.alexaSkillId, defaultAlexaNotificationProtocolVersion: this.defaultAlexaNotificationProtocolVersion, deliveryCallbackUrl: this.deliveryCallbackUrl, deliveryCallbackEnabled: this.deliveryCallbackEnabled, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["apnCredentialSid"] !== undefined) data["ApnCredentialSid"] = params["apnCredentialSid"]; if (params["gcmCredentialSid"] !== undefined) data["GcmCredentialSid"] = params["gcmCredentialSid"]; if (params["messagingServiceSid"] !== undefined) data["MessagingServiceSid"] = params["messagingServiceSid"]; if (params["facebookMessengerPageId"] !== undefined) data["FacebookMessengerPageId"] = params["facebookMessengerPageId"]; if (params["defaultApnNotificationProtocolVersion"] !== undefined) data["DefaultApnNotificationProtocolVersion"] = params["defaultApnNotificationProtocolVersion"]; if (params["defaultGcmNotificationProtocolVersion"] !== undefined) data["DefaultGcmNotificationProtocolVersion"] = params["defaultGcmNotificationProtocolVersion"]; if (params["fcmCredentialSid"] !== undefined) data["FcmCredentialSid"] = params["fcmCredentialSid"]; if (params["defaultFcmNotificationProtocolVersion"] !== undefined) data["DefaultFcmNotificationProtocolVersion"] = params["defaultFcmNotificationProtocolVersion"]; if (params["logEnabled"] !== undefined) data["LogEnabled"] = serialize.bool(params["logEnabled"]); if (params["alexaSkillId"] !== undefined) data["AlexaSkillId"] = params["alexaSkillId"]; if (params["defaultAlexaNotificationProtocolVersion"] !== undefined) data["DefaultAlexaNotificationProtocolVersion"] = params["defaultAlexaNotificationProtocolVersion"]; if (params["deliveryCallbackUrl"] !== undefined) data["DeliveryCallbackUrl"] = params["deliveryCallbackUrl"]; if (params["deliveryCallbackEnabled"] !== undefined) data["DeliveryCallbackEnabled"] = serialize.bool(params["deliveryCallbackEnabled"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/notify/v1/credential.d.ts000064400000032561151677225100012300 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type CredentialPushService = "gcm" | "apn" | "fcm"; /** * Options to pass to update a CredentialInstance */ export interface CredentialContextUpdateOptions { /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` */ certificate?: string; /** [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\\\\n.-----END RSA PRIVATE KEY-----` */ privateKey?: string; /** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox?: boolean; /** [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. */ apiKey?: string; /** [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. */ secret?: string; } /** * Options to pass to create a CredentialInstance */ export interface CredentialListInstanceCreateOptions { /** */ type: CredentialPushService; /** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */ friendlyName?: string; /** [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` */ certificate?: string; /** [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\\\\n.-----END RSA PRIVATE KEY-----` */ privateKey?: string; /** [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox?: boolean; /** [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. */ apiKey?: string; /** [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. */ secret?: string; } /** * Options to pass to each */ export interface CredentialListInstanceEachOptions { /** 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: CredentialInstance, 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 CredentialListInstanceOptions { /** 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 CredentialListInstancePageOptions { /** 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 CredentialContext { /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CredentialContextSolution { sid: string; } export declare class CredentialContextImpl implements CredentialContext { protected _version: V1; protected _solution: CredentialContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; update(params?: CredentialContextUpdateOptions | ((error: Error | null, item?: CredentialInstance) => any), callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CredentialContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CredentialPayload extends TwilioResponsePayload { credentials: CredentialResource[]; } interface CredentialResource { sid: string; account_sid: string; friendly_name: string; type: CredentialPushService; sandbox: string; date_created: Date; date_updated: Date; url: string; } export declare class CredentialInstance { protected _version: V1; protected _solution: CredentialContextSolution; protected _context?: CredentialContext; constructor(_version: V1, payload: CredentialResource, sid?: string); /** * The unique string that we created to identify the Credential resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; type: CredentialPushService; /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. */ sandbox: 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 absolute URL of the Credential resource. */ url: string; private get _proxy(); /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Update a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ update(params: CredentialContextUpdateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; type: CredentialPushService; sandbox: string; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CredentialSolution { } export interface CredentialListInstance { _version: V1; _solution: CredentialSolution; _uri: string; (sid: string): CredentialContext; get(sid: string): CredentialContext; /** * Create a CredentialInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ create(params: CredentialListInstanceCreateOptions, callback?: (error: Error | null, item?: CredentialInstance) => any): Promise<CredentialInstance>; /** * Streams CredentialInstance 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 { CredentialListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; each(params: CredentialListInstanceEachOptions, callback?: (item: CredentialInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CredentialInstance 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: CredentialPage) => any): Promise<CredentialPage>; /** * Lists CredentialInstance 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 { CredentialListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; list(params: CredentialListInstanceOptions, callback?: (error: Error | null, items: CredentialInstance[]) => any): Promise<CredentialInstance[]>; /** * Retrieve a single page of CredentialInstance 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 { CredentialListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; page(params: CredentialListInstancePageOptions, callback?: (error: Error | null, items: CredentialPage) => any): Promise<CredentialPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CredentialListInstance(version: V1): CredentialListInstance; export declare class CredentialPage extends Page<V1, CredentialPayload, CredentialResource, CredentialInstance> { /** * Initialize the CredentialPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CredentialSolution); /** * Build an instance of CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload: CredentialResource): CredentialInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/notify/v1/credential.js000064400000024174151677225100012045 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Notify * 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.CredentialPage = exports.CredentialListInstance = exports.CredentialInstance = exports.CredentialContextImpl = void 0; 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 CredentialContextImpl { 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/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload, 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.CredentialContextImpl = CredentialContextImpl; class CredentialInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.sandbox = payload.sandbox; 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 CredentialContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CredentialInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CredentialInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, type: this.type, sandbox: this.sandbox, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialInstance = CredentialInstance; function CredentialListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CredentialContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Credentials`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["Type"] = params["type"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["certificate"] !== undefined) data["Certificate"] = params["certificate"]; if (params["privateKey"] !== undefined) data["PrivateKey"] = params["privateKey"]; if (params["sandbox"] !== undefined) data["Sandbox"] = serialize.bool(params["sandbox"]); if (params["apiKey"] !== undefined) data["ApiKey"] = params["apiKey"]; if (params["secret"] !== undefined) data["Secret"] = params["secret"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CredentialPage(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 CredentialPage(instance._version, payload, 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; } exports.CredentialListInstance = CredentialListInstance; class CredentialPage extends Page_1.default { /** * Initialize the CredentialPage * * @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 CredentialInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CredentialInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CredentialPage = CredentialPage; rest/notify/v1/service/binding.d.ts000064400000035761151677225100013245 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type BindingBindingType = "apn" | "gcm" | "sms" | "fcm" | "facebook-messenger" | "alexa"; /** * Options to pass to create a BindingInstance */ export interface BindingListInstanceCreateOptions { /** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service. */ identity: string; /** */ bindingType: BindingBindingType; /** The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format. */ address: string; /** A tag that can be used to select the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 20 tags. */ tag?: Array<string>; /** The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` for the protocol in the [Service](https://www.twilio.com/docs/notify/api/service-resource). The current version is `\\\"3\\\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. */ notificationProtocolVersion?: string; /** The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applies to only `apn`, `fcm`, and `gcm` type Bindings. */ credentialSid?: string; /** Deprecated. */ endpoint?: string; } /** * Options to pass to each */ export interface BindingListInstanceEachOptions { /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. */ endDate?: Date; /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. */ identity?: Array<string>; /** Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed. */ tag?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: BindingInstance, 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 BindingListInstanceOptions { /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. */ endDate?: Date; /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. */ identity?: Array<string>; /** Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed. */ tag?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface BindingListInstancePageOptions { /** Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. */ startDate?: Date; /** Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. */ endDate?: Date; /** The [User](https://www.twilio.com/docs/chat/rest/user-resource)\'s `identity` value of the resources to read. */ identity?: Array<string>; /** Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed. */ tag?: Array<string>; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface BindingContext { /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface BindingContextSolution { serviceSid: string; sid: string; } export declare class BindingContextImpl implements BindingContext { protected _version: V1; protected _solution: BindingContextSolution; protected _uri: string; constructor(_version: V1, serviceSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): BindingContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface BindingPayload extends TwilioResponsePayload { bindings: BindingResource[]; } interface BindingResource { sid: string; account_sid: string; service_sid: string; credential_sid: string; date_created: Date; date_updated: Date; notification_protocol_version: string; endpoint: string; identity: string; binding_type: string; address: string; tags: Array<string>; url: string; links: Record<string, string>; } export declare class BindingInstance { protected _version: V1; protected _solution: BindingContextSolution; protected _context?: BindingContext; constructor(_version: V1, payload: BindingResource, serviceSid: string, sid?: string); /** * The unique string that we created to identify the Binding resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. */ serviceSid: string; /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applicable only to `apn`, `fcm`, and `gcm` type Bindings. */ credentialSid: 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 protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` in the [Service](https://www.twilio.com/docs/notify/api/service-resource) for the protocol. The current version is `\"3\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. */ notificationProtocolVersion: string; /** * Deprecated. */ endpoint: string; /** * The `identity` value that uniquely identifies the resource\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service. */ identity: string; /** * The transport technology to use for the Binding. Can be: `apn`, `fcm`, `gcm`, `sms`, or `facebook-messenger`. */ bindingType: string; /** * The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format. */ address: string; /** * The list of tags associated with this Binding. Tags can be used to select the Bindings to use when sending a notification. Maximum 20 tags are allowed. */ tags: Array<string>; /** * The absolute URL of the Binding resource. */ url: string; /** * The URLs of related resources. */ links: Record<string, string>; private get _proxy(); /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; credentialSid: string; dateCreated: Date; dateUpdated: Date; notificationProtocolVersion: string; endpoint: string; identity: string; bindingType: string; address: string; tags: string[]; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface BindingSolution { serviceSid: string; } export interface BindingListInstance { _version: V1; _solution: BindingSolution; _uri: string; (sid: string): BindingContext; get(sid: string): BindingContext; /** * Create a BindingInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ create(params: BindingListInstanceCreateOptions, callback?: (error: Error | null, item?: BindingInstance) => any): Promise<BindingInstance>; /** * Streams BindingInstance 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 { BindingListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void; each(params: BindingListInstanceEachOptions, callback?: (item: BindingInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of BindingInstance 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: BindingPage) => any): Promise<BindingPage>; /** * Lists BindingInstance 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 { BindingListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>; list(params: BindingListInstanceOptions, callback?: (error: Error | null, items: BindingInstance[]) => any): Promise<BindingInstance[]>; /** * Retrieve a single page of BindingInstance 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 { BindingListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>; page(params: BindingListInstancePageOptions, callback?: (error: Error | null, items: BindingPage) => any): Promise<BindingPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function BindingListInstance(version: V1, serviceSid: string): BindingListInstance; export declare class BindingPage extends Page<V1, BindingPayload, BindingResource, BindingInstance> { /** * Initialize the BindingPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: BindingSolution); /** * Build an instance of BindingInstance * * @param payload - Payload response from the API */ getInstance(payload: BindingResource): BindingInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/notify/v1/service/binding.js000064400000024631151677225100013003 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Notify * 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.BindingPage = exports.BindingListInstance = exports.BindingInstance = exports.BindingContextImpl = void 0; 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 BindingContextImpl { constructor(_version, serviceSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { serviceSid, sid }; this._uri = `/Services/${serviceSid}/Bindings/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new BindingInstance(operationVersion, payload, instance._solution.serviceSid, 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.BindingContextImpl = BindingContextImpl; class BindingInstance { constructor(_version, payload, serviceSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.credentialSid = payload.credential_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.notificationProtocolVersion = payload.notification_protocol_version; this.endpoint = payload.endpoint; this.identity = payload.identity; this.bindingType = payload.binding_type; this.address = payload.address; this.tags = payload.tags; this.url = payload.url; this.links = payload.links; this._solution = { serviceSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new BindingContextImpl(this._version, this._solution.serviceSid, this._solution.sid); return this._context; } /** * Remove a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a BindingInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed BindingInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, credentialSid: this.credentialSid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, notificationProtocolVersion: this.notificationProtocolVersion, endpoint: this.endpoint, identity: this.identity, bindingType: this.bindingType, address: this.address, tags: this.tags, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BindingInstance = BindingInstance; function BindingListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new BindingContextImpl(version, serviceSid, sid); }; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Bindings`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["identity"] === null || params["identity"] === undefined) { throw new Error("Required parameter \"params['identity']\" missing."); } if (params["bindingType"] === null || params["bindingType"] === undefined) { throw new Error("Required parameter \"params['bindingType']\" missing."); } if (params["address"] === null || params["address"] === undefined) { throw new Error("Required parameter \"params['address']\" missing."); } let data = {}; data["Identity"] = params["identity"]; data["BindingType"] = params["bindingType"]; data["Address"] = params["address"]; if (params["tag"] !== undefined) data["Tag"] = serialize.map(params["tag"], (e) => e); if (params["notificationProtocolVersion"] !== undefined) data["NotificationProtocolVersion"] = params["notificationProtocolVersion"]; if (params["credentialSid"] !== undefined) data["CredentialSid"] = params["credentialSid"]; if (params["endpoint"] !== undefined) data["Endpoint"] = params["endpoint"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new BindingInstance(operationVersion, payload, instance._solution.serviceSid)); 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["startDate"] !== undefined) data["StartDate"] = serialize.iso8601Date(params["startDate"]); if (params["endDate"] !== undefined) data["EndDate"] = serialize.iso8601Date(params["endDate"]); if (params["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); if (params["tag"] !== undefined) data["Tag"] = serialize.map(params["tag"], (e) => e); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new BindingPage(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 BindingPage(instance._version, payload, 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; } exports.BindingListInstance = BindingListInstance; class BindingPage extends Page_1.default { /** * Initialize the BindingPage * * @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 BindingInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new BindingInstance(this._version, payload, this._solution.serviceSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.BindingPage = BindingPage; rest/notify/v1/service/notification.js000064400000013774151677225100014065 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Notify * 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.NotificationInstance = exports.NotificationListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function NotificationListInstance(version, serviceSid) { if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { serviceSid }; instance._uri = `/Services/${serviceSid}/Notifications`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["body"] !== undefined) data["Body"] = params["body"]; if (params["priority"] !== undefined) data["Priority"] = params["priority"]; if (params["ttl"] !== undefined) data["Ttl"] = params["ttl"]; if (params["title"] !== undefined) data["Title"] = params["title"]; if (params["sound"] !== undefined) data["Sound"] = params["sound"]; if (params["action"] !== undefined) data["Action"] = params["action"]; if (params["data"] !== undefined) data["Data"] = serialize.object(params["data"]); if (params["apn"] !== undefined) data["Apn"] = serialize.object(params["apn"]); if (params["gcm"] !== undefined) data["Gcm"] = serialize.object(params["gcm"]); if (params["sms"] !== undefined) data["Sms"] = serialize.object(params["sms"]); if (params["facebookMessenger"] !== undefined) data["FacebookMessenger"] = serialize.object(params["facebookMessenger"]); if (params["fcm"] !== undefined) data["Fcm"] = serialize.object(params["fcm"]); if (params["segment"] !== undefined) data["Segment"] = serialize.map(params["segment"], (e) => e); if (params["alexa"] !== undefined) data["Alexa"] = serialize.object(params["alexa"]); if (params["toBinding"] !== undefined) data["ToBinding"] = serialize.map(params["toBinding"], (e) => e); if (params["deliveryCallbackUrl"] !== undefined) data["DeliveryCallbackUrl"] = params["deliveryCallbackUrl"]; if (params["identity"] !== undefined) data["Identity"] = serialize.map(params["identity"], (e) => e); if (params["tag"] !== undefined) data["Tag"] = serialize.map(params["tag"], (e) => e); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new NotificationInstance(operationVersion, payload, instance._solution.serviceSid)); 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; } exports.NotificationListInstance = NotificationListInstance; class NotificationInstance { constructor(_version, payload, serviceSid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.identities = payload.identities; this.tags = payload.tags; this.segments = payload.segments; this.priority = payload.priority; this.ttl = deserialize.integer(payload.ttl); this.title = payload.title; this.body = payload.body; this.sound = payload.sound; this.action = payload.action; this.data = payload.data; this.apn = payload.apn; this.gcm = payload.gcm; this.fcm = payload.fcm; this.sms = payload.sms; this.facebookMessenger = payload.facebook_messenger; this.alexa = payload.alexa; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, serviceSid: this.serviceSid, dateCreated: this.dateCreated, identities: this.identities, tags: this.tags, segments: this.segments, priority: this.priority, ttl: this.ttl, title: this.title, body: this.body, sound: this.sound, action: this.action, data: this.data, apn: this.apn, gcm: this.gcm, fcm: this.fcm, sms: this.sms, facebookMessenger: this.facebookMessenger, alexa: this.alexa, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.NotificationInstance = NotificationInstance; rest/notify/v1/service/notification.d.ts000064400000034405151677225100014313 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export type NotificationPriority = "high" | "low"; /** * Options to pass to create a NotificationInstance */ export interface NotificationListInstanceCreateOptions { /** The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. */ body?: string; /** */ priority?: NotificationPriority; /** How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. */ ttl?: number; /** The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. */ title?: string; /** The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. */ sound?: string; /** The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. */ action?: string; /** The custom key-value pairs of the notification\\\'s payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. */ data?: any; /** The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. */ apn?: any; /** The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. See the [GCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref) for more details. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. GCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref). */ gcm?: any; /** The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/quickstart) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. */ sms?: any; /** Deprecated. */ facebookMessenger?: any; /** The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. */ fcm?: any; /** The Segment resource is deprecated. Use the `tag` parameter, instead. */ segment?: Array<string>; /** Deprecated. */ alexa?: any; /** The destination address specified as a JSON string. Multiple `to_binding` parameters can be included but the total size of the request entity should not exceed 1MB. This is typically sufficient for 10,000 phone numbers. */ toBinding?: Array<string>; /** URL to send webhooks. */ deliveryCallbackUrl?: string; /** The `identity` value that uniquely identifies the new resource\\\'s [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Delivery will be attempted only to Bindings with an Identity in this list. No more than 20 items are allowed in this list. */ identity?: Array<string>; /** A tag that selects the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 5 tags. The implicit tag `all` is available to notify all Bindings in a Service instance. Similarly, the implicit tags `apn`, `fcm`, `gcm`, `sms` and `facebook-messenger` are available to notify all Bindings in a specific channel. */ tag?: Array<string>; } export interface NotificationSolution { serviceSid: string; } export interface NotificationListInstance { _version: V1; _solution: NotificationSolution; _uri: string; /** * Create a NotificationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ create(callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Create a NotificationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed NotificationInstance */ create(params: NotificationListInstanceCreateOptions, callback?: (error: Error | null, item?: NotificationInstance) => any): Promise<NotificationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function NotificationListInstance(version: V1, serviceSid: string): NotificationListInstance; interface NotificationResource { sid: string; account_sid: string; service_sid: string; date_created: Date; identities: Array<string>; tags: Array<string>; segments: Array<string>; priority: NotificationPriority; ttl: number; title: string; body: string; sound: string; action: string; data: any; apn: any; gcm: any; fcm: any; sms: any; facebook_messenger: any; alexa: any; } export declare class NotificationInstance { protected _version: V1; constructor(_version: V1, payload: NotificationResource, serviceSid: string); /** * The unique string that we created to identify the Notification resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. */ accountSid: string; /** * The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. */ serviceSid: 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 list of `identity` values of the Users to notify. We will attempt to deliver notifications only to Bindings with an identity in this list. */ identities: Array<string>; /** * The tags that select the Bindings to notify. Notifications will be attempted only to Bindings that have all of the tags listed in this property. */ tags: Array<string>; /** * The list of Segments to notify. The [Segment](https://www.twilio.com/docs/notify/api/segment-resource) resource is deprecated. Use the `tags` property, instead. */ segments: Array<string>; priority: NotificationPriority; /** * How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. */ ttl: number; /** * The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. */ title: string; /** * The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. */ body: string; /** * The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. */ sound: string; /** * The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. */ action: string; /** * The custom key-value pairs of the notification\'s payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. */ data: any; /** * The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. */ apn: any; /** * The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. */ gcm: any; /** * The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. */ fcm: any; /** * The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. */ sms: any; /** * Deprecated. */ facebookMessenger: any; /** * Deprecated. */ alexa: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; serviceSid: string; dateCreated: Date; identities: string[]; tags: string[]; segments: string[]; priority: NotificationPriority; ttl: number; title: string; body: string; sound: string; action: string; data: any; apn: any; gcm: any; fcm: any; sms: any; facebookMessenger: any; alexa: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/notify/V1.js000064400000002733151677225100007670 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Notify * 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 credential_1 = require("./v1/credential"); const service_1 = require("./v1/service"); class V1 extends Version_1.default { /** * Initialize the V1 version of Notify * * @param domain - The Twilio (Twilio.Notify) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for credentials resource */ get credentials() { this._credentials = this._credentials || (0, credential_1.CredentialListInstance)(this); return this._credentials; } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } } exports.default = V1; rest/FlexApiBase.js000064400000002302151677225100010205 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./flexApi/V1")); const V2_1 = __importDefault(require("./flexApi/V2")); class FlexApiBase extends Domain_1.default { /** * Initialize flexApi domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://flex-api.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = FlexApiBase; rest/MarketplaceBase.js000064400000002071151677225100011110 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./marketplace/V1")); class MarketplaceBase extends Domain_1.default { /** * Initialize marketplace domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://marketplace.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = MarketplaceBase; rest/Trusthub.js000064400000003525151677225100007712 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const TrusthubBase_1 = __importDefault(require("./TrusthubBase")); class Trusthub extends TrusthubBase_1.default { /** * @deprecated - Use v1.customerProfiles instead */ get customerProfiles() { console.warn("customerProfiles is deprecated. Use v1.customerProfiles instead."); return this.v1.customerProfiles; } /** * @deprecated - Use v1.endUsers instead */ get endUsers() { console.warn("endUsers is deprecated. Use v1.endUsers instead."); return this.v1.endUsers; } /** * @deprecated - Use v1.endUserTypes instead */ get endUserTypes() { console.warn("endUserTypes is deprecated. Use v1.endUserTypes instead."); return this.v1.endUserTypes; } /** * @deprecated - Use v1.policies instead */ get policies() { console.warn("policies is deprecated. Use v1.policies instead."); return this.v1.policies; } /** * @deprecated - Use v1.supportingDocuments instead */ get supportingDocuments() { console.warn("supportingDocuments is deprecated. Use v1.supportingDocuments instead."); return this.v1.supportingDocuments; } /** * @deprecated - Use v1.supportingDocumentTypes instead */ get supportingDocumentTypes() { console.warn("supportingDocumentTypes is deprecated. Use v1.supportingDocumentTypes instead."); return this.v1.supportingDocumentTypes; } /** * @deprecated - Use v1.trustProducts instead */ get trustProducts() { console.warn("trustProducts is deprecated. Use v1.trustProducts instead."); return this.v1.trustProducts; } } module.exports = Trusthub; rest/Microvisor.d.ts000064400000000651151677225100010457 0ustar00import { AppListInstance } from "./microvisor/v1/app"; import { DeviceListInstance } from "./microvisor/v1/device"; import MicrovisorBase from "./MicrovisorBase"; declare class Microvisor extends MicrovisorBase { /** * @deprecated - Use v1.apps instead */ get apps(): AppListInstance; /** * @deprecated - Use v1.devices instead */ get devices(): DeviceListInstance; } export = Microvisor; rest/Taskrouter.d.ts000064400000000447151677225100010471 0ustar00import { WorkspaceListInstance } from "./taskrouter/v1/workspace"; import TaskrouterBase from "./TaskrouterBase"; declare class Taskrouter extends TaskrouterBase { /** * @deprecated - Use v1.workspaces instead */ get workspaces(): WorkspaceListInstance; } export = Taskrouter; rest/Insights.d.ts000064400000001652151677225100010115 0ustar00import { CallListInstance } from "./insights/v1/call"; import { CallSummariesListInstance } from "./insights/v1/callSummaries"; import { ConferenceListInstance } from "./insights/v1/conference"; import { RoomListInstance } from "./insights/v1/room"; import { SettingListInstance } from "./insights/v1/setting"; import InsightsBase from "./InsightsBase"; declare class Insights extends InsightsBase { /** * @deprecated - Use v1.settings instead */ get settings(): SettingListInstance; /** * @deprecated - Use v1.calls instead */ get calls(): CallListInstance; /** * @deprecated - Use v1.callSummaries instead */ get callSummaries(): CallSummariesListInstance; /** * @deprecated - Use v1.conferences instead */ get conferences(): ConferenceListInstance; /** * @deprecated - Use v1.rooms instead */ get rooms(): RoomListInstance; } export = Insights; rest/IntelligenceBase.js000064400000002076151677225100011267 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V2_1 = __importDefault(require("./intelligence/V2")); class IntelligenceBase extends Domain_1.default { /** * Initialize intelligence domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://intelligence.twilio.com"); } get v2() { this._v2 = this._v2 || new V2_1.default(this); return this._v2; } } module.exports = IntelligenceBase; rest/Verify.d.ts000064400000002035151677225100007565 0ustar00import { FormListInstance } from "./verify/v2/form"; import { ServiceListInstance } from "./verify/v2/service"; import { TemplateListInstance } from "./verify/v2/template"; import { VerificationAttemptListInstance } from "./verify/v2/verificationAttempt"; import { VerificationAttemptsSummaryListInstance } from "./verify/v2/verificationAttemptsSummary"; import VerifyBase from "./VerifyBase"; declare class Verify extends VerifyBase { /** * @deprecated - Use v2.forms instead */ get forms(): FormListInstance; /** * @deprecated - Use v2.services instead */ get services(): ServiceListInstance; /** * @deprecated - Use v2.verificationAttempts instead */ get verificationAttempts(): VerificationAttemptListInstance; /** * @deprecated - Use v2.verificationAttemptsSummary instead */ get verificationAttemptsSummary(): VerificationAttemptsSummaryListInstance; /** * @deprecated - Use v2.templates instead */ get templates(): TemplateListInstance; } export = Verify; rest/Messaging.js000064400000003431151677225100010003 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const MessagingBase_1 = __importDefault(require("./MessagingBase")); class Messaging extends MessagingBase_1.default { /** * @deprecated - Use v1.brandRegistrations instead */ get brandRegistrations() { console.warn("brandRegistrations is deprecated. Use v1.brandRegistrations instead."); return this.v1.brandRegistrations; } /** * @deprecated - Use v1.deactivations instead */ get deactivations() { console.warn("deactivations is deprecated. Use v1.deactivations instead."); return this.v1.deactivations; } /** * @deprecated - Use v1.domainCerts instead */ get domainCerts() { console.warn("domainCerts is deprecated. Use v1.domainCerts instead."); return this.v1.domainCerts; } /** * @deprecated - Use v1.domainConfig instead */ get domainConfig() { console.warn("domainConfig is deprecated. Use v1.domainConfig instead."); return this.v1.domainConfig; } /** * @deprecated - Use v1.externalCampaign instead */ get externalCampaign() { console.warn("externalCampaign is deprecated. Use v1.externalCampaign instead."); return this.v1.externalCampaign; } /** * @deprecated - Use v1.services instead */ get services() { console.warn("services is deprecated. Use v1.services instead."); return this.v1.services; } /** * @deprecated - Use v1.usecases instead */ get usecases() { console.warn("usecases is deprecated. Use v1.usecases instead."); return this.v1.usecases; } } module.exports = Messaging; rest/Sync.js000064400000000730151677225100007001 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const SyncBase_1 = __importDefault(require("./SyncBase")); class Sync extends SyncBase_1.default { /** * @deprecated - Use v1.services instead */ get services() { console.warn("services is deprecated. Use v1.services instead."); return this.v1.services; } } module.exports = Sync; rest/SupersimBase.d.ts000064400000000452151677225100010724 0ustar00import Domain from "../base/Domain"; import V1 from "./supersim/V1"; declare class SupersimBase extends Domain { _v1?: V1; /** * Initialize supersim domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = SupersimBase; rest/Conversations.js000064400000004016151677225100010723 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const ConversationsBase_1 = __importDefault(require("./ConversationsBase")); class Conversations extends ConversationsBase_1.default { /** * @deprecated - Use v1.configuration instead */ get configuration() { console.warn("configuration is deprecated. Use v1.configuration instead."); return this.v1.configuration; } /** * @deprecated - Use v1.addressConfigurations instead */ get addressConfigurations() { console.warn("addressConfigurations is deprecated. Use v1.addressConfigurations instead."); return this.v1.addressConfigurations; } /** * @deprecated - Use v1.conversations instead */ get conversations() { console.warn("conversations is deprecated. Use v1.conversations instead."); return this.v1.conversations; } /** * @deprecated - Use v1.credentials instead */ get credentials() { console.warn("credentials is deprecated. Use v1.credentials instead."); return this.v1.credentials; } /** * @deprecated - Use v1.participantConversations instead */ get participantConversations() { console.warn("participantConversations is deprecated. Use v1.participantConversations instead."); return this.v1.participantConversations; } /** * @deprecated - Use v1.roles instead */ get roles() { console.warn("roles is deprecated. Use v1.roles instead."); return this.v1.roles; } /** * @deprecated - Use v1.services instead */ get services() { console.warn("services is deprecated. Use v1.services instead."); return this.v1.services; } /** * @deprecated - Use v1.users instead */ get users() { console.warn("users is deprecated. Use v1.users instead."); return this.v1.users; } } module.exports = Conversations; rest/trusthub/V1.d.ts000064400000007222151677225100010472 0ustar00import TrusthubBase from "../TrusthubBase"; import Version from "../../base/Version"; import { ComplianceInquiriesListInstance } from "./v1/complianceInquiries"; import { ComplianceRegistrationInquiriesListInstance } from "./v1/complianceRegistrationInquiries"; import { ComplianceTollfreeInquiriesListInstance } from "./v1/complianceTollfreeInquiries"; import { CustomerProfilesListInstance } from "./v1/customerProfiles"; import { EndUserListInstance } from "./v1/endUser"; import { EndUserTypeListInstance } from "./v1/endUserType"; import { PoliciesListInstance } from "./v1/policies"; import { SupportingDocumentListInstance } from "./v1/supportingDocument"; import { SupportingDocumentTypeListInstance } from "./v1/supportingDocumentType"; import { TrustProductsListInstance } from "./v1/trustProducts"; export default class V1 extends Version { /** * Initialize the V1 version of Trusthub * * @param domain - The Twilio (Twilio.Trusthub) domain */ constructor(domain: TrusthubBase); /** complianceInquiries - { Twilio.Trusthub.V1.ComplianceInquiriesListInstance } resource */ protected _complianceInquiries?: ComplianceInquiriesListInstance; /** complianceRegistrationInquiries - { Twilio.Trusthub.V1.ComplianceRegistrationInquiriesListInstance } resource */ protected _complianceRegistrationInquiries?: ComplianceRegistrationInquiriesListInstance; /** complianceTollfreeInquiries - { Twilio.Trusthub.V1.ComplianceTollfreeInquiriesListInstance } resource */ protected _complianceTollfreeInquiries?: ComplianceTollfreeInquiriesListInstance; /** customerProfiles - { Twilio.Trusthub.V1.CustomerProfilesListInstance } resource */ protected _customerProfiles?: CustomerProfilesListInstance; /** endUsers - { Twilio.Trusthub.V1.EndUserListInstance } resource */ protected _endUsers?: EndUserListInstance; /** endUserTypes - { Twilio.Trusthub.V1.EndUserTypeListInstance } resource */ protected _endUserTypes?: EndUserTypeListInstance; /** policies - { Twilio.Trusthub.V1.PoliciesListInstance } resource */ protected _policies?: PoliciesListInstance; /** supportingDocuments - { Twilio.Trusthub.V1.SupportingDocumentListInstance } resource */ protected _supportingDocuments?: SupportingDocumentListInstance; /** supportingDocumentTypes - { Twilio.Trusthub.V1.SupportingDocumentTypeListInstance } resource */ protected _supportingDocumentTypes?: SupportingDocumentTypeListInstance; /** trustProducts - { Twilio.Trusthub.V1.TrustProductsListInstance } resource */ protected _trustProducts?: TrustProductsListInstance; /** Getter for complianceInquiries resource */ get complianceInquiries(): ComplianceInquiriesListInstance; /** Getter for complianceRegistrationInquiries resource */ get complianceRegistrationInquiries(): ComplianceRegistrationInquiriesListInstance; /** Getter for complianceTollfreeInquiries resource */ get complianceTollfreeInquiries(): ComplianceTollfreeInquiriesListInstance; /** Getter for customerProfiles resource */ get customerProfiles(): CustomerProfilesListInstance; /** Getter for endUsers resource */ get endUsers(): EndUserListInstance; /** Getter for endUserTypes resource */ get endUserTypes(): EndUserTypeListInstance; /** Getter for policies resource */ get policies(): PoliciesListInstance; /** Getter for supportingDocuments resource */ get supportingDocuments(): SupportingDocumentListInstance; /** Getter for supportingDocumentTypes resource */ get supportingDocumentTypes(): SupportingDocumentTypeListInstance; /** Getter for trustProducts resource */ get trustProducts(): TrustProductsListInstance; } rest/trusthub/v1/policies.js000064400000014140151677225100012102 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.PoliciesPage = exports.PoliciesListInstance = exports.PoliciesInstance = exports.PoliciesContextImpl = void 0; 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 PoliciesContextImpl { 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 = `/Policies/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PoliciesInstance(operationVersion, payload, 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.PoliciesContextImpl = PoliciesContextImpl; class PoliciesInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.requirements = payload.requirements; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new PoliciesContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a PoliciesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PoliciesInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, requirements: this.requirements, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PoliciesInstance = PoliciesInstance; function PoliciesListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PoliciesContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Policies`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PoliciesPage(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 PoliciesPage(instance._version, payload, 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; } exports.PoliciesListInstance = PoliciesListInstance; class PoliciesPage extends Page_1.default { /** * Initialize the PoliciesPage * * @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 PoliciesInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PoliciesInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PoliciesPage = PoliciesPage; rest/trusthub/v1/customerProfiles.js000064400000031325151677225100013644 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.CustomerProfilesPage = exports.CustomerProfilesListInstance = exports.CustomerProfilesInstance = exports.CustomerProfilesContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const customerProfilesChannelEndpointAssignment_1 = require("./customerProfiles/customerProfilesChannelEndpointAssignment"); const customerProfilesEntityAssignments_1 = require("./customerProfiles/customerProfilesEntityAssignments"); const customerProfilesEvaluations_1 = require("./customerProfiles/customerProfilesEvaluations"); class CustomerProfilesContextImpl { 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 = `/CustomerProfiles/${sid}`; } get customerProfilesChannelEndpointAssignment() { this._customerProfilesChannelEndpointAssignment = this._customerProfilesChannelEndpointAssignment || (0, customerProfilesChannelEndpointAssignment_1.CustomerProfilesChannelEndpointAssignmentListInstance)(this._version, this._solution.sid); return this._customerProfilesChannelEndpointAssignment; } get customerProfilesEntityAssignments() { this._customerProfilesEntityAssignments = this._customerProfilesEntityAssignments || (0, customerProfilesEntityAssignments_1.CustomerProfilesEntityAssignmentsListInstance)(this._version, this._solution.sid); return this._customerProfilesEntityAssignments; } get customerProfilesEvaluations() { this._customerProfilesEvaluations = this._customerProfilesEvaluations || (0, customerProfilesEvaluations_1.CustomerProfilesEvaluationsListInstance)(this._version, this._solution.sid); return this._customerProfilesEvaluations; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CustomerProfilesInstance(operationVersion, payload, 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["status"] !== undefined) data["Status"] = params["status"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["email"] !== undefined) data["Email"] = params["email"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CustomerProfilesInstance(operationVersion, payload, 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.CustomerProfilesContextImpl = CustomerProfilesContextImpl; class CustomerProfilesInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.policySid = payload.policy_sid; this.friendlyName = payload.friendly_name; this.status = payload.status; this.validUntil = deserialize.iso8601DateTime(payload.valid_until); this.email = payload.email; this.statusCallback = payload.status_callback; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this.errors = payload.errors; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CustomerProfilesContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CustomerProfilesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CustomerProfilesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the customerProfilesChannelEndpointAssignment. */ customerProfilesChannelEndpointAssignment() { return this._proxy.customerProfilesChannelEndpointAssignment; } /** * Access the customerProfilesEntityAssignments. */ customerProfilesEntityAssignments() { return this._proxy.customerProfilesEntityAssignments; } /** * Access the customerProfilesEvaluations. */ customerProfilesEvaluations() { return this._proxy.customerProfilesEvaluations; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, policySid: this.policySid, friendlyName: this.friendlyName, status: this.status, validUntil: this.validUntil, email: this.email, statusCallback: this.statusCallback, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, errors: this.errors, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomerProfilesInstance = CustomerProfilesInstance; function CustomerProfilesListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CustomerProfilesContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/CustomerProfiles`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["email"] === null || params["email"] === undefined) { throw new Error("Required parameter \"params['email']\" missing."); } if (params["policySid"] === null || params["policySid"] === undefined) { throw new Error("Required parameter \"params['policySid']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Email"] = params["email"]; data["PolicySid"] = params["policySid"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CustomerProfilesInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["policySid"] !== undefined) data["PolicySid"] = params["policySid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CustomerProfilesPage(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 CustomerProfilesPage(instance._version, payload, 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; } exports.CustomerProfilesListInstance = CustomerProfilesListInstance; class CustomerProfilesPage extends Page_1.default { /** * Initialize the CustomerProfilesPage * * @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 CustomerProfilesInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CustomerProfilesInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomerProfilesPage = CustomerProfilesPage; rest/trusthub/v1/supportingDocumentType.d.ts000064400000021250151677225100015302 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface SupportingDocumentTypeListInstanceEachOptions { /** 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: SupportingDocumentTypeInstance, 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 SupportingDocumentTypeListInstanceOptions { /** 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 SupportingDocumentTypeListInstancePageOptions { /** 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 SupportingDocumentTypeContext { /** * Fetch a SupportingDocumentTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentTypeInstance */ fetch(callback?: (error: Error | null, item?: SupportingDocumentTypeInstance) => any): Promise<SupportingDocumentTypeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SupportingDocumentTypeContextSolution { sid: string; } export declare class SupportingDocumentTypeContextImpl implements SupportingDocumentTypeContext { protected _version: V1; protected _solution: SupportingDocumentTypeContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: SupportingDocumentTypeInstance) => any): Promise<SupportingDocumentTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SupportingDocumentTypeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SupportingDocumentTypePayload extends TwilioResponsePayload { supporting_document_types: SupportingDocumentTypeResource[]; } interface SupportingDocumentTypeResource { sid: string; friendly_name: string; machine_name: string; fields: Array<any>; url: string; } export declare class SupportingDocumentTypeInstance { protected _version: V1; protected _solution: SupportingDocumentTypeContextSolution; protected _context?: SupportingDocumentTypeContext; constructor(_version: V1, payload: SupportingDocumentTypeResource, sid?: string); /** * The unique string that identifies the Supporting Document Type resource. */ sid: string; /** * A human-readable description of the Supporting Document Type resource. */ friendlyName: string; /** * The machine-readable description of the Supporting Document Type resource. */ machineName: string; /** * The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals. */ fields: Array<any>; /** * The absolute URL of the Supporting Document Type resource. */ url: string; private get _proxy(); /** * Fetch a SupportingDocumentTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentTypeInstance */ fetch(callback?: (error: Error | null, item?: SupportingDocumentTypeInstance) => any): Promise<SupportingDocumentTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; machineName: string; fields: any[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SupportingDocumentTypeSolution { } export interface SupportingDocumentTypeListInstance { _version: V1; _solution: SupportingDocumentTypeSolution; _uri: string; (sid: string): SupportingDocumentTypeContext; get(sid: string): SupportingDocumentTypeContext; /** * Streams SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SupportingDocumentTypeInstance, done: (err?: Error) => void) => void): void; each(params: SupportingDocumentTypeListInstanceEachOptions, callback?: (item: SupportingDocumentTypeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SupportingDocumentTypeInstance 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: SupportingDocumentTypePage) => any): Promise<SupportingDocumentTypePage>; /** * Lists SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SupportingDocumentTypeInstance[]) => any): Promise<SupportingDocumentTypeInstance[]>; list(params: SupportingDocumentTypeListInstanceOptions, callback?: (error: Error | null, items: SupportingDocumentTypeInstance[]) => any): Promise<SupportingDocumentTypeInstance[]>; /** * Retrieve a single page of SupportingDocumentTypeInstance 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 { SupportingDocumentTypeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SupportingDocumentTypePage) => any): Promise<SupportingDocumentTypePage>; page(params: SupportingDocumentTypeListInstancePageOptions, callback?: (error: Error | null, items: SupportingDocumentTypePage) => any): Promise<SupportingDocumentTypePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SupportingDocumentTypeListInstance(version: V1): SupportingDocumentTypeListInstance; export declare class SupportingDocumentTypePage extends Page<V1, SupportingDocumentTypePayload, SupportingDocumentTypeResource, SupportingDocumentTypeInstance> { /** * Initialize the SupportingDocumentTypePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SupportingDocumentTypeSolution); /** * Build an instance of SupportingDocumentTypeInstance * * @param payload - Payload response from the API */ getInstance(payload: SupportingDocumentTypeResource): SupportingDocumentTypeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/complianceRegistrationInquiries.d.ts000064400000023006151677225100017126 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export type ComplianceRegistrationInquiriesBusinessIdentityType = "direct_customer" | "isv_reseller_or_partner" | "unknown"; export type ComplianceRegistrationInquiriesBusinessRegistrationAuthority = "UK:CRN" | "US:EIN" | "CA:CBN" | "AU:ACN" | "Other"; export type ComplianceRegistrationInquiriesEndUserType = "Individual" | "Business"; export type ComplianceRegistrationInquiriesPhoneNumberType = "local" | "national" | "mobile" | "toll-free"; /** * Options to pass to update a ComplianceRegistrationInquiriesInstance */ export interface ComplianceRegistrationInquiriesContextUpdateOptions { /** Indicates if the inquiry is being started from an ISV embedded component. */ isIsvEmbed?: boolean; /** Theme id for styling the inquiry form. */ themeSetId?: string; } /** * Options to pass to create a ComplianceRegistrationInquiriesInstance */ export interface ComplianceRegistrationInquiriesListInstanceCreateOptions { /** */ endUserType: ComplianceRegistrationInquiriesEndUserType; /** */ phoneNumberType: ComplianceRegistrationInquiriesPhoneNumberType; /** */ businessIdentityType?: ComplianceRegistrationInquiriesBusinessIdentityType; /** */ businessRegistrationAuthority?: ComplianceRegistrationInquiriesBusinessRegistrationAuthority; /** he name of the business or organization using the Tollfree number. */ businessLegalName?: string; /** he email address to receive the notification about the verification result. */ notificationEmail?: string; /** The email address to receive the notification about the verification result. */ acceptedNotificationReceipt?: boolean; /** Business registration number of the business */ businessRegistrationNumber?: string; /** The URL of the business website */ businessWebsiteUrl?: string; /** Friendly name for your business information */ friendlyName?: string; /** First name of the authorized representative */ authorizedRepresentative1FirstName?: string; /** Last name of the authorized representative */ authorizedRepresentative1LastName?: string; /** Phone number of the authorized representative */ authorizedRepresentative1Phone?: string; /** Email address of the authorized representative */ authorizedRepresentative1Email?: string; /** Birthdate of the authorized representative */ authorizedRepresentative1DateOfBirth?: string; /** Street address of the business */ addressStreet?: string; /** Street address of the business */ addressStreetSecondary?: string; /** City of the business */ addressCity?: string; /** State or province of the business */ addressSubdivision?: string; /** Postal code of the business */ addressPostalCode?: string; /** Country code of the business */ addressCountryCode?: string; /** Street address of the business */ emergencyAddressStreet?: string; /** Street address of the business */ emergencyAddressStreetSecondary?: string; /** City of the business */ emergencyAddressCity?: string; /** State or province of the business */ emergencyAddressSubdivision?: string; /** Postal code of the business */ emergencyAddressPostalCode?: string; /** Country code of the business */ emergencyAddressCountryCode?: string; /** Use the business address as the emergency address */ useAddressAsEmergencyAddress?: boolean; /** The name of the verification document to upload */ fileName?: string; /** The verification document to upload */ file?: string; /** The first name of the Individual User. */ firstName?: string; /** The last name of the Individual User. */ lastName?: string; /** The date of birth of the Individual User. */ dateOfBirth?: string; /** The email address of the Individual User. */ individualEmail?: string; /** The phone number of the Individual User. */ individualPhone?: string; /** Indicates if the inquiry is being started from an ISV embedded component. */ isIsvEmbed?: boolean; /** Indicates if the isv registering for self or tenant. */ isvRegisteringForSelfOrTenant?: string; /** The url we call to inform you of bundle changes. */ statusCallbackUrl?: string; /** Theme id for styling the inquiry form. */ themeSetId?: string; } export interface ComplianceRegistrationInquiriesContext { /** * Update a ComplianceRegistrationInquiriesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ComplianceRegistrationInquiriesInstance */ update(callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>; /** * Update a ComplianceRegistrationInquiriesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ComplianceRegistrationInquiriesInstance */ update(params: ComplianceRegistrationInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ComplianceRegistrationInquiriesContextSolution { registrationId: string; } export declare class ComplianceRegistrationInquiriesContextImpl implements ComplianceRegistrationInquiriesContext { protected _version: V1; protected _solution: ComplianceRegistrationInquiriesContextSolution; protected _uri: string; constructor(_version: V1, registrationId: string); update(params?: ComplianceRegistrationInquiriesContextUpdateOptions | ((error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any), callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ComplianceRegistrationInquiriesContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ComplianceRegistrationInquiriesResource { inquiry_id: string; inquiry_session_token: string; registration_id: string; url: string; } export declare class ComplianceRegistrationInquiriesInstance { protected _version: V1; protected _solution: ComplianceRegistrationInquiriesContextSolution; protected _context?: ComplianceRegistrationInquiriesContext; constructor(_version: V1, payload: ComplianceRegistrationInquiriesResource, registrationId?: string); /** * The unique ID used to start an embedded compliance registration session. */ inquiryId: string; /** * The session token used to start an embedded compliance registration session. */ inquirySessionToken: string; /** * The RegistrationId matching the Registration Profile that should be resumed or resubmitted for editing. */ registrationId: string; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Update a ComplianceRegistrationInquiriesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ComplianceRegistrationInquiriesInstance */ update(callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>; /** * Update a ComplianceRegistrationInquiriesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ComplianceRegistrationInquiriesInstance */ update(params: ComplianceRegistrationInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { inquiryId: string; inquirySessionToken: string; registrationId: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ComplianceRegistrationInquiriesSolution { } export interface ComplianceRegistrationInquiriesListInstance { _version: V1; _solution: ComplianceRegistrationInquiriesSolution; _uri: string; (registrationId: string): ComplianceRegistrationInquiriesContext; get(registrationId: string): ComplianceRegistrationInquiriesContext; /** * Create a ComplianceRegistrationInquiriesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ComplianceRegistrationInquiriesInstance */ create(params: ComplianceRegistrationInquiriesListInstanceCreateOptions, callback?: (error: Error | null, item?: ComplianceRegistrationInquiriesInstance) => any): Promise<ComplianceRegistrationInquiriesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ComplianceRegistrationInquiriesListInstance(version: V1): ComplianceRegistrationInquiriesListInstance; export {}; rest/trusthub/v1/complianceInquiries.d.ts000064400000011454151677225100014537 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to update a ComplianceInquiriesInstance */ export interface ComplianceInquiriesContextUpdateOptions { /** The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. */ primaryProfileSid: string; } /** * Options to pass to create a ComplianceInquiriesInstance */ export interface ComplianceInquiriesListInstanceCreateOptions { /** The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. */ primaryProfileSid: string; /** The email address that approval status updates will be sent to. If not specified, the email address associated with your primary customer profile will be used. */ notificationEmail?: string; } export interface ComplianceInquiriesContext { /** * Update a ComplianceInquiriesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ComplianceInquiriesInstance */ update(params: ComplianceInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any): Promise<ComplianceInquiriesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ComplianceInquiriesContextSolution { customerId: string; } export declare class ComplianceInquiriesContextImpl implements ComplianceInquiriesContext { protected _version: V1; protected _solution: ComplianceInquiriesContextSolution; protected _uri: string; constructor(_version: V1, customerId: string); update(params: ComplianceInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any): Promise<ComplianceInquiriesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ComplianceInquiriesContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ComplianceInquiriesResource { inquiry_id: string; inquiry_session_token: string; customer_id: string; url: string; } export declare class ComplianceInquiriesInstance { protected _version: V1; protected _solution: ComplianceInquiriesContextSolution; protected _context?: ComplianceInquiriesContext; constructor(_version: V1, payload: ComplianceInquiriesResource, customerId?: string); /** * The unique ID used to start an embedded compliance registration session. */ inquiryId: string; /** * The session token used to start an embedded compliance registration session. */ inquirySessionToken: string; /** * The CustomerID matching the Customer Profile that should be resumed or resubmitted for editing. */ customerId: string; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Update a ComplianceInquiriesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ComplianceInquiriesInstance */ update(params: ComplianceInquiriesContextUpdateOptions, callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any): Promise<ComplianceInquiriesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { inquiryId: string; inquirySessionToken: string; customerId: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ComplianceInquiriesSolution { } export interface ComplianceInquiriesListInstance { _version: V1; _solution: ComplianceInquiriesSolution; _uri: string; (customerId: string): ComplianceInquiriesContext; get(customerId: string): ComplianceInquiriesContext; /** * Create a ComplianceInquiriesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ComplianceInquiriesInstance */ create(params: ComplianceInquiriesListInstanceCreateOptions, callback?: (error: Error | null, item?: ComplianceInquiriesInstance) => any): Promise<ComplianceInquiriesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ComplianceInquiriesListInstance(version: V1): ComplianceInquiriesListInstance; export {}; rest/trusthub/v1/complianceTollfreeInquiries.d.ts000064400000011534151677225100016233 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; export type ComplianceTollfreeInquiriesOptInType = "VERBAL" | "WEB_FORM" | "PAPER_FORM" | "VIA_TEXT" | "MOBILE_QR_CODE"; /** * Options to pass to create a ComplianceTollfreeInquiriesInstance */ export interface ComplianceTollfreeInquiriesListInstanceCreateOptions { /** The Tollfree phone number to be verified */ tollfreePhoneNumber: string; /** The email address to receive the notification about the verification result. */ notificationEmail: string; /** The name of the business or organization using the Tollfree number. */ businessName?: string; /** The website of the business or organization using the Tollfree number. */ businessWebsite?: string; /** The category of the use case for the Tollfree Number. List as many are applicable.. */ useCaseCategories?: Array<string>; /** Use this to further explain how messaging is used by the business or organization. */ useCaseSummary?: string; /** An example of message content, i.e. a sample message. */ productionMessageSample?: string; /** Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. */ optInImageUrls?: Array<string>; /** */ optInType?: ComplianceTollfreeInquiriesOptInType; /** Estimate monthly volume of messages from the Tollfree Number. */ messageVolume?: string; /** The address of the business or organization using the Tollfree number. */ businessStreetAddress?: string; /** The address of the business or organization using the Tollfree number. */ businessStreetAddress2?: string; /** The city of the business or organization using the Tollfree number. */ businessCity?: string; /** The state/province/region of the business or organization using the Tollfree number. */ businessStateProvinceRegion?: string; /** The postal code of the business or organization using the Tollfree number. */ businessPostalCode?: string; /** The country of the business or organization using the Tollfree number. */ businessCountry?: string; /** Additional information to be provided for verification. */ additionalInformation?: string; /** The first name of the contact for the business or organization using the Tollfree number. */ businessContactFirstName?: string; /** The last name of the contact for the business or organization using the Tollfree number. */ businessContactLastName?: string; /** The email address of the contact for the business or organization using the Tollfree number. */ businessContactEmail?: string; /** The phone number of the contact for the business or organization using the Tollfree number. */ businessContactPhone?: string; /** Theme id for styling the inquiry form. */ themeSetId?: string; } export interface ComplianceTollfreeInquiriesSolution { } export interface ComplianceTollfreeInquiriesListInstance { _version: V1; _solution: ComplianceTollfreeInquiriesSolution; _uri: string; /** * Create a ComplianceTollfreeInquiriesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ComplianceTollfreeInquiriesInstance */ create(params: ComplianceTollfreeInquiriesListInstanceCreateOptions, callback?: (error: Error | null, item?: ComplianceTollfreeInquiriesInstance) => any): Promise<ComplianceTollfreeInquiriesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ComplianceTollfreeInquiriesListInstance(version: V1): ComplianceTollfreeInquiriesListInstance; interface ComplianceTollfreeInquiriesResource { inquiry_id: string; inquiry_session_token: string; registration_id: string; url: string; } export declare class ComplianceTollfreeInquiriesInstance { protected _version: V1; constructor(_version: V1, payload: ComplianceTollfreeInquiriesResource); /** * The unique ID used to start an embedded compliance registration session. */ inquiryId: string; /** * The session token used to start an embedded compliance registration session. */ inquirySessionToken: string; /** * The TolfreeId matching the Tollfree Profile that should be resumed or resubmitted for editing. */ registrationId: string; /** * The URL of this resource. */ url: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { inquiryId: string; inquirySessionToken: string; registrationId: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/trustProducts.d.ts000064400000037101151677225100013436 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { TrustProductsChannelEndpointAssignmentListInstance } from "./trustProducts/trustProductsChannelEndpointAssignment"; import { TrustProductsEntityAssignmentsListInstance } from "./trustProducts/trustProductsEntityAssignments"; import { TrustProductsEvaluationsListInstance } from "./trustProducts/trustProductsEvaluations"; export type TrustProductsStatus = "draft" | "pending-review" | "in-review" | "twilio-rejected" | "twilio-approved"; /** * Options to pass to update a TrustProductsInstance */ export interface TrustProductsContextUpdateOptions { /** */ status?: TrustProductsStatus; /** The URL we call to inform your application of status changes. */ statusCallback?: string; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The email address that will receive updates when the Trust Product resource changes status. */ email?: string; } /** * Options to pass to create a TrustProductsInstance */ export interface TrustProductsListInstanceCreateOptions { /** The string that you assigned to describe the resource. */ friendlyName: string; /** The email address that will receive updates when the Trust Product resource changes status. */ email: string; /** The unique string of a policy that is associated to the Trust Product resource. */ policySid: string; /** The URL we call to inform your application of status changes. */ statusCallback?: string; } /** * Options to pass to each */ export interface TrustProductsListInstanceEachOptions { /** The verification status of the Trust Product resource. */ status?: TrustProductsStatus; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The unique string of a policy that is associated to the Trust Product resource. */ policySid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: TrustProductsInstance, 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 TrustProductsListInstanceOptions { /** The verification status of the Trust Product resource. */ status?: TrustProductsStatus; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The unique string of a policy that is associated to the Trust Product resource. */ policySid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface TrustProductsListInstancePageOptions { /** The verification status of the Trust Product resource. */ status?: TrustProductsStatus; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The unique string of a policy that is associated to the Trust Product resource. */ policySid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface TrustProductsContext { trustProductsChannelEndpointAssignment: TrustProductsChannelEndpointAssignmentListInstance; trustProductsEntityAssignments: TrustProductsEntityAssignmentsListInstance; trustProductsEvaluations: TrustProductsEvaluationsListInstance; /** * Remove a TrustProductsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TrustProductsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsInstance */ fetch(callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>; /** * Update a TrustProductsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsInstance */ update(callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>; /** * Update a TrustProductsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsInstance */ update(params: TrustProductsContextUpdateOptions, callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TrustProductsContextSolution { sid: string; } export declare class TrustProductsContextImpl implements TrustProductsContext { protected _version: V1; protected _solution: TrustProductsContextSolution; protected _uri: string; protected _trustProductsChannelEndpointAssignment?: TrustProductsChannelEndpointAssignmentListInstance; protected _trustProductsEntityAssignments?: TrustProductsEntityAssignmentsListInstance; protected _trustProductsEvaluations?: TrustProductsEvaluationsListInstance; constructor(_version: V1, sid: string); get trustProductsChannelEndpointAssignment(): TrustProductsChannelEndpointAssignmentListInstance; get trustProductsEntityAssignments(): TrustProductsEntityAssignmentsListInstance; get trustProductsEvaluations(): TrustProductsEvaluationsListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>; update(params?: TrustProductsContextUpdateOptions | ((error: Error | null, item?: TrustProductsInstance) => any), callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TrustProductsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TrustProductsPayload extends TwilioResponsePayload { results: TrustProductsResource[]; } interface TrustProductsResource { sid: string; account_sid: string; policy_sid: string; friendly_name: string; status: TrustProductsStatus; valid_until: Date; email: string; status_callback: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; errors: Array<any>; } export declare class TrustProductsInstance { protected _version: V1; protected _solution: TrustProductsContextSolution; protected _context?: TrustProductsContext; constructor(_version: V1, payload: TrustProductsResource, sid?: string); /** * The unique string that we created to identify the Trust Product resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Trust Product resource. */ accountSid: string; /** * The unique string of the policy that is associated with the Trust Product resource. */ policySid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; status: TrustProductsStatus; /** * The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format until which the resource will be valid. */ validUntil: Date; /** * The email address that will receive updates when the Trust Product resource changes status. */ email: string; /** * The URL we call to inform your application of status changes. */ statusCallback: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Trust Product resource. */ url: string; /** * The URLs of the Assigned Items of the Trust Product resource. */ links: Record<string, string>; /** * The error codes associated with the rejection of the Trust Product. */ errors: Array<any>; private get _proxy(); /** * Remove a TrustProductsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TrustProductsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsInstance */ fetch(callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>; /** * Update a TrustProductsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsInstance */ update(callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>; /** * Update a TrustProductsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsInstance */ update(params: TrustProductsContextUpdateOptions, callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>; /** * Access the trustProductsChannelEndpointAssignment. */ trustProductsChannelEndpointAssignment(): TrustProductsChannelEndpointAssignmentListInstance; /** * Access the trustProductsEntityAssignments. */ trustProductsEntityAssignments(): TrustProductsEntityAssignmentsListInstance; /** * Access the trustProductsEvaluations. */ trustProductsEvaluations(): TrustProductsEvaluationsListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; policySid: string; friendlyName: string; status: TrustProductsStatus; validUntil: Date; email: string; statusCallback: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; errors: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TrustProductsSolution { } export interface TrustProductsListInstance { _version: V1; _solution: TrustProductsSolution; _uri: string; (sid: string): TrustProductsContext; get(sid: string): TrustProductsContext; /** * Create a TrustProductsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsInstance */ create(params: TrustProductsListInstanceCreateOptions, callback?: (error: Error | null, item?: TrustProductsInstance) => any): Promise<TrustProductsInstance>; /** * Streams TrustProductsInstance 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 { TrustProductsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TrustProductsInstance, done: (err?: Error) => void) => void): void; each(params: TrustProductsListInstanceEachOptions, callback?: (item: TrustProductsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TrustProductsInstance 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: TrustProductsPage) => any): Promise<TrustProductsPage>; /** * Lists TrustProductsInstance 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 { TrustProductsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TrustProductsInstance[]) => any): Promise<TrustProductsInstance[]>; list(params: TrustProductsListInstanceOptions, callback?: (error: Error | null, items: TrustProductsInstance[]) => any): Promise<TrustProductsInstance[]>; /** * Retrieve a single page of TrustProductsInstance 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 { TrustProductsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TrustProductsPage) => any): Promise<TrustProductsPage>; page(params: TrustProductsListInstancePageOptions, callback?: (error: Error | null, items: TrustProductsPage) => any): Promise<TrustProductsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TrustProductsListInstance(version: V1): TrustProductsListInstance; export declare class TrustProductsPage extends Page<V1, TrustProductsPayload, TrustProductsResource, TrustProductsInstance> { /** * Initialize the TrustProductsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TrustProductsSolution); /** * Build an instance of TrustProductsInstance * * @param payload - Payload response from the API */ getInstance(payload: TrustProductsResource): TrustProductsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/endUserType.js000064400000014372151677225100012551 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.EndUserTypePage = exports.EndUserTypeListInstance = exports.EndUserTypeInstance = exports.EndUserTypeContextImpl = void 0; 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 EndUserTypeContextImpl { 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 = `/EndUserTypes/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EndUserTypeInstance(operationVersion, payload, 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.EndUserTypeContextImpl = EndUserTypeContextImpl; class EndUserTypeInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.machineName = payload.machine_name; this.fields = payload.fields; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new EndUserTypeContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a EndUserTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserTypeInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, machineName: this.machineName, fields: this.fields, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EndUserTypeInstance = EndUserTypeInstance; function EndUserTypeListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EndUserTypeContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/EndUserTypes`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EndUserTypePage(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 EndUserTypePage(instance._version, payload, 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; } exports.EndUserTypeListInstance = EndUserTypeListInstance; class EndUserTypePage extends Page_1.default { /** * Initialize the EndUserTypePage * * @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 EndUserTypeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EndUserTypeInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EndUserTypePage = EndUserTypePage; rest/trusthub/v1/customerProfiles.d.ts000064400000040026151677225100014076 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { CustomerProfilesChannelEndpointAssignmentListInstance } from "./customerProfiles/customerProfilesChannelEndpointAssignment"; import { CustomerProfilesEntityAssignmentsListInstance } from "./customerProfiles/customerProfilesEntityAssignments"; import { CustomerProfilesEvaluationsListInstance } from "./customerProfiles/customerProfilesEvaluations"; export type CustomerProfilesStatus = "draft" | "pending-review" | "in-review" | "twilio-rejected" | "twilio-approved"; /** * Options to pass to update a CustomerProfilesInstance */ export interface CustomerProfilesContextUpdateOptions { /** */ status?: CustomerProfilesStatus; /** The URL we call to inform your application of status changes. */ statusCallback?: string; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The email address that will receive updates when the Customer-Profile resource changes status. */ email?: string; } /** * Options to pass to create a CustomerProfilesInstance */ export interface CustomerProfilesListInstanceCreateOptions { /** The string that you assigned to describe the resource. */ friendlyName: string; /** The email address that will receive updates when the Customer-Profile resource changes status. */ email: string; /** The unique string of a policy that is associated to the Customer-Profile resource. */ policySid: string; /** The URL we call to inform your application of status changes. */ statusCallback?: string; } /** * Options to pass to each */ export interface CustomerProfilesListInstanceEachOptions { /** The verification status of the Customer-Profile resource. */ status?: CustomerProfilesStatus; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The unique string of a policy that is associated to the Customer-Profile resource. */ policySid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CustomerProfilesInstance, 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 CustomerProfilesListInstanceOptions { /** The verification status of the Customer-Profile resource. */ status?: CustomerProfilesStatus; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The unique string of a policy that is associated to the Customer-Profile resource. */ policySid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CustomerProfilesListInstancePageOptions { /** The verification status of the Customer-Profile resource. */ status?: CustomerProfilesStatus; /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The unique string of a policy that is associated to the Customer-Profile resource. */ policySid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CustomerProfilesContext { customerProfilesChannelEndpointAssignment: CustomerProfilesChannelEndpointAssignmentListInstance; customerProfilesEntityAssignments: CustomerProfilesEntityAssignmentsListInstance; customerProfilesEvaluations: CustomerProfilesEvaluationsListInstance; /** * Remove a CustomerProfilesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CustomerProfilesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesInstance */ fetch(callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>; /** * Update a CustomerProfilesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesInstance */ update(callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>; /** * Update a CustomerProfilesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesInstance */ update(params: CustomerProfilesContextUpdateOptions, callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CustomerProfilesContextSolution { sid: string; } export declare class CustomerProfilesContextImpl implements CustomerProfilesContext { protected _version: V1; protected _solution: CustomerProfilesContextSolution; protected _uri: string; protected _customerProfilesChannelEndpointAssignment?: CustomerProfilesChannelEndpointAssignmentListInstance; protected _customerProfilesEntityAssignments?: CustomerProfilesEntityAssignmentsListInstance; protected _customerProfilesEvaluations?: CustomerProfilesEvaluationsListInstance; constructor(_version: V1, sid: string); get customerProfilesChannelEndpointAssignment(): CustomerProfilesChannelEndpointAssignmentListInstance; get customerProfilesEntityAssignments(): CustomerProfilesEntityAssignmentsListInstance; get customerProfilesEvaluations(): CustomerProfilesEvaluationsListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>; update(params?: CustomerProfilesContextUpdateOptions | ((error: Error | null, item?: CustomerProfilesInstance) => any), callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CustomerProfilesContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CustomerProfilesPayload extends TwilioResponsePayload { results: CustomerProfilesResource[]; } interface CustomerProfilesResource { sid: string; account_sid: string; policy_sid: string; friendly_name: string; status: CustomerProfilesStatus; valid_until: Date; email: string; status_callback: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; errors: Array<any>; } export declare class CustomerProfilesInstance { protected _version: V1; protected _solution: CustomerProfilesContextSolution; protected _context?: CustomerProfilesContext; constructor(_version: V1, payload: CustomerProfilesResource, sid?: string); /** * The unique string that we created to identify the Customer-Profile resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource. */ accountSid: string; /** * The unique string of a policy that is associated to the Customer-Profile resource. */ policySid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; status: CustomerProfilesStatus; /** * The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. */ validUntil: Date; /** * The email address that will receive updates when the Customer-Profile resource changes status. */ email: string; /** * The URL we call to inform your application of status changes. */ statusCallback: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Customer-Profile resource. */ url: string; /** * The URLs of the Assigned Items of the Customer-Profile resource. */ links: Record<string, string>; /** * The error codes associated with the rejection of the Customer-Profile. */ errors: Array<any>; private get _proxy(); /** * Remove a CustomerProfilesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CustomerProfilesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesInstance */ fetch(callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>; /** * Update a CustomerProfilesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesInstance */ update(callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>; /** * Update a CustomerProfilesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesInstance */ update(params: CustomerProfilesContextUpdateOptions, callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>; /** * Access the customerProfilesChannelEndpointAssignment. */ customerProfilesChannelEndpointAssignment(): CustomerProfilesChannelEndpointAssignmentListInstance; /** * Access the customerProfilesEntityAssignments. */ customerProfilesEntityAssignments(): CustomerProfilesEntityAssignmentsListInstance; /** * Access the customerProfilesEvaluations. */ customerProfilesEvaluations(): CustomerProfilesEvaluationsListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; policySid: string; friendlyName: string; status: CustomerProfilesStatus; validUntil: Date; email: string; statusCallback: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; errors: any[]; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CustomerProfilesSolution { } export interface CustomerProfilesListInstance { _version: V1; _solution: CustomerProfilesSolution; _uri: string; (sid: string): CustomerProfilesContext; get(sid: string): CustomerProfilesContext; /** * Create a CustomerProfilesInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesInstance */ create(params: CustomerProfilesListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomerProfilesInstance) => any): Promise<CustomerProfilesInstance>; /** * Streams CustomerProfilesInstance 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 { CustomerProfilesListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CustomerProfilesInstance, done: (err?: Error) => void) => void): void; each(params: CustomerProfilesListInstanceEachOptions, callback?: (item: CustomerProfilesInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CustomerProfilesInstance 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: CustomerProfilesPage) => any): Promise<CustomerProfilesPage>; /** * Lists CustomerProfilesInstance 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 { CustomerProfilesListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CustomerProfilesInstance[]) => any): Promise<CustomerProfilesInstance[]>; list(params: CustomerProfilesListInstanceOptions, callback?: (error: Error | null, items: CustomerProfilesInstance[]) => any): Promise<CustomerProfilesInstance[]>; /** * Retrieve a single page of CustomerProfilesInstance 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 { CustomerProfilesListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CustomerProfilesPage) => any): Promise<CustomerProfilesPage>; page(params: CustomerProfilesListInstancePageOptions, callback?: (error: Error | null, items: CustomerProfilesPage) => any): Promise<CustomerProfilesPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CustomerProfilesListInstance(version: V1): CustomerProfilesListInstance; export declare class CustomerProfilesPage extends Page<V1, CustomerProfilesPayload, CustomerProfilesResource, CustomerProfilesInstance> { /** * Initialize the CustomerProfilesPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CustomerProfilesSolution); /** * Build an instance of CustomerProfilesInstance * * @param payload - Payload response from the API */ getInstance(payload: CustomerProfilesResource): CustomerProfilesInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/endUser.d.ts000064400000026614151677225100012145 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to update a EndUserInstance */ export interface EndUserContextUpdateOptions { /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The set of parameters that are the attributes of the End User resource which are derived End User Types. */ attributes?: any; } /** * Options to pass to create a EndUserInstance */ export interface EndUserListInstanceCreateOptions { /** The string that you assigned to describe the resource. */ friendlyName: string; /** The type of end user of the Bundle resource - can be `individual` or `business`. */ type: string; /** The set of parameters that are the attributes of the End User resource which are derived End User Types. */ attributes?: any; } /** * Options to pass to each */ export interface EndUserListInstanceEachOptions { /** 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: EndUserInstance, 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 EndUserListInstanceOptions { /** 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 EndUserListInstancePageOptions { /** 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 EndUserContext { /** * Remove a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ fetch(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Update a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ update(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Update a EndUserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ update(params: EndUserContextUpdateOptions, callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EndUserContextSolution { sid: string; } export declare class EndUserContextImpl implements EndUserContext { protected _version: V1; protected _solution: EndUserContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; update(params?: EndUserContextUpdateOptions | ((error: Error | null, item?: EndUserInstance) => any), callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EndUserContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EndUserPayload extends TwilioResponsePayload { results: EndUserResource[]; } interface EndUserResource { sid: string; account_sid: string; friendly_name: string; type: string; attributes: any; date_created: Date; date_updated: Date; url: string; } export declare class EndUserInstance { protected _version: V1; protected _solution: EndUserContextSolution; protected _context?: EndUserContext; constructor(_version: V1, payload: EndUserResource, sid?: string); /** * The unique string created by Twilio to identify the End User resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The type of end user of the Bundle resource - can be `individual` or `business`. */ type: string; /** * The set of parameters that are the attributes of the End Users resource which are listed in the End User Types. */ attributes: any; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the End User resource. */ url: string; private get _proxy(); /** * Remove a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ fetch(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Update a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ update(callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Update a EndUserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ update(params: EndUserContextUpdateOptions, callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; type: string; attributes: any; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EndUserSolution { } export interface EndUserListInstance { _version: V1; _solution: EndUserSolution; _uri: string; (sid: string): EndUserContext; get(sid: string): EndUserContext; /** * Create a EndUserInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ create(params: EndUserListInstanceCreateOptions, callback?: (error: Error | null, item?: EndUserInstance) => any): Promise<EndUserInstance>; /** * Streams EndUserInstance 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 { EndUserListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EndUserInstance, done: (err?: Error) => void) => void): void; each(params: EndUserListInstanceEachOptions, callback?: (item: EndUserInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EndUserInstance 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: EndUserPage) => any): Promise<EndUserPage>; /** * Lists EndUserInstance 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 { EndUserListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EndUserInstance[]) => any): Promise<EndUserInstance[]>; list(params: EndUserListInstanceOptions, callback?: (error: Error | null, items: EndUserInstance[]) => any): Promise<EndUserInstance[]>; /** * Retrieve a single page of EndUserInstance 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 { EndUserListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EndUserPage) => any): Promise<EndUserPage>; page(params: EndUserListInstancePageOptions, callback?: (error: Error | null, items: EndUserPage) => any): Promise<EndUserPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EndUserListInstance(version: V1): EndUserListInstance; export declare class EndUserPage extends Page<V1, EndUserPayload, EndUserResource, EndUserInstance> { /** * Initialize the EndUserPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: EndUserSolution); /** * Build an instance of EndUserInstance * * @param payload - Payload response from the API */ getInstance(payload: EndUserResource): EndUserInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/endUser.js000064400000022703151677225100011704 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.EndUserPage = exports.EndUserListInstance = exports.EndUserInstance = exports.EndUserContextImpl = void 0; 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 EndUserContextImpl { 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 = `/EndUsers/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EndUserInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["attributes"] !== undefined) data["Attributes"] = serialize.object(params["attributes"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new EndUserInstance(operationVersion, payload, 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.EndUserContextImpl = EndUserContextImpl; class EndUserInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.type = payload.type; this.attributes = payload.attributes; 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 EndUserContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a EndUserInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, type: this.type, attributes: this.attributes, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EndUserInstance = EndUserInstance; function EndUserListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new EndUserContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/EndUsers`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; if (params["attributes"] !== undefined) data["Attributes"] = serialize.object(params["attributes"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new EndUserInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EndUserPage(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 EndUserPage(instance._version, payload, 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; } exports.EndUserListInstance = EndUserListInstance; class EndUserPage extends Page_1.default { /** * Initialize the EndUserPage * * @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 EndUserInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EndUserInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EndUserPage = EndUserPage; rest/trusthub/v1/supportingDocument.js000064400000023657151677225100014221 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.SupportingDocumentPage = exports.SupportingDocumentListInstance = exports.SupportingDocumentInstance = exports.SupportingDocumentContextImpl = void 0; 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 SupportingDocumentContextImpl { 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 = `/SupportingDocuments/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SupportingDocumentInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["attributes"] !== undefined) data["Attributes"] = serialize.object(params["attributes"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SupportingDocumentInstance(operationVersion, payload, 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.SupportingDocumentContextImpl = SupportingDocumentContextImpl; class SupportingDocumentInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.mimeType = payload.mime_type; this.status = payload.status; this.type = payload.type; this.attributes = payload.attributes; 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 SupportingDocumentContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, friendlyName: this.friendlyName, mimeType: this.mimeType, status: this.status, type: this.type, attributes: this.attributes, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SupportingDocumentInstance = SupportingDocumentInstance; function SupportingDocumentListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SupportingDocumentContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/SupportingDocuments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Type"] = params["type"]; if (params["attributes"] !== undefined) data["Attributes"] = serialize.object(params["attributes"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SupportingDocumentInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SupportingDocumentPage(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 SupportingDocumentPage(instance._version, payload, 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; } exports.SupportingDocumentListInstance = SupportingDocumentListInstance; class SupportingDocumentPage extends Page_1.default { /** * Initialize the SupportingDocumentPage * * @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 SupportingDocumentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SupportingDocumentInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SupportingDocumentPage = SupportingDocumentPage; rest/trusthub/v1/complianceRegistrationInquiries.js000064400000026011151677225100016671 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.ComplianceRegistrationInquiriesListInstance = exports.ComplianceRegistrationInquiriesInstance = exports.ComplianceRegistrationInquiriesContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class ComplianceRegistrationInquiriesContextImpl { constructor(_version, registrationId) { this._version = _version; if (!(0, utility_1.isValidPathParam)(registrationId)) { throw new Error("Parameter 'registrationId' is not valid."); } this._solution = { registrationId }; this._uri = `/ComplianceInquiries/Registration/${registrationId}/RegulatoryCompliance/GB/Initialize`; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["isIsvEmbed"] !== undefined) data["IsIsvEmbed"] = serialize.bool(params["isIsvEmbed"]); if (params["themeSetId"] !== undefined) data["ThemeSetId"] = params["themeSetId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ComplianceRegistrationInquiriesInstance(operationVersion, payload, instance._solution.registrationId)); 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.ComplianceRegistrationInquiriesContextImpl = ComplianceRegistrationInquiriesContextImpl; class ComplianceRegistrationInquiriesInstance { constructor(_version, payload, registrationId) { this._version = _version; this.inquiryId = payload.inquiry_id; this.inquirySessionToken = payload.inquiry_session_token; this.registrationId = payload.registration_id; this.url = payload.url; this._solution = { registrationId: registrationId || this.registrationId }; } get _proxy() { this._context = this._context || new ComplianceRegistrationInquiriesContextImpl(this._version, this._solution.registrationId); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { inquiryId: this.inquiryId, inquirySessionToken: this.inquirySessionToken, registrationId: this.registrationId, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ComplianceRegistrationInquiriesInstance = ComplianceRegistrationInquiriesInstance; function ComplianceRegistrationInquiriesListInstance(version) { const instance = ((registrationId) => instance.get(registrationId)); instance.get = function get(registrationId) { return new ComplianceRegistrationInquiriesContextImpl(version, registrationId); }; instance._version = version; instance._solution = {}; instance._uri = `/ComplianceInquiries/Registration/RegulatoryCompliance/GB/Initialize`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["endUserType"] === null || params["endUserType"] === undefined) { throw new Error("Required parameter \"params['endUserType']\" missing."); } if (params["phoneNumberType"] === null || params["phoneNumberType"] === undefined) { throw new Error("Required parameter \"params['phoneNumberType']\" missing."); } let data = {}; data["EndUserType"] = params["endUserType"]; data["PhoneNumberType"] = params["phoneNumberType"]; if (params["businessIdentityType"] !== undefined) data["BusinessIdentityType"] = params["businessIdentityType"]; if (params["businessRegistrationAuthority"] !== undefined) data["BusinessRegistrationAuthority"] = params["businessRegistrationAuthority"]; if (params["businessLegalName"] !== undefined) data["BusinessLegalName"] = params["businessLegalName"]; if (params["notificationEmail"] !== undefined) data["NotificationEmail"] = params["notificationEmail"]; if (params["acceptedNotificationReceipt"] !== undefined) data["AcceptedNotificationReceipt"] = serialize.bool(params["acceptedNotificationReceipt"]); if (params["businessRegistrationNumber"] !== undefined) data["BusinessRegistrationNumber"] = params["businessRegistrationNumber"]; if (params["businessWebsiteUrl"] !== undefined) data["BusinessWebsiteUrl"] = params["businessWebsiteUrl"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["authorizedRepresentative1FirstName"] !== undefined) data["AuthorizedRepresentative1FirstName"] = params["authorizedRepresentative1FirstName"]; if (params["authorizedRepresentative1LastName"] !== undefined) data["AuthorizedRepresentative1LastName"] = params["authorizedRepresentative1LastName"]; if (params["authorizedRepresentative1Phone"] !== undefined) data["AuthorizedRepresentative1Phone"] = params["authorizedRepresentative1Phone"]; if (params["authorizedRepresentative1Email"] !== undefined) data["AuthorizedRepresentative1Email"] = params["authorizedRepresentative1Email"]; if (params["authorizedRepresentative1DateOfBirth"] !== undefined) data["AuthorizedRepresentative1DateOfBirth"] = params["authorizedRepresentative1DateOfBirth"]; if (params["addressStreet"] !== undefined) data["AddressStreet"] = params["addressStreet"]; if (params["addressStreetSecondary"] !== undefined) data["AddressStreetSecondary"] = params["addressStreetSecondary"]; if (params["addressCity"] !== undefined) data["AddressCity"] = params["addressCity"]; if (params["addressSubdivision"] !== undefined) data["AddressSubdivision"] = params["addressSubdivision"]; if (params["addressPostalCode"] !== undefined) data["AddressPostalCode"] = params["addressPostalCode"]; if (params["addressCountryCode"] !== undefined) data["AddressCountryCode"] = params["addressCountryCode"]; if (params["emergencyAddressStreet"] !== undefined) data["EmergencyAddressStreet"] = params["emergencyAddressStreet"]; if (params["emergencyAddressStreetSecondary"] !== undefined) data["EmergencyAddressStreetSecondary"] = params["emergencyAddressStreetSecondary"]; if (params["emergencyAddressCity"] !== undefined) data["EmergencyAddressCity"] = params["emergencyAddressCity"]; if (params["emergencyAddressSubdivision"] !== undefined) data["EmergencyAddressSubdivision"] = params["emergencyAddressSubdivision"]; if (params["emergencyAddressPostalCode"] !== undefined) data["EmergencyAddressPostalCode"] = params["emergencyAddressPostalCode"]; if (params["emergencyAddressCountryCode"] !== undefined) data["EmergencyAddressCountryCode"] = params["emergencyAddressCountryCode"]; if (params["useAddressAsEmergencyAddress"] !== undefined) data["UseAddressAsEmergencyAddress"] = serialize.bool(params["useAddressAsEmergencyAddress"]); if (params["fileName"] !== undefined) data["FileName"] = params["fileName"]; if (params["file"] !== undefined) data["File"] = params["file"]; if (params["firstName"] !== undefined) data["FirstName"] = params["firstName"]; if (params["lastName"] !== undefined) data["LastName"] = params["lastName"]; if (params["dateOfBirth"] !== undefined) data["DateOfBirth"] = params["dateOfBirth"]; if (params["individualEmail"] !== undefined) data["IndividualEmail"] = params["individualEmail"]; if (params["individualPhone"] !== undefined) data["IndividualPhone"] = params["individualPhone"]; if (params["isIsvEmbed"] !== undefined) data["IsIsvEmbed"] = serialize.bool(params["isIsvEmbed"]); if (params["isvRegisteringForSelfOrTenant"] !== undefined) data["IsvRegisteringForSelfOrTenant"] = params["isvRegisteringForSelfOrTenant"]; if (params["statusCallbackUrl"] !== undefined) data["StatusCallbackUrl"] = params["statusCallbackUrl"]; if (params["themeSetId"] !== undefined) data["ThemeSetId"] = params["themeSetId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ComplianceRegistrationInquiriesInstance(operationVersion, payload)); 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; } exports.ComplianceRegistrationInquiriesListInstance = ComplianceRegistrationInquiriesListInstance; rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.js000064400000024056151677225100023137 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.TrustProductsChannelEndpointAssignmentPage = exports.TrustProductsChannelEndpointAssignmentListInstance = exports.TrustProductsChannelEndpointAssignmentInstance = exports.TrustProductsChannelEndpointAssignmentContextImpl = void 0; 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 TrustProductsChannelEndpointAssignmentContextImpl { constructor(_version, trustProductSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(trustProductSid)) { throw new Error("Parameter 'trustProductSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { trustProductSid, sid }; this._uri = `/TrustProducts/${trustProductSid}/ChannelEndpointAssignments/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TrustProductsChannelEndpointAssignmentInstance(operationVersion, payload, instance._solution.trustProductSid, 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.TrustProductsChannelEndpointAssignmentContextImpl = TrustProductsChannelEndpointAssignmentContextImpl; class TrustProductsChannelEndpointAssignmentInstance { constructor(_version, payload, trustProductSid, sid) { this._version = _version; this.sid = payload.sid; this.trustProductSid = payload.trust_product_sid; this.accountSid = payload.account_sid; this.channelEndpointType = payload.channel_endpoint_type; this.channelEndpointSid = payload.channel_endpoint_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { trustProductSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TrustProductsChannelEndpointAssignmentContextImpl(this._version, this._solution.trustProductSid, this._solution.sid); return this._context; } /** * Remove a TrustProductsChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TrustProductsChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, trustProductSid: this.trustProductSid, accountSid: this.accountSid, channelEndpointType: this.channelEndpointType, channelEndpointSid: this.channelEndpointSid, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrustProductsChannelEndpointAssignmentInstance = TrustProductsChannelEndpointAssignmentInstance; function TrustProductsChannelEndpointAssignmentListInstance(version, trustProductSid) { if (!(0, utility_1.isValidPathParam)(trustProductSid)) { throw new Error("Parameter 'trustProductSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TrustProductsChannelEndpointAssignmentContextImpl(version, trustProductSid, sid); }; instance._version = version; instance._solution = { trustProductSid }; instance._uri = `/TrustProducts/${trustProductSid}/ChannelEndpointAssignments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["channelEndpointType"] === null || params["channelEndpointType"] === undefined) { throw new Error("Required parameter \"params['channelEndpointType']\" missing."); } if (params["channelEndpointSid"] === null || params["channelEndpointSid"] === undefined) { throw new Error("Required parameter \"params['channelEndpointSid']\" missing."); } let data = {}; data["ChannelEndpointType"] = params["channelEndpointType"]; data["ChannelEndpointSid"] = params["channelEndpointSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TrustProductsChannelEndpointAssignmentInstance(operationVersion, payload, instance._solution.trustProductSid)); 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["channelEndpointSid"] !== undefined) data["ChannelEndpointSid"] = params["channelEndpointSid"]; if (params["channelEndpointSids"] !== undefined) data["ChannelEndpointSids"] = params["channelEndpointSids"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TrustProductsChannelEndpointAssignmentPage(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 TrustProductsChannelEndpointAssignmentPage(instance._version, payload, 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; } exports.TrustProductsChannelEndpointAssignmentListInstance = TrustProductsChannelEndpointAssignmentListInstance; class TrustProductsChannelEndpointAssignmentPage extends Page_1.default { /** * Initialize the TrustProductsChannelEndpointAssignmentPage * * @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 TrustProductsChannelEndpointAssignmentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TrustProductsChannelEndpointAssignmentInstance(this._version, payload, this._solution.trustProductSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrustProductsChannelEndpointAssignmentPage = TrustProductsChannelEndpointAssignmentPage; rest/trusthub/v1/trustProducts/trustProductsEvaluations.d.ts000064400000023664151677225100020567 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type TrustProductsEvaluationsStatus = "compliant" | "noncompliant"; /** * Options to pass to create a TrustProductsEvaluationsInstance */ export interface TrustProductsEvaluationsListInstanceCreateOptions { /** The unique string of a policy that is associated to the customer_profile resource. */ policySid: string; } /** * Options to pass to each */ export interface TrustProductsEvaluationsListInstanceEachOptions { /** 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: TrustProductsEvaluationsInstance, 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 TrustProductsEvaluationsListInstanceOptions { /** 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 TrustProductsEvaluationsListInstancePageOptions { /** 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 TrustProductsEvaluationsContext { /** * Fetch a TrustProductsEvaluationsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsEvaluationsInstance */ fetch(callback?: (error: Error | null, item?: TrustProductsEvaluationsInstance) => any): Promise<TrustProductsEvaluationsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TrustProductsEvaluationsContextSolution { trustProductSid: string; sid: string; } export declare class TrustProductsEvaluationsContextImpl implements TrustProductsEvaluationsContext { protected _version: V1; protected _solution: TrustProductsEvaluationsContextSolution; protected _uri: string; constructor(_version: V1, trustProductSid: string, sid: string); fetch(callback?: (error: Error | null, item?: TrustProductsEvaluationsInstance) => any): Promise<TrustProductsEvaluationsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TrustProductsEvaluationsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TrustProductsEvaluationsPayload extends TwilioResponsePayload { results: TrustProductsEvaluationsResource[]; } interface TrustProductsEvaluationsResource { sid: string; account_sid: string; policy_sid: string; trust_product_sid: string; status: TrustProductsEvaluationsStatus; results: Array<any>; date_created: Date; url: string; } export declare class TrustProductsEvaluationsInstance { protected _version: V1; protected _solution: TrustProductsEvaluationsContextSolution; protected _context?: TrustProductsEvaluationsContext; constructor(_version: V1, payload: TrustProductsEvaluationsResource, trustProductSid: string, sid?: string); /** * The unique string that identifies the Evaluation resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the trust_product resource. */ accountSid: string; /** * The unique string of a policy that is associated to the trust_product resource. */ policySid: string; /** * The unique string that we created to identify the trust_product resource. */ trustProductSid: string; status: TrustProductsEvaluationsStatus; /** * The results of the Evaluation which includes the valid and invalid attributes. */ results: Array<any>; dateCreated: Date; url: string; private get _proxy(); /** * Fetch a TrustProductsEvaluationsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsEvaluationsInstance */ fetch(callback?: (error: Error | null, item?: TrustProductsEvaluationsInstance) => any): Promise<TrustProductsEvaluationsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; policySid: string; trustProductSid: string; status: TrustProductsEvaluationsStatus; results: any[]; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TrustProductsEvaluationsSolution { trustProductSid: string; } export interface TrustProductsEvaluationsListInstance { _version: V1; _solution: TrustProductsEvaluationsSolution; _uri: string; (sid: string): TrustProductsEvaluationsContext; get(sid: string): TrustProductsEvaluationsContext; /** * Create a TrustProductsEvaluationsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsEvaluationsInstance */ create(params: TrustProductsEvaluationsListInstanceCreateOptions, callback?: (error: Error | null, item?: TrustProductsEvaluationsInstance) => any): Promise<TrustProductsEvaluationsInstance>; /** * Streams TrustProductsEvaluationsInstance 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 { TrustProductsEvaluationsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TrustProductsEvaluationsInstance, done: (err?: Error) => void) => void): void; each(params: TrustProductsEvaluationsListInstanceEachOptions, callback?: (item: TrustProductsEvaluationsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TrustProductsEvaluationsInstance 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: TrustProductsEvaluationsPage) => any): Promise<TrustProductsEvaluationsPage>; /** * Lists TrustProductsEvaluationsInstance 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 { TrustProductsEvaluationsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TrustProductsEvaluationsInstance[]) => any): Promise<TrustProductsEvaluationsInstance[]>; list(params: TrustProductsEvaluationsListInstanceOptions, callback?: (error: Error | null, items: TrustProductsEvaluationsInstance[]) => any): Promise<TrustProductsEvaluationsInstance[]>; /** * Retrieve a single page of TrustProductsEvaluationsInstance 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 { TrustProductsEvaluationsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TrustProductsEvaluationsPage) => any): Promise<TrustProductsEvaluationsPage>; page(params: TrustProductsEvaluationsListInstancePageOptions, callback?: (error: Error | null, items: TrustProductsEvaluationsPage) => any): Promise<TrustProductsEvaluationsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TrustProductsEvaluationsListInstance(version: V1, trustProductSid: string): TrustProductsEvaluationsListInstance; export declare class TrustProductsEvaluationsPage extends Page<V1, TrustProductsEvaluationsPayload, TrustProductsEvaluationsResource, TrustProductsEvaluationsInstance> { /** * Initialize the TrustProductsEvaluationsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TrustProductsEvaluationsSolution); /** * Build an instance of TrustProductsEvaluationsInstance * * @param payload - Payload response from the API */ getInstance(payload: TrustProductsEvaluationsResource): TrustProductsEvaluationsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/trustProducts/trustProductsChannelEndpointAssignment.d.ts000064400000030137151677225100023370 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a TrustProductsChannelEndpointAssignmentInstance */ export interface TrustProductsChannelEndpointAssignmentListInstanceCreateOptions { /** The type of channel endpoint. eg: phone-number */ channelEndpointType: string; /** The SID of an channel endpoint */ channelEndpointSid: string; } /** * Options to pass to each */ export interface TrustProductsChannelEndpointAssignmentListInstanceEachOptions { /** The SID of an channel endpoint */ channelEndpointSid?: string; /** comma separated list of channel endpoint sids */ channelEndpointSids?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: TrustProductsChannelEndpointAssignmentInstance, 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 TrustProductsChannelEndpointAssignmentListInstanceOptions { /** The SID of an channel endpoint */ channelEndpointSid?: string; /** comma separated list of channel endpoint sids */ channelEndpointSids?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface TrustProductsChannelEndpointAssignmentListInstancePageOptions { /** The SID of an channel endpoint */ channelEndpointSid?: string; /** comma separated list of channel endpoint sids */ channelEndpointSids?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface TrustProductsChannelEndpointAssignmentContext { /** * Remove a TrustProductsChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TrustProductsChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance */ fetch(callback?: (error: Error | null, item?: TrustProductsChannelEndpointAssignmentInstance) => any): Promise<TrustProductsChannelEndpointAssignmentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TrustProductsChannelEndpointAssignmentContextSolution { trustProductSid: string; sid: string; } export declare class TrustProductsChannelEndpointAssignmentContextImpl implements TrustProductsChannelEndpointAssignmentContext { protected _version: V1; protected _solution: TrustProductsChannelEndpointAssignmentContextSolution; protected _uri: string; constructor(_version: V1, trustProductSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TrustProductsChannelEndpointAssignmentInstance) => any): Promise<TrustProductsChannelEndpointAssignmentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TrustProductsChannelEndpointAssignmentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TrustProductsChannelEndpointAssignmentPayload extends TwilioResponsePayload { results: TrustProductsChannelEndpointAssignmentResource[]; } interface TrustProductsChannelEndpointAssignmentResource { sid: string; trust_product_sid: string; account_sid: string; channel_endpoint_type: string; channel_endpoint_sid: string; date_created: Date; url: string; } export declare class TrustProductsChannelEndpointAssignmentInstance { protected _version: V1; protected _solution: TrustProductsChannelEndpointAssignmentContextSolution; protected _context?: TrustProductsChannelEndpointAssignmentContext; constructor(_version: V1, payload: TrustProductsChannelEndpointAssignmentResource, trustProductSid: string, sid?: string); /** * The unique string that we created to identify the Item Assignment resource. */ sid: string; /** * The unique string that we created to identify the CustomerProfile resource. */ trustProductSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. */ accountSid: string; /** * The type of channel endpoint. eg: phone-number */ channelEndpointType: string; /** * The SID of an channel endpoint */ channelEndpointSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Identity resource. */ url: string; private get _proxy(); /** * Remove a TrustProductsChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TrustProductsChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance */ fetch(callback?: (error: Error | null, item?: TrustProductsChannelEndpointAssignmentInstance) => any): Promise<TrustProductsChannelEndpointAssignmentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; trustProductSid: string; accountSid: string; channelEndpointType: string; channelEndpointSid: string; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TrustProductsChannelEndpointAssignmentSolution { trustProductSid: string; } export interface TrustProductsChannelEndpointAssignmentListInstance { _version: V1; _solution: TrustProductsChannelEndpointAssignmentSolution; _uri: string; (sid: string): TrustProductsChannelEndpointAssignmentContext; get(sid: string): TrustProductsChannelEndpointAssignmentContext; /** * Create a TrustProductsChannelEndpointAssignmentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsChannelEndpointAssignmentInstance */ create(params: TrustProductsChannelEndpointAssignmentListInstanceCreateOptions, callback?: (error: Error | null, item?: TrustProductsChannelEndpointAssignmentInstance) => any): Promise<TrustProductsChannelEndpointAssignmentInstance>; /** * Streams TrustProductsChannelEndpointAssignmentInstance 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 { TrustProductsChannelEndpointAssignmentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TrustProductsChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void; each(params: TrustProductsChannelEndpointAssignmentListInstanceEachOptions, callback?: (item: TrustProductsChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TrustProductsChannelEndpointAssignmentInstance 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: TrustProductsChannelEndpointAssignmentPage) => any): Promise<TrustProductsChannelEndpointAssignmentPage>; /** * Lists TrustProductsChannelEndpointAssignmentInstance 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 { TrustProductsChannelEndpointAssignmentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TrustProductsChannelEndpointAssignmentInstance[]) => any): Promise<TrustProductsChannelEndpointAssignmentInstance[]>; list(params: TrustProductsChannelEndpointAssignmentListInstanceOptions, callback?: (error: Error | null, items: TrustProductsChannelEndpointAssignmentInstance[]) => any): Promise<TrustProductsChannelEndpointAssignmentInstance[]>; /** * Retrieve a single page of TrustProductsChannelEndpointAssignmentInstance 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 { TrustProductsChannelEndpointAssignmentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TrustProductsChannelEndpointAssignmentPage) => any): Promise<TrustProductsChannelEndpointAssignmentPage>; page(params: TrustProductsChannelEndpointAssignmentListInstancePageOptions, callback?: (error: Error | null, items: TrustProductsChannelEndpointAssignmentPage) => any): Promise<TrustProductsChannelEndpointAssignmentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TrustProductsChannelEndpointAssignmentListInstance(version: V1, trustProductSid: string): TrustProductsChannelEndpointAssignmentListInstance; export declare class TrustProductsChannelEndpointAssignmentPage extends Page<V1, TrustProductsChannelEndpointAssignmentPayload, TrustProductsChannelEndpointAssignmentResource, TrustProductsChannelEndpointAssignmentInstance> { /** * Initialize the TrustProductsChannelEndpointAssignmentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TrustProductsChannelEndpointAssignmentSolution); /** * Build an instance of TrustProductsChannelEndpointAssignmentInstance * * @param payload - Payload response from the API */ getInstance(payload: TrustProductsChannelEndpointAssignmentResource): TrustProductsChannelEndpointAssignmentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/trustProducts/trustProductsEvaluations.js000064400000020671151677225100020326 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.TrustProductsEvaluationsPage = exports.TrustProductsEvaluationsListInstance = exports.TrustProductsEvaluationsInstance = exports.TrustProductsEvaluationsContextImpl = void 0; 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 TrustProductsEvaluationsContextImpl { constructor(_version, trustProductSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(trustProductSid)) { throw new Error("Parameter 'trustProductSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { trustProductSid, sid }; this._uri = `/TrustProducts/${trustProductSid}/Evaluations/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TrustProductsEvaluationsInstance(operationVersion, payload, instance._solution.trustProductSid, 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.TrustProductsEvaluationsContextImpl = TrustProductsEvaluationsContextImpl; class TrustProductsEvaluationsInstance { constructor(_version, payload, trustProductSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.policySid = payload.policy_sid; this.trustProductSid = payload.trust_product_sid; this.status = payload.status; this.results = payload.results; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { trustProductSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TrustProductsEvaluationsContextImpl(this._version, this._solution.trustProductSid, this._solution.sid); return this._context; } /** * Fetch a TrustProductsEvaluationsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsEvaluationsInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, policySid: this.policySid, trustProductSid: this.trustProductSid, status: this.status, results: this.results, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrustProductsEvaluationsInstance = TrustProductsEvaluationsInstance; function TrustProductsEvaluationsListInstance(version, trustProductSid) { if (!(0, utility_1.isValidPathParam)(trustProductSid)) { throw new Error("Parameter 'trustProductSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TrustProductsEvaluationsContextImpl(version, trustProductSid, sid); }; instance._version = version; instance._solution = { trustProductSid }; instance._uri = `/TrustProducts/${trustProductSid}/Evaluations`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["policySid"] === null || params["policySid"] === undefined) { throw new Error("Required parameter \"params['policySid']\" missing."); } let data = {}; data["PolicySid"] = params["policySid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TrustProductsEvaluationsInstance(operationVersion, payload, instance._solution.trustProductSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TrustProductsEvaluationsPage(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 TrustProductsEvaluationsPage(instance._version, payload, 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; } exports.TrustProductsEvaluationsListInstance = TrustProductsEvaluationsListInstance; class TrustProductsEvaluationsPage extends Page_1.default { /** * Initialize the TrustProductsEvaluationsPage * * @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 TrustProductsEvaluationsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TrustProductsEvaluationsInstance(this._version, payload, this._solution.trustProductSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrustProductsEvaluationsPage = TrustProductsEvaluationsPage; rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.js000064400000022251151677225100021520 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.TrustProductsEntityAssignmentsPage = exports.TrustProductsEntityAssignmentsListInstance = exports.TrustProductsEntityAssignmentsInstance = exports.TrustProductsEntityAssignmentsContextImpl = void 0; 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 TrustProductsEntityAssignmentsContextImpl { constructor(_version, trustProductSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(trustProductSid)) { throw new Error("Parameter 'trustProductSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { trustProductSid, sid }; this._uri = `/TrustProducts/${trustProductSid}/EntityAssignments/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TrustProductsEntityAssignmentsInstance(operationVersion, payload, instance._solution.trustProductSid, 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.TrustProductsEntityAssignmentsContextImpl = TrustProductsEntityAssignmentsContextImpl; class TrustProductsEntityAssignmentsInstance { constructor(_version, payload, trustProductSid, sid) { this._version = _version; this.sid = payload.sid; this.trustProductSid = payload.trust_product_sid; this.accountSid = payload.account_sid; this.objectSid = payload.object_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { trustProductSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TrustProductsEntityAssignmentsContextImpl(this._version, this._solution.trustProductSid, this._solution.sid); return this._context; } /** * Remove a TrustProductsEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TrustProductsEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsEntityAssignmentsInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, trustProductSid: this.trustProductSid, accountSid: this.accountSid, objectSid: this.objectSid, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrustProductsEntityAssignmentsInstance = TrustProductsEntityAssignmentsInstance; function TrustProductsEntityAssignmentsListInstance(version, trustProductSid) { if (!(0, utility_1.isValidPathParam)(trustProductSid)) { throw new Error("Parameter 'trustProductSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TrustProductsEntityAssignmentsContextImpl(version, trustProductSid, sid); }; instance._version = version; instance._solution = { trustProductSid }; instance._uri = `/TrustProducts/${trustProductSid}/EntityAssignments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["objectSid"] === null || params["objectSid"] === undefined) { throw new Error("Required parameter \"params['objectSid']\" missing."); } let data = {}; data["ObjectSid"] = params["objectSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TrustProductsEntityAssignmentsInstance(operationVersion, payload, instance._solution.trustProductSid)); 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["objectType"] !== undefined) data["ObjectType"] = params["objectType"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TrustProductsEntityAssignmentsPage(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 TrustProductsEntityAssignmentsPage(instance._version, payload, 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; } exports.TrustProductsEntityAssignmentsListInstance = TrustProductsEntityAssignmentsListInstance; class TrustProductsEntityAssignmentsPage extends Page_1.default { /** * Initialize the TrustProductsEntityAssignmentsPage * * @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 TrustProductsEntityAssignmentsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TrustProductsEntityAssignmentsInstance(this._version, payload, this._solution.trustProductSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrustProductsEntityAssignmentsPage = TrustProductsEntityAssignmentsPage; rest/trusthub/v1/trustProducts/trustProductsEntityAssignments.d.ts000064400000026773151677225100021771 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a TrustProductsEntityAssignmentsInstance */ export interface TrustProductsEntityAssignmentsListInstanceCreateOptions { /** The SID of an object bag that holds information of the different items. */ objectSid: string; } /** * Options to pass to each */ export interface TrustProductsEntityAssignmentsListInstanceEachOptions { /** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */ objectType?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: TrustProductsEntityAssignmentsInstance, 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 TrustProductsEntityAssignmentsListInstanceOptions { /** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */ objectType?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface TrustProductsEntityAssignmentsListInstancePageOptions { /** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */ objectType?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface TrustProductsEntityAssignmentsContext { /** * Remove a TrustProductsEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TrustProductsEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsEntityAssignmentsInstance */ fetch(callback?: (error: Error | null, item?: TrustProductsEntityAssignmentsInstance) => any): Promise<TrustProductsEntityAssignmentsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TrustProductsEntityAssignmentsContextSolution { trustProductSid: string; sid: string; } export declare class TrustProductsEntityAssignmentsContextImpl implements TrustProductsEntityAssignmentsContext { protected _version: V1; protected _solution: TrustProductsEntityAssignmentsContextSolution; protected _uri: string; constructor(_version: V1, trustProductSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TrustProductsEntityAssignmentsInstance) => any): Promise<TrustProductsEntityAssignmentsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TrustProductsEntityAssignmentsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TrustProductsEntityAssignmentsPayload extends TwilioResponsePayload { results: TrustProductsEntityAssignmentsResource[]; } interface TrustProductsEntityAssignmentsResource { sid: string; trust_product_sid: string; account_sid: string; object_sid: string; date_created: Date; url: string; } export declare class TrustProductsEntityAssignmentsInstance { protected _version: V1; protected _solution: TrustProductsEntityAssignmentsContextSolution; protected _context?: TrustProductsEntityAssignmentsContext; constructor(_version: V1, payload: TrustProductsEntityAssignmentsResource, trustProductSid: string, sid?: string); /** * The unique string that we created to identify the Item Assignment resource. */ sid: string; /** * The unique string that we created to identify the TrustProduct resource. */ trustProductSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. */ accountSid: string; /** * The SID of an object bag that holds information of the different items. */ objectSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Identity resource. */ url: string; private get _proxy(); /** * Remove a TrustProductsEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TrustProductsEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsEntityAssignmentsInstance */ fetch(callback?: (error: Error | null, item?: TrustProductsEntityAssignmentsInstance) => any): Promise<TrustProductsEntityAssignmentsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; trustProductSid: string; accountSid: string; objectSid: string; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TrustProductsEntityAssignmentsSolution { trustProductSid: string; } export interface TrustProductsEntityAssignmentsListInstance { _version: V1; _solution: TrustProductsEntityAssignmentsSolution; _uri: string; (sid: string): TrustProductsEntityAssignmentsContext; get(sid: string): TrustProductsEntityAssignmentsContext; /** * Create a TrustProductsEntityAssignmentsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsEntityAssignmentsInstance */ create(params: TrustProductsEntityAssignmentsListInstanceCreateOptions, callback?: (error: Error | null, item?: TrustProductsEntityAssignmentsInstance) => any): Promise<TrustProductsEntityAssignmentsInstance>; /** * Streams TrustProductsEntityAssignmentsInstance 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 { TrustProductsEntityAssignmentsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TrustProductsEntityAssignmentsInstance, done: (err?: Error) => void) => void): void; each(params: TrustProductsEntityAssignmentsListInstanceEachOptions, callback?: (item: TrustProductsEntityAssignmentsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TrustProductsEntityAssignmentsInstance 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: TrustProductsEntityAssignmentsPage) => any): Promise<TrustProductsEntityAssignmentsPage>; /** * Lists TrustProductsEntityAssignmentsInstance 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 { TrustProductsEntityAssignmentsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TrustProductsEntityAssignmentsInstance[]) => any): Promise<TrustProductsEntityAssignmentsInstance[]>; list(params: TrustProductsEntityAssignmentsListInstanceOptions, callback?: (error: Error | null, items: TrustProductsEntityAssignmentsInstance[]) => any): Promise<TrustProductsEntityAssignmentsInstance[]>; /** * Retrieve a single page of TrustProductsEntityAssignmentsInstance 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 { TrustProductsEntityAssignmentsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TrustProductsEntityAssignmentsPage) => any): Promise<TrustProductsEntityAssignmentsPage>; page(params: TrustProductsEntityAssignmentsListInstancePageOptions, callback?: (error: Error | null, items: TrustProductsEntityAssignmentsPage) => any): Promise<TrustProductsEntityAssignmentsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TrustProductsEntityAssignmentsListInstance(version: V1, trustProductSid: string): TrustProductsEntityAssignmentsListInstance; export declare class TrustProductsEntityAssignmentsPage extends Page<V1, TrustProductsEntityAssignmentsPayload, TrustProductsEntityAssignmentsResource, TrustProductsEntityAssignmentsInstance> { /** * Initialize the TrustProductsEntityAssignmentsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: TrustProductsEntityAssignmentsSolution); /** * Build an instance of TrustProductsEntityAssignmentsInstance * * @param payload - Payload response from the API */ getInstance(payload: TrustProductsEntityAssignmentsResource): TrustProductsEntityAssignmentsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/policies.d.ts000064400000017000151677225100012334 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface PoliciesListInstanceEachOptions { /** 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: PoliciesInstance, 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 PoliciesListInstanceOptions { /** 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 PoliciesListInstancePageOptions { /** 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 PoliciesContext { /** * Fetch a PoliciesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PoliciesInstance */ fetch(callback?: (error: Error | null, item?: PoliciesInstance) => any): Promise<PoliciesInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PoliciesContextSolution { sid: string; } export declare class PoliciesContextImpl implements PoliciesContext { protected _version: V1; protected _solution: PoliciesContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: PoliciesInstance) => any): Promise<PoliciesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PoliciesContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PoliciesPayload extends TwilioResponsePayload { results: PoliciesResource[]; } interface PoliciesResource { sid: string; friendly_name: string; requirements: any; url: string; } export declare class PoliciesInstance { protected _version: V1; protected _solution: PoliciesContextSolution; protected _context?: PoliciesContext; constructor(_version: V1, payload: PoliciesResource, sid?: string); /** * The unique string that identifies the Policy resource. */ sid: string; /** * A human-readable description that is assigned to describe the Policy resource. Examples can include Primary Customer profile policy */ friendlyName: string; /** * The SID of an object that holds the policy information */ requirements: any; /** * The absolute URL of the Policy resource. */ url: string; private get _proxy(); /** * Fetch a PoliciesInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PoliciesInstance */ fetch(callback?: (error: Error | null, item?: PoliciesInstance) => any): Promise<PoliciesInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; requirements: any; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PoliciesSolution { } export interface PoliciesListInstance { _version: V1; _solution: PoliciesSolution; _uri: string; (sid: string): PoliciesContext; get(sid: string): PoliciesContext; /** * Streams PoliciesInstance 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 { PoliciesListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PoliciesInstance, done: (err?: Error) => void) => void): void; each(params: PoliciesListInstanceEachOptions, callback?: (item: PoliciesInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PoliciesInstance 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: PoliciesPage) => any): Promise<PoliciesPage>; /** * Lists PoliciesInstance 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 { PoliciesListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PoliciesInstance[]) => any): Promise<PoliciesInstance[]>; list(params: PoliciesListInstanceOptions, callback?: (error: Error | null, items: PoliciesInstance[]) => any): Promise<PoliciesInstance[]>; /** * Retrieve a single page of PoliciesInstance 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 { PoliciesListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PoliciesPage) => any): Promise<PoliciesPage>; page(params: PoliciesListInstancePageOptions, callback?: (error: Error | null, items: PoliciesPage) => any): Promise<PoliciesPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PoliciesListInstance(version: V1): PoliciesListInstance; export declare class PoliciesPage extends Page<V1, PoliciesPayload, PoliciesResource, PoliciesInstance> { /** * Initialize the PoliciesPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: PoliciesSolution); /** * Build an instance of PoliciesInstance * * @param payload - Payload response from the API */ getInstance(payload: PoliciesResource): PoliciesInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/supportingDocumentType.js000064400000015056151677225100015055 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.SupportingDocumentTypePage = exports.SupportingDocumentTypeListInstance = exports.SupportingDocumentTypeInstance = exports.SupportingDocumentTypeContextImpl = void 0; 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 SupportingDocumentTypeContextImpl { 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 = `/SupportingDocumentTypes/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SupportingDocumentTypeInstance(operationVersion, payload, 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.SupportingDocumentTypeContextImpl = SupportingDocumentTypeContextImpl; class SupportingDocumentTypeInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.machineName = payload.machine_name; this.fields = payload.fields; this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SupportingDocumentTypeContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a SupportingDocumentTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentTypeInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, friendlyName: this.friendlyName, machineName: this.machineName, fields: this.fields, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SupportingDocumentTypeInstance = SupportingDocumentTypeInstance; function SupportingDocumentTypeListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SupportingDocumentTypeContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/SupportingDocumentTypes`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SupportingDocumentTypePage(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 SupportingDocumentTypePage(instance._version, payload, 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; } exports.SupportingDocumentTypeListInstance = SupportingDocumentTypeListInstance; class SupportingDocumentTypePage extends Page_1.default { /** * Initialize the SupportingDocumentTypePage * * @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 SupportingDocumentTypeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SupportingDocumentTypeInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SupportingDocumentTypePage = SupportingDocumentTypePage; rest/trusthub/v1/trustProducts.js000064400000031014151677225100013177 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.TrustProductsPage = exports.TrustProductsListInstance = exports.TrustProductsInstance = exports.TrustProductsContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const trustProductsChannelEndpointAssignment_1 = require("./trustProducts/trustProductsChannelEndpointAssignment"); const trustProductsEntityAssignments_1 = require("./trustProducts/trustProductsEntityAssignments"); const trustProductsEvaluations_1 = require("./trustProducts/trustProductsEvaluations"); class TrustProductsContextImpl { 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 = `/TrustProducts/${sid}`; } get trustProductsChannelEndpointAssignment() { this._trustProductsChannelEndpointAssignment = this._trustProductsChannelEndpointAssignment || (0, trustProductsChannelEndpointAssignment_1.TrustProductsChannelEndpointAssignmentListInstance)(this._version, this._solution.sid); return this._trustProductsChannelEndpointAssignment; } get trustProductsEntityAssignments() { this._trustProductsEntityAssignments = this._trustProductsEntityAssignments || (0, trustProductsEntityAssignments_1.TrustProductsEntityAssignmentsListInstance)(this._version, this._solution.sid); return this._trustProductsEntityAssignments; } get trustProductsEvaluations() { this._trustProductsEvaluations = this._trustProductsEvaluations || (0, trustProductsEvaluations_1.TrustProductsEvaluationsListInstance)(this._version, this._solution.sid); return this._trustProductsEvaluations; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TrustProductsInstance(operationVersion, payload, 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["status"] !== undefined) data["Status"] = params["status"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["email"] !== undefined) data["Email"] = params["email"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TrustProductsInstance(operationVersion, payload, 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.TrustProductsContextImpl = TrustProductsContextImpl; class TrustProductsInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.policySid = payload.policy_sid; this.friendlyName = payload.friendly_name; this.status = payload.status; this.validUntil = deserialize.iso8601DateTime(payload.valid_until); this.email = payload.email; this.statusCallback = payload.status_callback; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this.errors = payload.errors; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TrustProductsContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a TrustProductsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TrustProductsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TrustProductsInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the trustProductsChannelEndpointAssignment. */ trustProductsChannelEndpointAssignment() { return this._proxy.trustProductsChannelEndpointAssignment; } /** * Access the trustProductsEntityAssignments. */ trustProductsEntityAssignments() { return this._proxy.trustProductsEntityAssignments; } /** * Access the trustProductsEvaluations. */ trustProductsEvaluations() { return this._proxy.trustProductsEvaluations; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, policySid: this.policySid, friendlyName: this.friendlyName, status: this.status, validUntil: this.validUntil, email: this.email, statusCallback: this.statusCallback, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, errors: this.errors, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrustProductsInstance = TrustProductsInstance; function TrustProductsListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TrustProductsContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/TrustProducts`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["email"] === null || params["email"] === undefined) { throw new Error("Required parameter \"params['email']\" missing."); } if (params["policySid"] === null || params["policySid"] === undefined) { throw new Error("Required parameter \"params['policySid']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Email"] = params["email"]; data["PolicySid"] = params["policySid"]; if (params["statusCallback"] !== undefined) data["StatusCallback"] = params["statusCallback"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TrustProductsInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["policySid"] !== undefined) data["PolicySid"] = params["policySid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TrustProductsPage(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 TrustProductsPage(instance._version, payload, 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; } exports.TrustProductsListInstance = TrustProductsListInstance; class TrustProductsPage extends Page_1.default { /** * Initialize the TrustProductsPage * * @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 TrustProductsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TrustProductsInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TrustProductsPage = TrustProductsPage; rest/trusthub/v1/supportingDocument.d.ts000064400000031531151677225100014443 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type SupportingDocumentStatus = "draft" | "pending-review" | "rejected" | "approved" | "expired" | "provisionally-approved"; /** * Options to pass to update a SupportingDocumentInstance */ export interface SupportingDocumentContextUpdateOptions { /** The string that you assigned to describe the resource. */ friendlyName?: string; /** The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types. */ attributes?: any; } /** * Options to pass to create a SupportingDocumentInstance */ export interface SupportingDocumentListInstanceCreateOptions { /** The string that you assigned to describe the resource. */ friendlyName: string; /** The type of the Supporting Document. */ type: string; /** The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types. */ attributes?: any; } /** * Options to pass to each */ export interface SupportingDocumentListInstanceEachOptions { /** 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: SupportingDocumentInstance, 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 SupportingDocumentListInstanceOptions { /** 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 SupportingDocumentListInstancePageOptions { /** 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 SupportingDocumentContext { /** * Remove a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ fetch(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Update a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ update(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Update a SupportingDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ update(params: SupportingDocumentContextUpdateOptions, callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SupportingDocumentContextSolution { sid: string; } export declare class SupportingDocumentContextImpl implements SupportingDocumentContext { protected _version: V1; protected _solution: SupportingDocumentContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; update(params?: SupportingDocumentContextUpdateOptions | ((error: Error | null, item?: SupportingDocumentInstance) => any), callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SupportingDocumentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SupportingDocumentPayload extends TwilioResponsePayload { results: SupportingDocumentResource[]; } interface SupportingDocumentResource { sid: string; account_sid: string; friendly_name: string; mime_type: string; status: SupportingDocumentStatus; type: string; attributes: any; date_created: Date; date_updated: Date; url: string; } export declare class SupportingDocumentInstance { protected _version: V1; protected _solution: SupportingDocumentContextSolution; protected _context?: SupportingDocumentContext; constructor(_version: V1, payload: SupportingDocumentResource, sid?: string); /** * The unique string created by Twilio to identify the Supporting Document resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * The image type uploaded in the Supporting Document container. */ mimeType: string; status: SupportingDocumentStatus; /** * The type of the Supporting Document. */ type: string; /** * The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. */ attributes: any; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateUpdated: Date; /** * The absolute URL of the Supporting Document resource. */ url: string; private get _proxy(); /** * Remove a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ fetch(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Update a SupportingDocumentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ update(callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Update a SupportingDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ update(params: SupportingDocumentContextUpdateOptions, callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; friendlyName: string; mimeType: string; status: SupportingDocumentStatus; type: string; attributes: any; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SupportingDocumentSolution { } export interface SupportingDocumentListInstance { _version: V1; _solution: SupportingDocumentSolution; _uri: string; (sid: string): SupportingDocumentContext; get(sid: string): SupportingDocumentContext; /** * Create a SupportingDocumentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SupportingDocumentInstance */ create(params: SupportingDocumentListInstanceCreateOptions, callback?: (error: Error | null, item?: SupportingDocumentInstance) => any): Promise<SupportingDocumentInstance>; /** * Streams SupportingDocumentInstance 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 { SupportingDocumentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SupportingDocumentInstance, done: (err?: Error) => void) => void): void; each(params: SupportingDocumentListInstanceEachOptions, callback?: (item: SupportingDocumentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SupportingDocumentInstance 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: SupportingDocumentPage) => any): Promise<SupportingDocumentPage>; /** * Lists SupportingDocumentInstance 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 { SupportingDocumentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SupportingDocumentInstance[]) => any): Promise<SupportingDocumentInstance[]>; list(params: SupportingDocumentListInstanceOptions, callback?: (error: Error | null, items: SupportingDocumentInstance[]) => any): Promise<SupportingDocumentInstance[]>; /** * Retrieve a single page of SupportingDocumentInstance 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 { SupportingDocumentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SupportingDocumentPage) => any): Promise<SupportingDocumentPage>; page(params: SupportingDocumentListInstancePageOptions, callback?: (error: Error | null, items: SupportingDocumentPage) => any): Promise<SupportingDocumentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SupportingDocumentListInstance(version: V1): SupportingDocumentListInstance; export declare class SupportingDocumentPage extends Page<V1, SupportingDocumentPayload, SupportingDocumentResource, SupportingDocumentInstance> { /** * Initialize the SupportingDocumentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SupportingDocumentSolution); /** * Build an instance of SupportingDocumentInstance * * @param payload - Payload response from the API */ getInstance(payload: SupportingDocumentResource): SupportingDocumentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.d.ts000064400000030525151677225100024471 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a CustomerProfilesChannelEndpointAssignmentInstance */ export interface CustomerProfilesChannelEndpointAssignmentListInstanceCreateOptions { /** The type of channel endpoint. eg: phone-number */ channelEndpointType: string; /** The SID of an channel endpoint */ channelEndpointSid: string; } /** * Options to pass to each */ export interface CustomerProfilesChannelEndpointAssignmentListInstanceEachOptions { /** The SID of an channel endpoint */ channelEndpointSid?: string; /** comma separated list of channel endpoint sids */ channelEndpointSids?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CustomerProfilesChannelEndpointAssignmentInstance, 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 CustomerProfilesChannelEndpointAssignmentListInstanceOptions { /** The SID of an channel endpoint */ channelEndpointSid?: string; /** comma separated list of channel endpoint sids */ channelEndpointSids?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CustomerProfilesChannelEndpointAssignmentListInstancePageOptions { /** The SID of an channel endpoint */ channelEndpointSid?: string; /** comma separated list of channel endpoint sids */ channelEndpointSids?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CustomerProfilesChannelEndpointAssignmentContext { /** * Remove a CustomerProfilesChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CustomerProfilesChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance */ fetch(callback?: (error: Error | null, item?: CustomerProfilesChannelEndpointAssignmentInstance) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CustomerProfilesChannelEndpointAssignmentContextSolution { customerProfileSid: string; sid: string; } export declare class CustomerProfilesChannelEndpointAssignmentContextImpl implements CustomerProfilesChannelEndpointAssignmentContext { protected _version: V1; protected _solution: CustomerProfilesChannelEndpointAssignmentContextSolution; protected _uri: string; constructor(_version: V1, customerProfileSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CustomerProfilesChannelEndpointAssignmentInstance) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CustomerProfilesChannelEndpointAssignmentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CustomerProfilesChannelEndpointAssignmentPayload extends TwilioResponsePayload { results: CustomerProfilesChannelEndpointAssignmentResource[]; } interface CustomerProfilesChannelEndpointAssignmentResource { sid: string; customer_profile_sid: string; account_sid: string; channel_endpoint_type: string; channel_endpoint_sid: string; date_created: Date; url: string; } export declare class CustomerProfilesChannelEndpointAssignmentInstance { protected _version: V1; protected _solution: CustomerProfilesChannelEndpointAssignmentContextSolution; protected _context?: CustomerProfilesChannelEndpointAssignmentContext; constructor(_version: V1, payload: CustomerProfilesChannelEndpointAssignmentResource, customerProfileSid: string, sid?: string); /** * The unique string that we created to identify the Item Assignment resource. */ sid: string; /** * The unique string that we created to identify the CustomerProfile resource. */ customerProfileSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. */ accountSid: string; /** * The type of channel endpoint. eg: phone-number */ channelEndpointType: string; /** * The SID of an channel endpoint */ channelEndpointSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Identity resource. */ url: string; private get _proxy(); /** * Remove a CustomerProfilesChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CustomerProfilesChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance */ fetch(callback?: (error: Error | null, item?: CustomerProfilesChannelEndpointAssignmentInstance) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; customerProfileSid: string; accountSid: string; channelEndpointType: string; channelEndpointSid: string; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CustomerProfilesChannelEndpointAssignmentSolution { customerProfileSid: string; } export interface CustomerProfilesChannelEndpointAssignmentListInstance { _version: V1; _solution: CustomerProfilesChannelEndpointAssignmentSolution; _uri: string; (sid: string): CustomerProfilesChannelEndpointAssignmentContext; get(sid: string): CustomerProfilesChannelEndpointAssignmentContext; /** * Create a CustomerProfilesChannelEndpointAssignmentInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance */ create(params: CustomerProfilesChannelEndpointAssignmentListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomerProfilesChannelEndpointAssignmentInstance) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance>; /** * Streams CustomerProfilesChannelEndpointAssignmentInstance 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 { CustomerProfilesChannelEndpointAssignmentListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CustomerProfilesChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void; each(params: CustomerProfilesChannelEndpointAssignmentListInstanceEachOptions, callback?: (item: CustomerProfilesChannelEndpointAssignmentInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CustomerProfilesChannelEndpointAssignmentInstance 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: CustomerProfilesChannelEndpointAssignmentPage) => any): Promise<CustomerProfilesChannelEndpointAssignmentPage>; /** * Lists CustomerProfilesChannelEndpointAssignmentInstance 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 { CustomerProfilesChannelEndpointAssignmentListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CustomerProfilesChannelEndpointAssignmentInstance[]) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance[]>; list(params: CustomerProfilesChannelEndpointAssignmentListInstanceOptions, callback?: (error: Error | null, items: CustomerProfilesChannelEndpointAssignmentInstance[]) => any): Promise<CustomerProfilesChannelEndpointAssignmentInstance[]>; /** * Retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance 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 { CustomerProfilesChannelEndpointAssignmentListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CustomerProfilesChannelEndpointAssignmentPage) => any): Promise<CustomerProfilesChannelEndpointAssignmentPage>; page(params: CustomerProfilesChannelEndpointAssignmentListInstancePageOptions, callback?: (error: Error | null, items: CustomerProfilesChannelEndpointAssignmentPage) => any): Promise<CustomerProfilesChannelEndpointAssignmentPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CustomerProfilesChannelEndpointAssignmentListInstance(version: V1, customerProfileSid: string): CustomerProfilesChannelEndpointAssignmentListInstance; export declare class CustomerProfilesChannelEndpointAssignmentPage extends Page<V1, CustomerProfilesChannelEndpointAssignmentPayload, CustomerProfilesChannelEndpointAssignmentResource, CustomerProfilesChannelEndpointAssignmentInstance> { /** * Initialize the CustomerProfilesChannelEndpointAssignmentPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CustomerProfilesChannelEndpointAssignmentSolution); /** * Build an instance of CustomerProfilesChannelEndpointAssignmentInstance * * @param payload - Payload response from the API */ getInstance(payload: CustomerProfilesChannelEndpointAssignmentResource): CustomerProfilesChannelEndpointAssignmentInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.d.ts000064400000027364151677225100023066 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a CustomerProfilesEntityAssignmentsInstance */ export interface CustomerProfilesEntityAssignmentsListInstanceCreateOptions { /** The SID of an object bag that holds information of the different items. */ objectSid: string; } /** * Options to pass to each */ export interface CustomerProfilesEntityAssignmentsListInstanceEachOptions { /** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */ objectType?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CustomerProfilesEntityAssignmentsInstance, 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 CustomerProfilesEntityAssignmentsListInstanceOptions { /** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */ objectType?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CustomerProfilesEntityAssignmentsListInstancePageOptions { /** A string to filter the results by (EndUserType or SupportingDocumentType) machine-name. This is useful when you want to retrieve the entity-assignment of a specific end-user or supporting document. */ objectType?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CustomerProfilesEntityAssignmentsContext { /** * Remove a CustomerProfilesEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CustomerProfilesEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance */ fetch(callback?: (error: Error | null, item?: CustomerProfilesEntityAssignmentsInstance) => any): Promise<CustomerProfilesEntityAssignmentsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CustomerProfilesEntityAssignmentsContextSolution { customerProfileSid: string; sid: string; } export declare class CustomerProfilesEntityAssignmentsContextImpl implements CustomerProfilesEntityAssignmentsContext { protected _version: V1; protected _solution: CustomerProfilesEntityAssignmentsContextSolution; protected _uri: string; constructor(_version: V1, customerProfileSid: string, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CustomerProfilesEntityAssignmentsInstance) => any): Promise<CustomerProfilesEntityAssignmentsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CustomerProfilesEntityAssignmentsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CustomerProfilesEntityAssignmentsPayload extends TwilioResponsePayload { results: CustomerProfilesEntityAssignmentsResource[]; } interface CustomerProfilesEntityAssignmentsResource { sid: string; customer_profile_sid: string; account_sid: string; object_sid: string; date_created: Date; url: string; } export declare class CustomerProfilesEntityAssignmentsInstance { protected _version: V1; protected _solution: CustomerProfilesEntityAssignmentsContextSolution; protected _context?: CustomerProfilesEntityAssignmentsContext; constructor(_version: V1, payload: CustomerProfilesEntityAssignmentsResource, customerProfileSid: string, sid?: string); /** * The unique string that we created to identify the Item Assignment resource. */ sid: string; /** * The unique string that we created to identify the CustomerProfile resource. */ customerProfileSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. */ accountSid: string; /** * The SID of an object bag that holds information of the different items. */ objectSid: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. */ dateCreated: Date; /** * The absolute URL of the Identity resource. */ url: string; private get _proxy(); /** * Remove a CustomerProfilesEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CustomerProfilesEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance */ fetch(callback?: (error: Error | null, item?: CustomerProfilesEntityAssignmentsInstance) => any): Promise<CustomerProfilesEntityAssignmentsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; customerProfileSid: string; accountSid: string; objectSid: string; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CustomerProfilesEntityAssignmentsSolution { customerProfileSid: string; } export interface CustomerProfilesEntityAssignmentsListInstance { _version: V1; _solution: CustomerProfilesEntityAssignmentsSolution; _uri: string; (sid: string): CustomerProfilesEntityAssignmentsContext; get(sid: string): CustomerProfilesEntityAssignmentsContext; /** * Create a CustomerProfilesEntityAssignmentsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance */ create(params: CustomerProfilesEntityAssignmentsListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomerProfilesEntityAssignmentsInstance) => any): Promise<CustomerProfilesEntityAssignmentsInstance>; /** * Streams CustomerProfilesEntityAssignmentsInstance 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 { CustomerProfilesEntityAssignmentsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CustomerProfilesEntityAssignmentsInstance, done: (err?: Error) => void) => void): void; each(params: CustomerProfilesEntityAssignmentsListInstanceEachOptions, callback?: (item: CustomerProfilesEntityAssignmentsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CustomerProfilesEntityAssignmentsInstance 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: CustomerProfilesEntityAssignmentsPage) => any): Promise<CustomerProfilesEntityAssignmentsPage>; /** * Lists CustomerProfilesEntityAssignmentsInstance 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 { CustomerProfilesEntityAssignmentsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CustomerProfilesEntityAssignmentsInstance[]) => any): Promise<CustomerProfilesEntityAssignmentsInstance[]>; list(params: CustomerProfilesEntityAssignmentsListInstanceOptions, callback?: (error: Error | null, items: CustomerProfilesEntityAssignmentsInstance[]) => any): Promise<CustomerProfilesEntityAssignmentsInstance[]>; /** * Retrieve a single page of CustomerProfilesEntityAssignmentsInstance 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 { CustomerProfilesEntityAssignmentsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CustomerProfilesEntityAssignmentsPage) => any): Promise<CustomerProfilesEntityAssignmentsPage>; page(params: CustomerProfilesEntityAssignmentsListInstancePageOptions, callback?: (error: Error | null, items: CustomerProfilesEntityAssignmentsPage) => any): Promise<CustomerProfilesEntityAssignmentsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CustomerProfilesEntityAssignmentsListInstance(version: V1, customerProfileSid: string): CustomerProfilesEntityAssignmentsListInstance; export declare class CustomerProfilesEntityAssignmentsPage extends Page<V1, CustomerProfilesEntityAssignmentsPayload, CustomerProfilesEntityAssignmentsResource, CustomerProfilesEntityAssignmentsInstance> { /** * Initialize the CustomerProfilesEntityAssignmentsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CustomerProfilesEntityAssignmentsSolution); /** * Build an instance of CustomerProfilesEntityAssignmentsInstance * * @param payload - Payload response from the API */ getInstance(payload: CustomerProfilesEntityAssignmentsResource): CustomerProfilesEntityAssignmentsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.d.ts000064400000024271151677225100021662 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type CustomerProfilesEvaluationsStatus = "compliant" | "noncompliant"; /** * Options to pass to create a CustomerProfilesEvaluationsInstance */ export interface CustomerProfilesEvaluationsListInstanceCreateOptions { /** The unique string of a policy that is associated to the customer_profile resource. */ policySid: string; } /** * Options to pass to each */ export interface CustomerProfilesEvaluationsListInstanceEachOptions { /** 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: CustomerProfilesEvaluationsInstance, 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 CustomerProfilesEvaluationsListInstanceOptions { /** 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 CustomerProfilesEvaluationsListInstancePageOptions { /** 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 CustomerProfilesEvaluationsContext { /** * Fetch a CustomerProfilesEvaluationsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesEvaluationsInstance */ fetch(callback?: (error: Error | null, item?: CustomerProfilesEvaluationsInstance) => any): Promise<CustomerProfilesEvaluationsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CustomerProfilesEvaluationsContextSolution { customerProfileSid: string; sid: string; } export declare class CustomerProfilesEvaluationsContextImpl implements CustomerProfilesEvaluationsContext { protected _version: V1; protected _solution: CustomerProfilesEvaluationsContextSolution; protected _uri: string; constructor(_version: V1, customerProfileSid: string, sid: string); fetch(callback?: (error: Error | null, item?: CustomerProfilesEvaluationsInstance) => any): Promise<CustomerProfilesEvaluationsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CustomerProfilesEvaluationsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CustomerProfilesEvaluationsPayload extends TwilioResponsePayload { results: CustomerProfilesEvaluationsResource[]; } interface CustomerProfilesEvaluationsResource { sid: string; account_sid: string; policy_sid: string; customer_profile_sid: string; status: CustomerProfilesEvaluationsStatus; results: Array<any>; date_created: Date; url: string; } export declare class CustomerProfilesEvaluationsInstance { protected _version: V1; protected _solution: CustomerProfilesEvaluationsContextSolution; protected _context?: CustomerProfilesEvaluationsContext; constructor(_version: V1, payload: CustomerProfilesEvaluationsResource, customerProfileSid: string, sid?: string); /** * The unique string that identifies the Evaluation resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the customer_profile resource. */ accountSid: string; /** * The unique string of a policy that is associated to the customer_profile resource. */ policySid: string; /** * The unique string that we created to identify the customer_profile resource. */ customerProfileSid: string; status: CustomerProfilesEvaluationsStatus; /** * The results of the Evaluation which includes the valid and invalid attributes. */ results: Array<any>; dateCreated: Date; url: string; private get _proxy(); /** * Fetch a CustomerProfilesEvaluationsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesEvaluationsInstance */ fetch(callback?: (error: Error | null, item?: CustomerProfilesEvaluationsInstance) => any): Promise<CustomerProfilesEvaluationsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; policySid: string; customerProfileSid: string; status: CustomerProfilesEvaluationsStatus; results: any[]; dateCreated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CustomerProfilesEvaluationsSolution { customerProfileSid: string; } export interface CustomerProfilesEvaluationsListInstance { _version: V1; _solution: CustomerProfilesEvaluationsSolution; _uri: string; (sid: string): CustomerProfilesEvaluationsContext; get(sid: string): CustomerProfilesEvaluationsContext; /** * Create a CustomerProfilesEvaluationsInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesEvaluationsInstance */ create(params: CustomerProfilesEvaluationsListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomerProfilesEvaluationsInstance) => any): Promise<CustomerProfilesEvaluationsInstance>; /** * Streams CustomerProfilesEvaluationsInstance 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 { CustomerProfilesEvaluationsListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CustomerProfilesEvaluationsInstance, done: (err?: Error) => void) => void): void; each(params: CustomerProfilesEvaluationsListInstanceEachOptions, callback?: (item: CustomerProfilesEvaluationsInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CustomerProfilesEvaluationsInstance 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: CustomerProfilesEvaluationsPage) => any): Promise<CustomerProfilesEvaluationsPage>; /** * Lists CustomerProfilesEvaluationsInstance 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 { CustomerProfilesEvaluationsListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CustomerProfilesEvaluationsInstance[]) => any): Promise<CustomerProfilesEvaluationsInstance[]>; list(params: CustomerProfilesEvaluationsListInstanceOptions, callback?: (error: Error | null, items: CustomerProfilesEvaluationsInstance[]) => any): Promise<CustomerProfilesEvaluationsInstance[]>; /** * Retrieve a single page of CustomerProfilesEvaluationsInstance 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 { CustomerProfilesEvaluationsListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CustomerProfilesEvaluationsPage) => any): Promise<CustomerProfilesEvaluationsPage>; page(params: CustomerProfilesEvaluationsListInstancePageOptions, callback?: (error: Error | null, items: CustomerProfilesEvaluationsPage) => any): Promise<CustomerProfilesEvaluationsPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CustomerProfilesEvaluationsListInstance(version: V1, customerProfileSid: string): CustomerProfilesEvaluationsListInstance; export declare class CustomerProfilesEvaluationsPage extends Page<V1, CustomerProfilesEvaluationsPayload, CustomerProfilesEvaluationsResource, CustomerProfilesEvaluationsInstance> { /** * Initialize the CustomerProfilesEvaluationsPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CustomerProfilesEvaluationsSolution); /** * Build an instance of CustomerProfilesEvaluationsInstance * * @param payload - Payload response from the API */ getInstance(payload: CustomerProfilesEvaluationsResource): CustomerProfilesEvaluationsInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/customerProfiles/customerProfilesEntityAssignments.js000064400000022502151677225100022617 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.CustomerProfilesEntityAssignmentsPage = exports.CustomerProfilesEntityAssignmentsListInstance = exports.CustomerProfilesEntityAssignmentsInstance = exports.CustomerProfilesEntityAssignmentsContextImpl = void 0; 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 CustomerProfilesEntityAssignmentsContextImpl { constructor(_version, customerProfileSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(customerProfileSid)) { throw new Error("Parameter 'customerProfileSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { customerProfileSid, sid }; this._uri = `/CustomerProfiles/${customerProfileSid}/EntityAssignments/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CustomerProfilesEntityAssignmentsInstance(operationVersion, payload, instance._solution.customerProfileSid, 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.CustomerProfilesEntityAssignmentsContextImpl = CustomerProfilesEntityAssignmentsContextImpl; class CustomerProfilesEntityAssignmentsInstance { constructor(_version, payload, customerProfileSid, sid) { this._version = _version; this.sid = payload.sid; this.customerProfileSid = payload.customer_profile_sid; this.accountSid = payload.account_sid; this.objectSid = payload.object_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { customerProfileSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CustomerProfilesEntityAssignmentsContextImpl(this._version, this._solution.customerProfileSid, this._solution.sid); return this._context; } /** * Remove a CustomerProfilesEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CustomerProfilesEntityAssignmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesEntityAssignmentsInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, customerProfileSid: this.customerProfileSid, accountSid: this.accountSid, objectSid: this.objectSid, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomerProfilesEntityAssignmentsInstance = CustomerProfilesEntityAssignmentsInstance; function CustomerProfilesEntityAssignmentsListInstance(version, customerProfileSid) { if (!(0, utility_1.isValidPathParam)(customerProfileSid)) { throw new Error("Parameter 'customerProfileSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CustomerProfilesEntityAssignmentsContextImpl(version, customerProfileSid, sid); }; instance._version = version; instance._solution = { customerProfileSid }; instance._uri = `/CustomerProfiles/${customerProfileSid}/EntityAssignments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["objectSid"] === null || params["objectSid"] === undefined) { throw new Error("Required parameter \"params['objectSid']\" missing."); } let data = {}; data["ObjectSid"] = params["objectSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CustomerProfilesEntityAssignmentsInstance(operationVersion, payload, instance._solution.customerProfileSid)); 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["objectType"] !== undefined) data["ObjectType"] = params["objectType"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CustomerProfilesEntityAssignmentsPage(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 CustomerProfilesEntityAssignmentsPage(instance._version, payload, 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; } exports.CustomerProfilesEntityAssignmentsListInstance = CustomerProfilesEntityAssignmentsListInstance; class CustomerProfilesEntityAssignmentsPage extends Page_1.default { /** * Initialize the CustomerProfilesEntityAssignmentsPage * * @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 CustomerProfilesEntityAssignmentsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CustomerProfilesEntityAssignmentsInstance(this._version, payload, this._solution.customerProfileSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomerProfilesEntityAssignmentsPage = CustomerProfilesEntityAssignmentsPage; rest/trusthub/v1/customerProfiles/customerProfilesEvaluations.js000064400000021117151677225100021422 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.CustomerProfilesEvaluationsPage = exports.CustomerProfilesEvaluationsListInstance = exports.CustomerProfilesEvaluationsInstance = exports.CustomerProfilesEvaluationsContextImpl = void 0; 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 CustomerProfilesEvaluationsContextImpl { constructor(_version, customerProfileSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(customerProfileSid)) { throw new Error("Parameter 'customerProfileSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { customerProfileSid, sid }; this._uri = `/CustomerProfiles/${customerProfileSid}/Evaluations/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CustomerProfilesEvaluationsInstance(operationVersion, payload, instance._solution.customerProfileSid, 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.CustomerProfilesEvaluationsContextImpl = CustomerProfilesEvaluationsContextImpl; class CustomerProfilesEvaluationsInstance { constructor(_version, payload, customerProfileSid, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.policySid = payload.policy_sid; this.customerProfileSid = payload.customer_profile_sid; this.status = payload.status; this.results = payload.results; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { customerProfileSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CustomerProfilesEvaluationsContextImpl(this._version, this._solution.customerProfileSid, this._solution.sid); return this._context; } /** * Fetch a CustomerProfilesEvaluationsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesEvaluationsInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, policySid: this.policySid, customerProfileSid: this.customerProfileSid, status: this.status, results: this.results, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomerProfilesEvaluationsInstance = CustomerProfilesEvaluationsInstance; function CustomerProfilesEvaluationsListInstance(version, customerProfileSid) { if (!(0, utility_1.isValidPathParam)(customerProfileSid)) { throw new Error("Parameter 'customerProfileSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CustomerProfilesEvaluationsContextImpl(version, customerProfileSid, sid); }; instance._version = version; instance._solution = { customerProfileSid }; instance._uri = `/CustomerProfiles/${customerProfileSid}/Evaluations`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["policySid"] === null || params["policySid"] === undefined) { throw new Error("Required parameter \"params['policySid']\" missing."); } let data = {}; data["PolicySid"] = params["policySid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CustomerProfilesEvaluationsInstance(operationVersion, payload, instance._solution.customerProfileSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CustomerProfilesEvaluationsPage(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 CustomerProfilesEvaluationsPage(instance._version, payload, 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; } exports.CustomerProfilesEvaluationsListInstance = CustomerProfilesEvaluationsListInstance; class CustomerProfilesEvaluationsPage extends Page_1.default { /** * Initialize the CustomerProfilesEvaluationsPage * * @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 CustomerProfilesEvaluationsInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CustomerProfilesEvaluationsInstance(this._version, payload, this._solution.customerProfileSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomerProfilesEvaluationsPage = CustomerProfilesEvaluationsPage; rest/trusthub/v1/customerProfiles/customerProfilesChannelEndpointAssignment.js000064400000024307151677225100024236 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.CustomerProfilesChannelEndpointAssignmentPage = exports.CustomerProfilesChannelEndpointAssignmentListInstance = exports.CustomerProfilesChannelEndpointAssignmentInstance = exports.CustomerProfilesChannelEndpointAssignmentContextImpl = void 0; 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 CustomerProfilesChannelEndpointAssignmentContextImpl { constructor(_version, customerProfileSid, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(customerProfileSid)) { throw new Error("Parameter 'customerProfileSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { customerProfileSid, sid }; this._uri = `/CustomerProfiles/${customerProfileSid}/ChannelEndpointAssignments/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CustomerProfilesChannelEndpointAssignmentInstance(operationVersion, payload, instance._solution.customerProfileSid, 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.CustomerProfilesChannelEndpointAssignmentContextImpl = CustomerProfilesChannelEndpointAssignmentContextImpl; class CustomerProfilesChannelEndpointAssignmentInstance { constructor(_version, payload, customerProfileSid, sid) { this._version = _version; this.sid = payload.sid; this.customerProfileSid = payload.customer_profile_sid; this.accountSid = payload.account_sid; this.channelEndpointType = payload.channel_endpoint_type; this.channelEndpointSid = payload.channel_endpoint_sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this._solution = { customerProfileSid, sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CustomerProfilesChannelEndpointAssignmentContextImpl(this._version, this._solution.customerProfileSid, this._solution.sid); return this._context; } /** * Remove a CustomerProfilesChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CustomerProfilesChannelEndpointAssignmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomerProfilesChannelEndpointAssignmentInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, customerProfileSid: this.customerProfileSid, accountSid: this.accountSid, channelEndpointType: this.channelEndpointType, channelEndpointSid: this.channelEndpointSid, dateCreated: this.dateCreated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomerProfilesChannelEndpointAssignmentInstance = CustomerProfilesChannelEndpointAssignmentInstance; function CustomerProfilesChannelEndpointAssignmentListInstance(version, customerProfileSid) { if (!(0, utility_1.isValidPathParam)(customerProfileSid)) { throw new Error("Parameter 'customerProfileSid' is not valid."); } const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CustomerProfilesChannelEndpointAssignmentContextImpl(version, customerProfileSid, sid); }; instance._version = version; instance._solution = { customerProfileSid }; instance._uri = `/CustomerProfiles/${customerProfileSid}/ChannelEndpointAssignments`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["channelEndpointType"] === null || params["channelEndpointType"] === undefined) { throw new Error("Required parameter \"params['channelEndpointType']\" missing."); } if (params["channelEndpointSid"] === null || params["channelEndpointSid"] === undefined) { throw new Error("Required parameter \"params['channelEndpointSid']\" missing."); } let data = {}; data["ChannelEndpointType"] = params["channelEndpointType"]; data["ChannelEndpointSid"] = params["channelEndpointSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CustomerProfilesChannelEndpointAssignmentInstance(operationVersion, payload, instance._solution.customerProfileSid)); 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["channelEndpointSid"] !== undefined) data["ChannelEndpointSid"] = params["channelEndpointSid"]; if (params["channelEndpointSids"] !== undefined) data["ChannelEndpointSids"] = params["channelEndpointSids"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CustomerProfilesChannelEndpointAssignmentPage(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 CustomerProfilesChannelEndpointAssignmentPage(instance._version, payload, 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; } exports.CustomerProfilesChannelEndpointAssignmentListInstance = CustomerProfilesChannelEndpointAssignmentListInstance; class CustomerProfilesChannelEndpointAssignmentPage extends Page_1.default { /** * Initialize the CustomerProfilesChannelEndpointAssignmentPage * * @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 CustomerProfilesChannelEndpointAssignmentInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CustomerProfilesChannelEndpointAssignmentInstance(this._version, payload, this._solution.customerProfileSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomerProfilesChannelEndpointAssignmentPage = CustomerProfilesChannelEndpointAssignmentPage; rest/trusthub/v1/endUserType.d.ts000064400000020101151677225100012770 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface EndUserTypeListInstanceEachOptions { /** 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: EndUserTypeInstance, 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 EndUserTypeListInstanceOptions { /** 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 EndUserTypeListInstancePageOptions { /** 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 EndUserTypeContext { /** * Fetch a EndUserTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserTypeInstance */ fetch(callback?: (error: Error | null, item?: EndUserTypeInstance) => any): Promise<EndUserTypeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EndUserTypeContextSolution { sid: string; } export declare class EndUserTypeContextImpl implements EndUserTypeContext { protected _version: V1; protected _solution: EndUserTypeContextSolution; protected _uri: string; constructor(_version: V1, sid: string); fetch(callback?: (error: Error | null, item?: EndUserTypeInstance) => any): Promise<EndUserTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EndUserTypeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EndUserTypePayload extends TwilioResponsePayload { end_user_types: EndUserTypeResource[]; } interface EndUserTypeResource { sid: string; friendly_name: string; machine_name: string; fields: Array<any>; url: string; } export declare class EndUserTypeInstance { protected _version: V1; protected _solution: EndUserTypeContextSolution; protected _context?: EndUserTypeContext; constructor(_version: V1, payload: EndUserTypeResource, sid?: string); /** * The unique string that identifies the End-User Type resource. */ sid: string; /** * A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc */ friendlyName: string; /** * A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc. */ machineName: string; /** * The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals. */ fields: Array<any>; /** * The absolute URL of the End-User Type resource. */ url: string; private get _proxy(); /** * Fetch a EndUserTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EndUserTypeInstance */ fetch(callback?: (error: Error | null, item?: EndUserTypeInstance) => any): Promise<EndUserTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; friendlyName: string; machineName: string; fields: any[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EndUserTypeSolution { } export interface EndUserTypeListInstance { _version: V1; _solution: EndUserTypeSolution; _uri: string; (sid: string): EndUserTypeContext; get(sid: string): EndUserTypeContext; /** * Streams EndUserTypeInstance 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 { EndUserTypeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EndUserTypeInstance, done: (err?: Error) => void) => void): void; each(params: EndUserTypeListInstanceEachOptions, callback?: (item: EndUserTypeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EndUserTypeInstance 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: EndUserTypePage) => any): Promise<EndUserTypePage>; /** * Lists EndUserTypeInstance 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 { EndUserTypeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EndUserTypeInstance[]) => any): Promise<EndUserTypeInstance[]>; list(params: EndUserTypeListInstanceOptions, callback?: (error: Error | null, items: EndUserTypeInstance[]) => any): Promise<EndUserTypeInstance[]>; /** * Retrieve a single page of EndUserTypeInstance 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 { EndUserTypeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EndUserTypePage) => any): Promise<EndUserTypePage>; page(params: EndUserTypeListInstancePageOptions, callback?: (error: Error | null, items: EndUserTypePage) => any): Promise<EndUserTypePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EndUserTypeListInstance(version: V1): EndUserTypeListInstance; export declare class EndUserTypePage extends Page<V1, EndUserTypePayload, EndUserTypeResource, EndUserTypeInstance> { /** * Initialize the EndUserTypePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: EndUserTypeSolution); /** * Build an instance of EndUserTypeInstance * * @param payload - Payload response from the API */ getInstance(payload: EndUserTypeResource): EndUserTypeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/trusthub/v1/complianceInquiries.js000064400000013137151677225100014303 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.ComplianceInquiriesListInstance = exports.ComplianceInquiriesInstance = exports.ComplianceInquiriesContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class ComplianceInquiriesContextImpl { constructor(_version, customerId) { this._version = _version; if (!(0, utility_1.isValidPathParam)(customerId)) { throw new Error("Parameter 'customerId' is not valid."); } this._solution = { customerId }; this._uri = `/ComplianceInquiries/Customers/${customerId}/Initialize`; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["primaryProfileSid"] === null || params["primaryProfileSid"] === undefined) { throw new Error("Required parameter \"params['primaryProfileSid']\" missing."); } let data = {}; data["PrimaryProfileSid"] = params["primaryProfileSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ComplianceInquiriesInstance(operationVersion, payload, instance._solution.customerId)); 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.ComplianceInquiriesContextImpl = ComplianceInquiriesContextImpl; class ComplianceInquiriesInstance { constructor(_version, payload, customerId) { this._version = _version; this.inquiryId = payload.inquiry_id; this.inquirySessionToken = payload.inquiry_session_token; this.customerId = payload.customer_id; this.url = payload.url; this._solution = { customerId: customerId || this.customerId }; } get _proxy() { this._context = this._context || new ComplianceInquiriesContextImpl(this._version, this._solution.customerId); return this._context; } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { inquiryId: this.inquiryId, inquirySessionToken: this.inquirySessionToken, customerId: this.customerId, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ComplianceInquiriesInstance = ComplianceInquiriesInstance; function ComplianceInquiriesListInstance(version) { const instance = ((customerId) => instance.get(customerId)); instance.get = function get(customerId) { return new ComplianceInquiriesContextImpl(version, customerId); }; instance._version = version; instance._solution = {}; instance._uri = `/ComplianceInquiries/Customers/Initialize`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["primaryProfileSid"] === null || params["primaryProfileSid"] === undefined) { throw new Error("Required parameter \"params['primaryProfileSid']\" missing."); } let data = {}; data["PrimaryProfileSid"] = params["primaryProfileSid"]; if (params["notificationEmail"] !== undefined) data["NotificationEmail"] = params["notificationEmail"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ComplianceInquiriesInstance(operationVersion, payload)); 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; } exports.ComplianceInquiriesListInstance = ComplianceInquiriesListInstance; rest/trusthub/v1/complianceTollfreeInquiries.js000064400000013752151677225100016003 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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.ComplianceTollfreeInquiriesInstance = exports.ComplianceTollfreeInquiriesListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function ComplianceTollfreeInquiriesListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/ComplianceInquiries/Tollfree/Initialize`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["tollfreePhoneNumber"] === null || params["tollfreePhoneNumber"] === undefined) { throw new Error("Required parameter \"params['tollfreePhoneNumber']\" missing."); } if (params["notificationEmail"] === null || params["notificationEmail"] === undefined) { throw new Error("Required parameter \"params['notificationEmail']\" missing."); } let data = {}; data["TollfreePhoneNumber"] = params["tollfreePhoneNumber"]; data["NotificationEmail"] = params["notificationEmail"]; if (params["businessName"] !== undefined) data["BusinessName"] = params["businessName"]; if (params["businessWebsite"] !== undefined) data["BusinessWebsite"] = params["businessWebsite"]; if (params["useCaseCategories"] !== undefined) data["UseCaseCategories"] = serialize.map(params["useCaseCategories"], (e) => e); if (params["useCaseSummary"] !== undefined) data["UseCaseSummary"] = params["useCaseSummary"]; if (params["productionMessageSample"] !== undefined) data["ProductionMessageSample"] = params["productionMessageSample"]; if (params["optInImageUrls"] !== undefined) data["OptInImageUrls"] = serialize.map(params["optInImageUrls"], (e) => e); if (params["optInType"] !== undefined) data["OptInType"] = params["optInType"]; if (params["messageVolume"] !== undefined) data["MessageVolume"] = params["messageVolume"]; if (params["businessStreetAddress"] !== undefined) data["BusinessStreetAddress"] = params["businessStreetAddress"]; if (params["businessStreetAddress2"] !== undefined) data["BusinessStreetAddress2"] = params["businessStreetAddress2"]; if (params["businessCity"] !== undefined) data["BusinessCity"] = params["businessCity"]; if (params["businessStateProvinceRegion"] !== undefined) data["BusinessStateProvinceRegion"] = params["businessStateProvinceRegion"]; if (params["businessPostalCode"] !== undefined) data["BusinessPostalCode"] = params["businessPostalCode"]; if (params["businessCountry"] !== undefined) data["BusinessCountry"] = params["businessCountry"]; if (params["additionalInformation"] !== undefined) data["AdditionalInformation"] = params["additionalInformation"]; if (params["businessContactFirstName"] !== undefined) data["BusinessContactFirstName"] = params["businessContactFirstName"]; if (params["businessContactLastName"] !== undefined) data["BusinessContactLastName"] = params["businessContactLastName"]; if (params["businessContactEmail"] !== undefined) data["BusinessContactEmail"] = params["businessContactEmail"]; if (params["businessContactPhone"] !== undefined) data["BusinessContactPhone"] = params["businessContactPhone"]; if (params["themeSetId"] !== undefined) data["ThemeSetId"] = params["themeSetId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ComplianceTollfreeInquiriesInstance(operationVersion, payload)); 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; } exports.ComplianceTollfreeInquiriesListInstance = ComplianceTollfreeInquiriesListInstance; class ComplianceTollfreeInquiriesInstance { constructor(_version, payload) { this._version = _version; this.inquiryId = payload.inquiry_id; this.inquirySessionToken = payload.inquiry_session_token; this.registrationId = payload.registration_id; this.url = payload.url; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { inquiryId: this.inquiryId, inquirySessionToken: this.inquirySessionToken, registrationId: this.registrationId, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ComplianceTollfreeInquiriesInstance = ComplianceTollfreeInquiriesInstance; rest/trusthub/V1.js000064400000010302151677225100010227 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Trusthub * 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 complianceInquiries_1 = require("./v1/complianceInquiries"); const complianceRegistrationInquiries_1 = require("./v1/complianceRegistrationInquiries"); const complianceTollfreeInquiries_1 = require("./v1/complianceTollfreeInquiries"); const customerProfiles_1 = require("./v1/customerProfiles"); const endUser_1 = require("./v1/endUser"); const endUserType_1 = require("./v1/endUserType"); const policies_1 = require("./v1/policies"); const supportingDocument_1 = require("./v1/supportingDocument"); const supportingDocumentType_1 = require("./v1/supportingDocumentType"); const trustProducts_1 = require("./v1/trustProducts"); class V1 extends Version_1.default { /** * Initialize the V1 version of Trusthub * * @param domain - The Twilio (Twilio.Trusthub) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for complianceInquiries resource */ get complianceInquiries() { this._complianceInquiries = this._complianceInquiries || (0, complianceInquiries_1.ComplianceInquiriesListInstance)(this); return this._complianceInquiries; } /** Getter for complianceRegistrationInquiries resource */ get complianceRegistrationInquiries() { this._complianceRegistrationInquiries = this._complianceRegistrationInquiries || (0, complianceRegistrationInquiries_1.ComplianceRegistrationInquiriesListInstance)(this); return this._complianceRegistrationInquiries; } /** Getter for complianceTollfreeInquiries resource */ get complianceTollfreeInquiries() { this._complianceTollfreeInquiries = this._complianceTollfreeInquiries || (0, complianceTollfreeInquiries_1.ComplianceTollfreeInquiriesListInstance)(this); return this._complianceTollfreeInquiries; } /** Getter for customerProfiles resource */ get customerProfiles() { this._customerProfiles = this._customerProfiles || (0, customerProfiles_1.CustomerProfilesListInstance)(this); return this._customerProfiles; } /** Getter for endUsers resource */ get endUsers() { this._endUsers = this._endUsers || (0, endUser_1.EndUserListInstance)(this); return this._endUsers; } /** Getter for endUserTypes resource */ get endUserTypes() { this._endUserTypes = this._endUserTypes || (0, endUserType_1.EndUserTypeListInstance)(this); return this._endUserTypes; } /** Getter for policies resource */ get policies() { this._policies = this._policies || (0, policies_1.PoliciesListInstance)(this); return this._policies; } /** Getter for supportingDocuments resource */ get supportingDocuments() { this._supportingDocuments = this._supportingDocuments || (0, supportingDocument_1.SupportingDocumentListInstance)(this); return this._supportingDocuments; } /** Getter for supportingDocumentTypes resource */ get supportingDocumentTypes() { this._supportingDocumentTypes = this._supportingDocumentTypes || (0, supportingDocumentType_1.SupportingDocumentTypeListInstance)(this); return this._supportingDocumentTypes; } /** Getter for trustProducts resource */ get trustProducts() { this._trustProducts = this._trustProducts || (0, trustProducts_1.TrustProductsListInstance)(this); return this._trustProducts; } } exports.default = V1; rest/Oauth.js000064400000000432151677225100007144 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const OauthBase_1 = __importDefault(require("./OauthBase")); class Oauth extends OauthBase_1.default { } module.exports = Oauth; rest/ApiBase.d.ts000064400000000450151677225100007624 0ustar00import Domain from "../base/Domain"; import V2010 from "./api/V2010"; declare class ApiBase extends Domain { _v2010?: V2010; /** * Initialize api domain * * @param twilio - The twilio client */ constructor(twilio: any); get v2010(): V2010; } export = ApiBase; rest/bulkexports/V1.d.ts000064400000001630151677225100011171 0ustar00import BulkexportsBase from "../BulkexportsBase"; import Version from "../../base/Version"; import { ExportListInstance } from "./v1/export"; import { ExportConfigurationListInstance } from "./v1/exportConfiguration"; export default class V1 extends Version { /** * Initialize the V1 version of Bulkexports * * @param domain - The Twilio (Twilio.Bulkexports) domain */ constructor(domain: BulkexportsBase); /** exports - { Twilio.Bulkexports.V1.ExportListInstance } resource */ protected _exports?: ExportListInstance; /** exportConfiguration - { Twilio.Bulkexports.V1.ExportConfigurationListInstance } resource */ protected _exportConfiguration?: ExportConfigurationListInstance; /** Getter for exports resource */ get exports(): ExportListInstance; /** Getter for exportConfiguration resource */ get exportConfiguration(): ExportConfigurationListInstance; } rest/bulkexports/v1/export.js000064400000011324151677225100012317 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Bulkexports * 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.ExportListInstance = exports.ExportInstance = exports.ExportContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const day_1 = require("./export/day"); const exportCustomJob_1 = require("./export/exportCustomJob"); const job_1 = require("./export/job"); class ExportContextImpl { constructor(_version, resourceType) { this._version = _version; if (!(0, utility_1.isValidPathParam)(resourceType)) { throw new Error("Parameter 'resourceType' is not valid."); } this._solution = { resourceType }; this._uri = `/Exports/${resourceType}`; } get days() { this._days = this._days || (0, day_1.DayListInstance)(this._version, this._solution.resourceType); return this._days; } get exportCustomJobs() { this._exportCustomJobs = this._exportCustomJobs || (0, exportCustomJob_1.ExportCustomJobListInstance)(this._version, this._solution.resourceType); return this._exportCustomJobs; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExportInstance(operationVersion, payload, instance._solution.resourceType)); 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.ExportContextImpl = ExportContextImpl; class ExportInstance { constructor(_version, payload, resourceType) { this._version = _version; this.resourceType = payload.resource_type; this.url = payload.url; this.links = payload.links; this._solution = { resourceType: resourceType || this.resourceType }; } get _proxy() { this._context = this._context || new ExportContextImpl(this._version, this._solution.resourceType); return this._context; } /** * Fetch a ExportInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the days. */ days() { return this._proxy.days; } /** * Access the exportCustomJobs. */ exportCustomJobs() { return this._proxy.exportCustomJobs; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { resourceType: this.resourceType, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExportInstance = ExportInstance; function ExportListInstance(version) { const instance = ((resourceType) => instance.get(resourceType)); instance.get = function get(resourceType) { return new ExportContextImpl(version, resourceType); }; instance._version = version; instance._solution = {}; instance._uri = `/Exports`; Object.defineProperty(instance, "jobs", { get: function jobs() { if (!instance._jobs) { instance._jobs = (0, job_1.JobListInstance)(instance._version); } return instance._jobs; }, }); 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; } exports.ExportListInstance = ExportListInstance; rest/bulkexports/v1/export.d.ts000064400000006700151677225100012555 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; import { DayListInstance } from "./export/day"; import { ExportCustomJobListInstance } from "./export/exportCustomJob"; import { JobListInstance } from "./export/job"; export interface ExportContext { days: DayListInstance; exportCustomJobs: ExportCustomJobListInstance; /** * Fetch a ExportInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportInstance */ fetch(callback?: (error: Error | null, item?: ExportInstance) => any): Promise<ExportInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExportContextSolution { resourceType: string; } export declare class ExportContextImpl implements ExportContext { protected _version: V1; protected _solution: ExportContextSolution; protected _uri: string; protected _days?: DayListInstance; protected _exportCustomJobs?: ExportCustomJobListInstance; constructor(_version: V1, resourceType: string); get days(): DayListInstance; get exportCustomJobs(): ExportCustomJobListInstance; fetch(callback?: (error: Error | null, item?: ExportInstance) => any): Promise<ExportInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExportContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExportResource { resource_type: string; url: string; links: Record<string, string>; } export declare class ExportInstance { protected _version: V1; protected _solution: ExportContextSolution; protected _context?: ExportContext; constructor(_version: V1, payload: ExportResource, resourceType?: string); /** * The type of communication – Messages, Calls, Conferences, and Participants */ resourceType: string; /** * The URL of this resource. */ url: string; /** * Contains a dictionary of URL links to nested resources of this Export. */ links: Record<string, string>; private get _proxy(); /** * Fetch a ExportInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportInstance */ fetch(callback?: (error: Error | null, item?: ExportInstance) => any): Promise<ExportInstance>; /** * Access the days. */ days(): DayListInstance; /** * Access the exportCustomJobs. */ exportCustomJobs(): ExportCustomJobListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { resourceType: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExportSolution { } export interface ExportListInstance { _version: V1; _solution: ExportSolution; _uri: string; (resourceType: string): ExportContext; get(resourceType: string): ExportContext; _jobs?: JobListInstance; jobs: JobListInstance; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExportListInstance(version: V1): ExportListInstance; export {}; rest/bulkexports/v1/export/day.js000064400000015256151677225100013104 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Bulkexports * 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.DayPage = exports.DayListInstance = exports.DayInstance = exports.DayContextImpl = void 0; 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 DayContextImpl { constructor(_version, resourceType, day) { this._version = _version; if (!(0, utility_1.isValidPathParam)(resourceType)) { throw new Error("Parameter 'resourceType' is not valid."); } if (!(0, utility_1.isValidPathParam)(day)) { throw new Error("Parameter 'day' is not valid."); } this._solution = { resourceType, day }; this._uri = `/Exports/${resourceType}/Days/${day}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new DayInstance(operationVersion, payload, instance._solution.resourceType, instance._solution.day)); 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.DayContextImpl = DayContextImpl; class DayInstance { constructor(_version, payload, resourceType, day) { this._version = _version; this.redirectTo = payload.redirect_to; this.day = payload.day; this.size = deserialize.integer(payload.size); this.createDate = payload.create_date; this.friendlyName = payload.friendly_name; this.resourceType = payload.resource_type; this._solution = { resourceType, day: day || this.day }; } get _proxy() { this._context = this._context || new DayContextImpl(this._version, this._solution.resourceType, this._solution.day); return this._context; } /** * Fetch a DayInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DayInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { redirectTo: this.redirectTo, day: this.day, size: this.size, createDate: this.createDate, friendlyName: this.friendlyName, resourceType: this.resourceType, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DayInstance = DayInstance; function DayListInstance(version, resourceType) { if (!(0, utility_1.isValidPathParam)(resourceType)) { throw new Error("Parameter 'resourceType' is not valid."); } const instance = ((day) => instance.get(day)); instance.get = function get(day) { return new DayContextImpl(version, resourceType, day); }; instance._version = version; instance._solution = { resourceType }; instance._uri = `/Exports/${resourceType}/Days`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DayPage(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 DayPage(instance._version, payload, 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; } exports.DayListInstance = DayListInstance; class DayPage extends Page_1.default { /** * Initialize the DayPage * * @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 DayInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DayInstance(this._version, payload, this._solution.resourceType); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DayPage = DayPage; rest/bulkexports/v1/export/job.js000064400000011675151677225100013102 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Bulkexports * 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.JobListInstance = exports.JobInstance = exports.JobContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class JobContextImpl { constructor(_version, jobSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(jobSid)) { throw new Error("Parameter 'jobSid' is not valid."); } this._solution = { jobSid }; this._uri = `/Exports/Jobs/${jobSid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new JobInstance(operationVersion, payload, instance._solution.jobSid)); 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.JobContextImpl = JobContextImpl; class JobInstance { constructor(_version, payload, jobSid) { this._version = _version; this.resourceType = payload.resource_type; this.friendlyName = payload.friendly_name; this.details = payload.details; this.startDay = payload.start_day; this.endDay = payload.end_day; this.jobSid = payload.job_sid; this.webhookUrl = payload.webhook_url; this.webhookMethod = payload.webhook_method; this.email = payload.email; this.url = payload.url; this.jobQueuePosition = payload.job_queue_position; this.estimatedCompletionTime = payload.estimated_completion_time; this._solution = { jobSid: jobSid || this.jobSid }; } get _proxy() { this._context = this._context || new JobContextImpl(this._version, this._solution.jobSid); return this._context; } /** * Remove a JobInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a JobInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed JobInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { resourceType: this.resourceType, friendlyName: this.friendlyName, details: this.details, startDay: this.startDay, endDay: this.endDay, jobSid: this.jobSid, webhookUrl: this.webhookUrl, webhookMethod: this.webhookMethod, email: this.email, url: this.url, jobQueuePosition: this.jobQueuePosition, estimatedCompletionTime: this.estimatedCompletionTime, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.JobInstance = JobInstance; function JobListInstance(version) { const instance = ((jobSid) => instance.get(jobSid)); instance.get = function get(jobSid) { return new JobContextImpl(version, jobSid); }; 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; } exports.JobListInstance = JobListInstance; rest/bulkexports/v1/export/job.d.ts000064400000012257151677225100013333 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export interface JobContext { /** * Remove a JobInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a JobInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed JobInstance */ fetch(callback?: (error: Error | null, item?: JobInstance) => any): Promise<JobInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface JobContextSolution { jobSid: string; } export declare class JobContextImpl implements JobContext { protected _version: V1; protected _solution: JobContextSolution; protected _uri: string; constructor(_version: V1, jobSid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: JobInstance) => any): Promise<JobInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): JobContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface JobResource { resource_type: string; friendly_name: string; details: any; start_day: string; end_day: string; job_sid: string; webhook_url: string; webhook_method: string; email: string; url: string; job_queue_position: string; estimated_completion_time: string; } export declare class JobInstance { protected _version: V1; protected _solution: JobContextSolution; protected _context?: JobContext; constructor(_version: V1, payload: JobResource, jobSid?: string); /** * The type of communication – Messages, Calls, Conferences, and Participants */ resourceType: string; /** * The friendly name specified when creating the job */ friendlyName: string; /** * The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. */ details: any; /** * The start time for the export specified when creating the job */ startDay: string; /** * The end time for the export specified when creating the job */ endDay: string; /** * The job_sid returned when the export was created */ jobSid: string; /** * The optional webhook url called on completion */ webhookUrl: string; /** * This is the method used to call the webhook */ webhookMethod: string; /** * The optional email to send the completion notification to */ email: string; url: string; /** * This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease */ jobQueuePosition: string; /** * this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position */ estimatedCompletionTime: string; private get _proxy(); /** * Remove a JobInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a JobInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed JobInstance */ fetch(callback?: (error: Error | null, item?: JobInstance) => any): Promise<JobInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { resourceType: string; friendlyName: string; details: any; startDay: string; endDay: string; jobSid: string; webhookUrl: string; webhookMethod: string; email: string; url: string; jobQueuePosition: string; estimatedCompletionTime: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface JobSolution { } export interface JobListInstance { _version: V1; _solution: JobSolution; _uri: string; (jobSid: string): JobContext; get(jobSid: string): JobContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function JobListInstance(version: V1): JobListInstance; export {}; rest/bulkexports/v1/export/day.d.ts000064400000016773151677225100013345 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to each */ export interface DayListInstanceEachOptions { /** 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: DayInstance, 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 DayListInstanceOptions { /** 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 DayListInstancePageOptions { /** 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 DayContext { /** * Fetch a DayInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DayInstance */ fetch(callback?: (error: Error | null, item?: DayInstance) => any): Promise<DayInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface DayContextSolution { resourceType: string; day: string; } export declare class DayContextImpl implements DayContext { protected _version: V1; protected _solution: DayContextSolution; protected _uri: string; constructor(_version: V1, resourceType: string, day: string); fetch(callback?: (error: Error | null, item?: DayInstance) => any): Promise<DayInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): DayContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface DayPayload extends TwilioResponsePayload { days: DayResource[]; } interface DayResource { redirect_to: string; day: string; size: number; create_date: string; friendly_name: string; resource_type: string; } export declare class DayInstance { protected _version: V1; protected _solution: DayContextSolution; protected _context?: DayContext; constructor(_version: V1, payload: DayResource, resourceType: string, day?: string); redirectTo: string; /** * The ISO 8601 format date of the resources in the file, for a UTC day */ day: string; /** * The size of the day\'s data file in bytes */ size: number; /** * The ISO 8601 format date when resources is created */ createDate: string; /** * The friendly name specified when creating the job */ friendlyName: string; /** * The type of communication – Messages, Calls, Conferences, and Participants */ resourceType: string; private get _proxy(); /** * Fetch a DayInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed DayInstance */ fetch(callback?: (error: Error | null, item?: DayInstance) => any): Promise<DayInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { redirectTo: string; day: string; size: number; createDate: string; friendlyName: string; resourceType: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface DaySolution { resourceType: string; } export interface DayListInstance { _version: V1; _solution: DaySolution; _uri: string; (day: string): DayContext; get(day: string): DayContext; /** * Streams DayInstance 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 { DayListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DayInstance, done: (err?: Error) => void) => void): void; each(params: DayListInstanceEachOptions, callback?: (item: DayInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DayInstance 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: DayPage) => any): Promise<DayPage>; /** * Lists DayInstance 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 { DayListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DayInstance[]) => any): Promise<DayInstance[]>; list(params: DayListInstanceOptions, callback?: (error: Error | null, items: DayInstance[]) => any): Promise<DayInstance[]>; /** * Retrieve a single page of DayInstance 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 { DayListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DayPage) => any): Promise<DayPage>; page(params: DayListInstancePageOptions, callback?: (error: Error | null, items: DayPage) => any): Promise<DayPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DayListInstance(version: V1, resourceType: string): DayListInstance; export declare class DayPage extends Page<V1, DayPayload, DayResource, DayInstance> { /** * Initialize the DayPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DaySolution); /** * Build an instance of DayInstance * * @param payload - Payload response from the API */ getInstance(payload: DayResource): DayInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/bulkexports/v1/export/exportCustomJob.js000064400000016232151677225100015471 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Bulkexports * 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.ExportCustomJobPage = exports.ExportCustomJobInstance = exports.ExportCustomJobListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function ExportCustomJobListInstance(version, resourceType) { if (!(0, utility_1.isValidPathParam)(resourceType)) { throw new Error("Parameter 'resourceType' is not valid."); } const instance = {}; instance._version = version; instance._solution = { resourceType }; instance._uri = `/Exports/${resourceType}/Jobs`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["startDay"] === null || params["startDay"] === undefined) { throw new Error("Required parameter \"params['startDay']\" missing."); } if (params["endDay"] === null || params["endDay"] === undefined) { throw new Error("Required parameter \"params['endDay']\" missing."); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } let data = {}; data["StartDay"] = params["startDay"]; data["EndDay"] = params["endDay"]; data["FriendlyName"] = params["friendlyName"]; if (params["webhookUrl"] !== undefined) data["WebhookUrl"] = params["webhookUrl"]; if (params["webhookMethod"] !== undefined) data["WebhookMethod"] = params["webhookMethod"]; if (params["email"] !== undefined) data["Email"] = params["email"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ExportCustomJobInstance(operationVersion, payload, instance._solution.resourceType)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ExportCustomJobPage(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 ExportCustomJobPage(instance._version, payload, 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; } exports.ExportCustomJobListInstance = ExportCustomJobListInstance; class ExportCustomJobInstance { constructor(_version, payload, resourceType) { this._version = _version; this.friendlyName = payload.friendly_name; this.resourceType = payload.resource_type; this.startDay = payload.start_day; this.endDay = payload.end_day; this.webhookUrl = payload.webhook_url; this.webhookMethod = payload.webhook_method; this.email = payload.email; this.jobSid = payload.job_sid; this.details = payload.details; this.jobQueuePosition = payload.job_queue_position; this.estimatedCompletionTime = payload.estimated_completion_time; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { friendlyName: this.friendlyName, resourceType: this.resourceType, startDay: this.startDay, endDay: this.endDay, webhookUrl: this.webhookUrl, webhookMethod: this.webhookMethod, email: this.email, jobSid: this.jobSid, details: this.details, jobQueuePosition: this.jobQueuePosition, estimatedCompletionTime: this.estimatedCompletionTime, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExportCustomJobInstance = ExportCustomJobInstance; class ExportCustomJobPage extends Page_1.default { /** * Initialize the ExportCustomJobPage * * @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 ExportCustomJobInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ExportCustomJobInstance(this._version, payload, this._solution.resourceType); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExportCustomJobPage = ExportCustomJobPage; rest/bulkexports/v1/export/exportCustomJob.d.ts000064400000023500151677225100015721 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to create a ExportCustomJobInstance */ export interface ExportCustomJobListInstanceCreateOptions { /** The start day for the custom export specified as a string in the format of yyyy-mm-dd */ startDay: string; /** The end day for the custom export specified as a string in the format of yyyy-mm-dd. End day is inclusive and must be 2 days earlier than the current UTC day. */ endDay: string; /** The friendly name specified when creating the job */ friendlyName: string; /** The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. If you set neither webhook nor email, you will have to check your job\\\'s status manually. */ webhookUrl?: string; /** This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. */ webhookMethod?: string; /** The optional email to send the completion notification to. You can set both webhook, and email, or one or the other. If you set neither, the job will run but you will have to query to determine your job\\\'s status. */ email?: string; } /** * Options to pass to each */ export interface ExportCustomJobListInstanceEachOptions { /** 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: ExportCustomJobInstance, 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 ExportCustomJobListInstanceOptions { /** 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 ExportCustomJobListInstancePageOptions { /** 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 ExportCustomJobSolution { resourceType: string; } export interface ExportCustomJobListInstance { _version: V1; _solution: ExportCustomJobSolution; _uri: string; /** * Create a ExportCustomJobInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportCustomJobInstance */ create(params: ExportCustomJobListInstanceCreateOptions, callback?: (error: Error | null, item?: ExportCustomJobInstance) => any): Promise<ExportCustomJobInstance>; /** * Streams ExportCustomJobInstance 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 { ExportCustomJobListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ExportCustomJobInstance, done: (err?: Error) => void) => void): void; each(params: ExportCustomJobListInstanceEachOptions, callback?: (item: ExportCustomJobInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ExportCustomJobInstance 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: ExportCustomJobPage) => any): Promise<ExportCustomJobPage>; /** * Lists ExportCustomJobInstance 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 { ExportCustomJobListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ExportCustomJobInstance[]) => any): Promise<ExportCustomJobInstance[]>; list(params: ExportCustomJobListInstanceOptions, callback?: (error: Error | null, items: ExportCustomJobInstance[]) => any): Promise<ExportCustomJobInstance[]>; /** * Retrieve a single page of ExportCustomJobInstance 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 { ExportCustomJobListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ExportCustomJobPage) => any): Promise<ExportCustomJobPage>; page(params: ExportCustomJobListInstancePageOptions, callback?: (error: Error | null, items: ExportCustomJobPage) => any): Promise<ExportCustomJobPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExportCustomJobListInstance(version: V1, resourceType: string): ExportCustomJobListInstance; interface ExportCustomJobPayload extends TwilioResponsePayload { jobs: ExportCustomJobResource[]; } interface ExportCustomJobResource { friendly_name: string; resource_type: string; start_day: string; end_day: string; webhook_url: string; webhook_method: string; email: string; job_sid: string; details: any; job_queue_position: string; estimated_completion_time: string; } export declare class ExportCustomJobInstance { protected _version: V1; constructor(_version: V1, payload: ExportCustomJobResource, resourceType: string); /** * The friendly name specified when creating the job */ friendlyName: string; /** * The type of communication – Messages, Calls, Conferences, and Participants */ resourceType: string; /** * The start day for the custom export specified when creating the job */ startDay: string; /** * The end day for the export specified when creating the job */ endDay: string; /** * The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. */ webhookUrl: string; /** * This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. */ webhookMethod: string; /** * The optional email to send the completion notification to */ email: string; /** * The unique job_sid returned when the custom export was created */ jobSid: string; /** * The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. */ details: any; /** * This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease */ jobQueuePosition: string; /** * this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position */ estimatedCompletionTime: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { friendlyName: string; resourceType: string; startDay: string; endDay: string; webhookUrl: string; webhookMethod: string; email: string; jobSid: string; details: any; jobQueuePosition: string; estimatedCompletionTime: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class ExportCustomJobPage extends Page<V1, ExportCustomJobPayload, ExportCustomJobResource, ExportCustomJobInstance> { /** * Initialize the ExportCustomJobPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: ExportCustomJobSolution); /** * Build an instance of ExportCustomJobInstance * * @param payload - Payload response from the API */ getInstance(payload: ExportCustomJobResource): ExportCustomJobInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/bulkexports/v1/exportConfiguration.js000064400000012521151677225100015047 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Bulkexports * 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.ExportConfigurationListInstance = exports.ExportConfigurationInstance = exports.ExportConfigurationContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class ExportConfigurationContextImpl { constructor(_version, resourceType) { this._version = _version; if (!(0, utility_1.isValidPathParam)(resourceType)) { throw new Error("Parameter 'resourceType' is not valid."); } this._solution = { resourceType }; this._uri = `/Exports/${resourceType}/Configuration`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ExportConfigurationInstance(operationVersion, payload, instance._solution.resourceType)); 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["enabled"] !== undefined) data["Enabled"] = serialize.bool(params["enabled"]); if (params["webhookUrl"] !== undefined) data["WebhookUrl"] = params["webhookUrl"]; if (params["webhookMethod"] !== undefined) data["WebhookMethod"] = params["webhookMethod"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ExportConfigurationInstance(operationVersion, payload, instance._solution.resourceType)); 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.ExportConfigurationContextImpl = ExportConfigurationContextImpl; class ExportConfigurationInstance { constructor(_version, payload, resourceType) { this._version = _version; this.enabled = payload.enabled; this.webhookUrl = payload.webhook_url; this.webhookMethod = payload.webhook_method; this.resourceType = payload.resource_type; this.url = payload.url; this._solution = { resourceType: resourceType || this.resourceType }; } get _proxy() { this._context = this._context || new ExportConfigurationContextImpl(this._version, this._solution.resourceType); return this._context; } /** * Fetch a ExportConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportConfigurationInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { enabled: this.enabled, webhookUrl: this.webhookUrl, webhookMethod: this.webhookMethod, resourceType: this.resourceType, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ExportConfigurationInstance = ExportConfigurationInstance; function ExportConfigurationListInstance(version) { const instance = ((resourceType) => instance.get(resourceType)); instance.get = function get(resourceType) { return new ExportConfigurationContextImpl(version, resourceType); }; 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; } exports.ExportConfigurationListInstance = ExportConfigurationListInstance; rest/bulkexports/v1/exportConfiguration.d.ts000064400000013444151677225100015310 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; /** * Options to pass to update a ExportConfigurationInstance */ export interface ExportConfigurationContextUpdateOptions { /** If true, Twilio will automatically generate every day\\\'s file when the day is over. */ enabled?: boolean; /** Stores the URL destination for the method specified in webhook_method. */ webhookUrl?: string; /** Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url */ webhookMethod?: string; } export interface ExportConfigurationContext { /** * Fetch a ExportConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportConfigurationInstance */ fetch(callback?: (error: Error | null, item?: ExportConfigurationInstance) => any): Promise<ExportConfigurationInstance>; /** * Update a ExportConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportConfigurationInstance */ update(callback?: (error: Error | null, item?: ExportConfigurationInstance) => any): Promise<ExportConfigurationInstance>; /** * Update a ExportConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportConfigurationInstance */ update(params: ExportConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: ExportConfigurationInstance) => any): Promise<ExportConfigurationInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ExportConfigurationContextSolution { resourceType: string; } export declare class ExportConfigurationContextImpl implements ExportConfigurationContext { protected _version: V1; protected _solution: ExportConfigurationContextSolution; protected _uri: string; constructor(_version: V1, resourceType: string); fetch(callback?: (error: Error | null, item?: ExportConfigurationInstance) => any): Promise<ExportConfigurationInstance>; update(params?: ExportConfigurationContextUpdateOptions | ((error: Error | null, item?: ExportConfigurationInstance) => any), callback?: (error: Error | null, item?: ExportConfigurationInstance) => any): Promise<ExportConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ExportConfigurationContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ExportConfigurationResource { enabled: boolean; webhook_url: string; webhook_method: string; resource_type: string; url: string; } export declare class ExportConfigurationInstance { protected _version: V1; protected _solution: ExportConfigurationContextSolution; protected _context?: ExportConfigurationContext; constructor(_version: V1, payload: ExportConfigurationResource, resourceType?: string); /** * If true, Twilio will automatically generate every day\'s file when the day is over. */ enabled: boolean; /** * Stores the URL destination for the method specified in webhook_method. */ webhookUrl: string; /** * Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url */ webhookMethod: string; /** * The type of communication – Messages, Calls, Conferences, and Participants */ resourceType: string; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a ExportConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportConfigurationInstance */ fetch(callback?: (error: Error | null, item?: ExportConfigurationInstance) => any): Promise<ExportConfigurationInstance>; /** * Update a ExportConfigurationInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportConfigurationInstance */ update(callback?: (error: Error | null, item?: ExportConfigurationInstance) => any): Promise<ExportConfigurationInstance>; /** * Update a ExportConfigurationInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ExportConfigurationInstance */ update(params: ExportConfigurationContextUpdateOptions, callback?: (error: Error | null, item?: ExportConfigurationInstance) => any): Promise<ExportConfigurationInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { enabled: boolean; webhookUrl: string; webhookMethod: string; resourceType: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ExportConfigurationSolution { } export interface ExportConfigurationListInstance { _version: V1; _solution: ExportConfigurationSolution; _uri: string; (resourceType: string): ExportConfigurationContext; get(resourceType: string): ExportConfigurationContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ExportConfigurationListInstance(version: V1): ExportConfigurationListInstance; export {}; rest/bulkexports/V1.js000064400000003071151677225100010736 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Bulkexports * 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 export_1 = require("./v1/export"); const exportConfiguration_1 = require("./v1/exportConfiguration"); class V1 extends Version_1.default { /** * Initialize the V1 version of Bulkexports * * @param domain - The Twilio (Twilio.Bulkexports) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for exports resource */ get exports() { this._exports = this._exports || (0, export_1.ExportListInstance)(this); return this._exports; } /** Getter for exportConfiguration resource */ get exportConfiguration() { this._exportConfiguration = this._exportConfiguration || (0, exportConfiguration_1.ExportConfigurationListInstance)(this); return this._exportConfiguration; } } exports.default = V1; rest/SyncBase.js000064400000002026151677225100007574 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./sync/V1")); class SyncBase extends Domain_1.default { /** * Initialize sync domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://sync.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = SyncBase; rest/MonitorBase.js000064400000002045151677225100010310 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./monitor/V1")); class MonitorBase extends Domain_1.default { /** * Initialize monitor domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://monitor.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = MonitorBase; rest/Trunking.js000064400000000742151677225100007671 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const TrunkingBase_1 = __importDefault(require("./TrunkingBase")); class Trunking extends TrunkingBase_1.default { /** * @deprecated - Use v1.trunks instead */ get trunks() { console.warn("trunks is deprecated. Use v1.trunks instead."); return this.v1.trunks; } } module.exports = Trunking; rest/Api.d.ts000064400000011272151677225100007035 0ustar00import { AccountContext, AccountListInstance } from "./api/v2010/account"; import { AddressListInstance } from "./api/v2010/account/address"; import { ApplicationListInstance } from "./api/v2010/account/application"; import { AuthorizedConnectAppListInstance } from "./api/v2010/account/authorizedConnectApp"; import { AvailablePhoneNumberCountryListInstance } from "./api/v2010/account/availablePhoneNumberCountry"; import { BalanceListInstance } from "./api/v2010/account/balance"; import { CallListInstance } from "./api/v2010/account/call"; import { ConferenceListInstance } from "./api/v2010/account/conference"; import { ConnectAppListInstance } from "./api/v2010/account/connectApp"; import { IncomingPhoneNumberListInstance } from "./api/v2010/account/incomingPhoneNumber"; import { KeyListInstance } from "./api/v2010/account/key"; import { MessageListInstance } from "./api/v2010/account/message"; import { NewKeyListInstance } from "./api/v2010/account/newKey"; import { NewSigningKeyListInstance } from "./api/v2010/account/newSigningKey"; import { NotificationListInstance } from "./api/v2010/account/notification"; import { OutgoingCallerIdListInstance } from "./api/v2010/account/outgoingCallerId"; import { QueueListInstance } from "./api/v2010/account/queue"; import { RecordingListInstance } from "./api/v2010/account/recording"; import { ShortCodeListInstance } from "./api/v2010/account/shortCode"; import { SigningKeyListInstance } from "./api/v2010/account/signingKey"; import { SipListInstance } from "./api/v2010/account/sip"; import { TokenListInstance } from "./api/v2010/account/token"; import { TranscriptionListInstance } from "./api/v2010/account/transcription"; import { UsageListInstance } from "./api/v2010/account/usage"; import { ValidationRequestListInstance } from "./api/v2010/account/validationRequest"; import ApiBase from "./ApiBase"; declare class Api extends ApiBase { get account(): AccountContext; get accounts(): AccountListInstance; /** * @deprecated - Use account.addresses instead */ get addresses(): AddressListInstance; /** * @deprecated - Use account.applications instead */ get applications(): ApplicationListInstance; /** * @deprecated - Use account.authorizedConnectApps instead */ get authorizedConnectApps(): AuthorizedConnectAppListInstance; /** * @deprecated - Use account.availablePhoneNumbers instead */ get availablePhoneNumbers(): AvailablePhoneNumberCountryListInstance; /** * @deprecated - Use account.balance instead */ get balance(): BalanceListInstance; /** * @deprecated - Use account.calls instead */ get calls(): CallListInstance; /** * @deprecated - Use account.conferences instead */ get conferences(): ConferenceListInstance; /** * @deprecated - Use account.connectApps instead */ get connectApps(): ConnectAppListInstance; /** * @deprecated - Use account.incomingPhoneNumbers instead */ get incomingPhoneNumbers(): IncomingPhoneNumberListInstance; /** * @deprecated - Use account.keys instead */ get keys(): KeyListInstance; /** * @deprecated - Use account.messages instead */ get messages(): MessageListInstance; /** * @deprecated - Use account.newKeys instead */ get newKeys(): NewKeyListInstance; /** * @deprecated - Use account.newSigningKeys instead */ get newSigningKeys(): NewSigningKeyListInstance; /** * @deprecated - Use account.notifications instead */ get notifications(): NotificationListInstance; /** * @deprecated - Use account.outgoingCallerIds instead */ get outgoingCallerIds(): OutgoingCallerIdListInstance; /** * @deprecated - Use account.queues instead */ get queues(): QueueListInstance; /** * @deprecated - Use account.recordings instead */ get recordings(): RecordingListInstance; /** * @deprecated - Use account.signingKeys instead */ get signingKeys(): SigningKeyListInstance; /** * @deprecated - Use account.sip instead */ get sip(): SipListInstance; /** * @deprecated - Use account.shortCodes instead */ get shortCodes(): ShortCodeListInstance; /** * @deprecated - Use account.tokens instead */ get tokens(): TokenListInstance; /** * @deprecated - Use account.transcriptions instead */ get transcriptions(): TranscriptionListInstance; /** * @deprecated - Use account.usage instead */ get usage(): UsageListInstance; /** * @deprecated - Use account.validationRequests instead */ get validationRequests(): ValidationRequestListInstance; } export = Api; rest/TaskrouterBase.d.ts000064400000000462151677225100011261 0ustar00import Domain from "../base/Domain"; import V1 from "./taskrouter/V1"; declare class TaskrouterBase extends Domain { _v1?: V1; /** * Initialize taskrouter domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = TaskrouterBase; rest/InsightsBase.js000064400000002052151677225100010447 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V1_1 = __importDefault(require("./insights/V1")); class InsightsBase extends Domain_1.default { /** * Initialize insights domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://insights.twilio.com"); } get v1() { this._v1 = this._v1 || new V1_1.default(this); return this._v1; } } module.exports = InsightsBase; rest/Taskrouter.js000064400000001000151677225100010217 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const TaskrouterBase_1 = __importDefault(require("./TaskrouterBase")); class Taskrouter extends TaskrouterBase_1.default { /** * @deprecated - Use v1.workspaces instead */ get workspaces() { console.warn("workspaces is deprecated. Use v1.workspaces instead."); return this.v1.workspaces; } } module.exports = Taskrouter; rest/ApiBase.js000064400000002046151677225100007373 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * 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 }; }; const Domain_1 = __importDefault(require("../base/Domain")); const V2010_1 = __importDefault(require("./api/V2010")); class ApiBase extends Domain_1.default { /** * Initialize api domain * * @param twilio - The twilio client */ constructor(twilio) { super(twilio, "https://api.twilio.com"); } get v2010() { this._v2010 = this._v2010 || new V2010_1.default(this); return this._v2010; } } module.exports = ApiBase; rest/Microvisor.js000064400000001240151677225100010216 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const MicrovisorBase_1 = __importDefault(require("./MicrovisorBase")); class Microvisor extends MicrovisorBase_1.default { /** * @deprecated - Use v1.apps instead */ get apps() { console.warn("apps is deprecated. Use v1.apps instead."); return this.v1.apps; } /** * @deprecated - Use v1.devices instead */ get devices() { console.warn("devices is deprecated. Use v1.devices instead."); return this.v1.devices; } } module.exports = Microvisor; rest/FlexApi.js000064400000003304151677225100007415 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const FlexApiBase_1 = __importDefault(require("./FlexApiBase")); class FlexApi extends FlexApiBase_1.default { /** * @deprecated - Use v1.assessments instead */ get assessments() { console.warn("assessments is deprecated. Use v1.assessments instead."); return this.v1.assessments; } /** * @deprecated - Use v1.channel instead */ get channel() { console.warn("channel is deprecated. Use v1.channel instead."); return this.v1.channel; } /** * @deprecated - Use v1.configuration instead */ get configuration() { console.warn("configuration is deprecated. Use v1.configuration instead."); return this.v1.configuration; } /** * @deprecated - Use v1.flexFlow instead */ get flexFlow() { console.warn("flexFlow is deprecated. Use v1.flexFlow instead."); return this.v1.flexFlow; } /** * @deprecated - Use v1.interaction instead */ get interaction() { console.warn("interaction is deprecated. Use v1.interaction instead."); return this.v1.interaction; } /** * @deprecated - Use v1.webChannel instead */ get webChannel() { console.warn("webChannel is deprecated. Use v1.webChannel instead."); return this.v1.webChannel; } /** * @deprecated - Use v2.webChannels instead */ get webChannels() { console.warn("webChannels is deprecated. Use v2.webChannels instead."); return this.v2.webChannels; } } module.exports = FlexApi; rest/Serverless.d.ts000064400000000435151677225100010460 0ustar00import { ServiceListInstance } from "./serverless/v1/service"; import ServerlessBase from "./ServerlessBase"; declare class Serverless extends ServerlessBase { /** * @deprecated - Use v1.services instead */ get services(): ServiceListInstance; } export = Serverless; rest/intelligence/V2.d.ts000064400000005360151677225100011256 0ustar00import IntelligenceBase from "../IntelligenceBase"; import Version from "../../base/Version"; import { CustomOperatorListInstance } from "./v2/customOperator"; import { OperatorListInstance } from "./v2/operator"; import { OperatorAttachmentListInstance } from "./v2/operatorAttachment"; import { OperatorAttachmentsListInstance } from "./v2/operatorAttachments"; import { OperatorTypeListInstance } from "./v2/operatorType"; import { PrebuiltOperatorListInstance } from "./v2/prebuiltOperator"; import { ServiceListInstance } from "./v2/service"; import { TranscriptListInstance } from "./v2/transcript"; export default class V2 extends Version { /** * Initialize the V2 version of Intelligence * * @param domain - The Twilio (Twilio.Intelligence) domain */ constructor(domain: IntelligenceBase); /** customOperators - { Twilio.Intelligence.V2.CustomOperatorListInstance } resource */ protected _customOperators?: CustomOperatorListInstance; /** operators - { Twilio.Intelligence.V2.OperatorListInstance } resource */ protected _operators?: OperatorListInstance; /** operatorAttachment - { Twilio.Intelligence.V2.OperatorAttachmentListInstance } resource */ protected _operatorAttachment?: OperatorAttachmentListInstance; /** operatorAttachments - { Twilio.Intelligence.V2.OperatorAttachmentsListInstance } resource */ protected _operatorAttachments?: OperatorAttachmentsListInstance; /** operatorType - { Twilio.Intelligence.V2.OperatorTypeListInstance } resource */ protected _operatorType?: OperatorTypeListInstance; /** prebuiltOperators - { Twilio.Intelligence.V2.PrebuiltOperatorListInstance } resource */ protected _prebuiltOperators?: PrebuiltOperatorListInstance; /** services - { Twilio.Intelligence.V2.ServiceListInstance } resource */ protected _services?: ServiceListInstance; /** transcripts - { Twilio.Intelligence.V2.TranscriptListInstance } resource */ protected _transcripts?: TranscriptListInstance; /** Getter for customOperators resource */ get customOperators(): CustomOperatorListInstance; /** Getter for operators resource */ get operators(): OperatorListInstance; /** Getter for operatorAttachment resource */ get operatorAttachment(): OperatorAttachmentListInstance; /** Getter for operatorAttachments resource */ get operatorAttachments(): OperatorAttachmentsListInstance; /** Getter for operatorType resource */ get operatorType(): OperatorTypeListInstance; /** Getter for prebuiltOperators resource */ get prebuiltOperators(): PrebuiltOperatorListInstance; /** Getter for services resource */ get services(): ServiceListInstance; /** Getter for transcripts resource */ get transcripts(): TranscriptListInstance; } rest/intelligence/V2.js000064400000006357151677225100011031 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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 customOperator_1 = require("./v2/customOperator"); const operator_1 = require("./v2/operator"); const operatorAttachment_1 = require("./v2/operatorAttachment"); const operatorAttachments_1 = require("./v2/operatorAttachments"); const operatorType_1 = require("./v2/operatorType"); const prebuiltOperator_1 = require("./v2/prebuiltOperator"); const service_1 = require("./v2/service"); const transcript_1 = require("./v2/transcript"); class V2 extends Version_1.default { /** * Initialize the V2 version of Intelligence * * @param domain - The Twilio (Twilio.Intelligence) domain */ constructor(domain) { super(domain, "v2"); } /** Getter for customOperators resource */ get customOperators() { this._customOperators = this._customOperators || (0, customOperator_1.CustomOperatorListInstance)(this); return this._customOperators; } /** Getter for operators resource */ get operators() { this._operators = this._operators || (0, operator_1.OperatorListInstance)(this); return this._operators; } /** Getter for operatorAttachment resource */ get operatorAttachment() { this._operatorAttachment = this._operatorAttachment || (0, operatorAttachment_1.OperatorAttachmentListInstance)(this); return this._operatorAttachment; } /** Getter for operatorAttachments resource */ get operatorAttachments() { this._operatorAttachments = this._operatorAttachments || (0, operatorAttachments_1.OperatorAttachmentsListInstance)(this); return this._operatorAttachments; } /** Getter for operatorType resource */ get operatorType() { this._operatorType = this._operatorType || (0, operatorType_1.OperatorTypeListInstance)(this); return this._operatorType; } /** Getter for prebuiltOperators resource */ get prebuiltOperators() { this._prebuiltOperators = this._prebuiltOperators || (0, prebuiltOperator_1.PrebuiltOperatorListInstance)(this); return this._prebuiltOperators; } /** Getter for services resource */ get services() { this._services = this._services || (0, service_1.ServiceListInstance)(this); return this._services; } /** Getter for transcripts resource */ get transcripts() { this._transcripts = this._transcripts || (0, transcript_1.TranscriptListInstance)(this); return this._transcripts; } } exports.default = V2; rest/intelligence/v2/transcript.d.ts000064400000032421151677225100013505 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; import { MediaListInstance } from "./transcript/media"; import { OperatorResultListInstance } from "./transcript/operatorResult"; import { SentenceListInstance } from "./transcript/sentence"; export type TranscriptStatus = "queued" | "in-progress" | "completed" | "failed" | "canceled"; /** * Options to pass to create a TranscriptInstance */ export interface TranscriptListInstanceCreateOptions { /** The unique SID identifier of the Service. */ serviceSid: string; /** JSON object describing Media Channel including Source and Participants */ channel: any; /** Used to store client provided metadata. Maximum of 64 double-byte UTF8 characters. */ customerKey?: string; /** The date that this Transcript\\\'s media was started, given in ISO 8601 format. */ mediaStartTime?: Date; } /** * Options to pass to each */ export interface TranscriptListInstanceEachOptions { /** The unique SID identifier of the Service. */ serviceSid?: string; /** Filter by before StartTime. */ beforeStartTime?: string; /** Filter by after StartTime. */ afterStartTime?: string; /** Filter by before DateCreated. */ beforeDateCreated?: string; /** Filter by after DateCreated. */ afterDateCreated?: string; /** Filter by status. */ status?: string; /** Filter by Language Code. */ languageCode?: string; /** Filter by SourceSid. */ sourceSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: TranscriptInstance, 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 TranscriptListInstanceOptions { /** The unique SID identifier of the Service. */ serviceSid?: string; /** Filter by before StartTime. */ beforeStartTime?: string; /** Filter by after StartTime. */ afterStartTime?: string; /** Filter by before DateCreated. */ beforeDateCreated?: string; /** Filter by after DateCreated. */ afterDateCreated?: string; /** Filter by status. */ status?: string; /** Filter by Language Code. */ languageCode?: string; /** Filter by SourceSid. */ sourceSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface TranscriptListInstancePageOptions { /** The unique SID identifier of the Service. */ serviceSid?: string; /** Filter by before StartTime. */ beforeStartTime?: string; /** Filter by after StartTime. */ afterStartTime?: string; /** Filter by before DateCreated. */ beforeDateCreated?: string; /** Filter by after DateCreated. */ afterDateCreated?: string; /** Filter by status. */ status?: string; /** Filter by Language Code. */ languageCode?: string; /** Filter by SourceSid. */ sourceSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface TranscriptContext { media: MediaListInstance; operatorResults: OperatorResultListInstance; sentences: SentenceListInstance; /** * Remove a TranscriptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TranscriptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptInstance */ fetch(callback?: (error: Error | null, item?: TranscriptInstance) => any): Promise<TranscriptInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface TranscriptContextSolution { sid: string; } export declare class TranscriptContextImpl implements TranscriptContext { protected _version: V2; protected _solution: TranscriptContextSolution; protected _uri: string; protected _media?: MediaListInstance; protected _operatorResults?: OperatorResultListInstance; protected _sentences?: SentenceListInstance; constructor(_version: V2, sid: string); get media(): MediaListInstance; get operatorResults(): OperatorResultListInstance; get sentences(): SentenceListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: TranscriptInstance) => any): Promise<TranscriptInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): TranscriptContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface TranscriptPayload extends TwilioResponsePayload { transcripts: TranscriptResource[]; } interface TranscriptResource { account_sid: string; service_sid: string; sid: string; date_created: Date; date_updated: Date; status: TranscriptStatus; channel: any; data_logging: boolean; language_code: string; customer_key: string; media_start_time: Date; duration: number; url: string; redaction: boolean; links: Record<string, string>; } export declare class TranscriptInstance { protected _version: V2; protected _solution: TranscriptContextSolution; protected _context?: TranscriptContext; constructor(_version: V2, payload: TranscriptResource, sid?: string); /** * The unique SID identifier of the Account. */ accountSid: string; /** * The unique SID identifier of the Service. */ serviceSid: string; /** * A 34 character string that uniquely identifies this Transcript. */ sid: string; /** * The date that this Transcript was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this Transcript was updated, given in ISO 8601 format. */ dateUpdated: Date; status: TranscriptStatus; /** * Media Channel describing Transcript Source and Participant Mapping */ channel: any; /** * Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. */ dataLogging: boolean; /** * The default language code of the audio. */ languageCode: string; customerKey: string; /** * The date that this Transcript\'s media was started, given in ISO 8601 format. */ mediaStartTime: Date; /** * The duration of this Transcript\'s source */ duration: number; /** * The URL of this resource. */ url: string; /** * If the transcript has been redacted, a redacted alternative of the transcript will be available. */ redaction: boolean; links: Record<string, string>; private get _proxy(); /** * Remove a TranscriptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a TranscriptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptInstance */ fetch(callback?: (error: Error | null, item?: TranscriptInstance) => any): Promise<TranscriptInstance>; /** * Access the media. */ media(): MediaListInstance; /** * Access the operatorResults. */ operatorResults(): OperatorResultListInstance; /** * Access the sentences. */ sentences(): SentenceListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; serviceSid: string; sid: string; dateCreated: Date; dateUpdated: Date; status: TranscriptStatus; channel: any; dataLogging: boolean; languageCode: string; customerKey: string; mediaStartTime: Date; duration: number; url: string; redaction: boolean; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface TranscriptSolution { } export interface TranscriptListInstance { _version: V2; _solution: TranscriptSolution; _uri: string; (sid: string): TranscriptContext; get(sid: string): TranscriptContext; /** * Create a TranscriptInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptInstance */ create(params: TranscriptListInstanceCreateOptions, callback?: (error: Error | null, item?: TranscriptInstance) => any): Promise<TranscriptInstance>; /** * Streams TranscriptInstance 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 { TranscriptListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: TranscriptInstance, done: (err?: Error) => void) => void): void; each(params: TranscriptListInstanceEachOptions, callback?: (item: TranscriptInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of TranscriptInstance 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: TranscriptPage) => any): Promise<TranscriptPage>; /** * Lists TranscriptInstance 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 { TranscriptListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: TranscriptInstance[]) => any): Promise<TranscriptInstance[]>; list(params: TranscriptListInstanceOptions, callback?: (error: Error | null, items: TranscriptInstance[]) => any): Promise<TranscriptInstance[]>; /** * Retrieve a single page of TranscriptInstance 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 { TranscriptListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: TranscriptPage) => any): Promise<TranscriptPage>; page(params: TranscriptListInstancePageOptions, callback?: (error: Error | null, items: TranscriptPage) => any): Promise<TranscriptPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function TranscriptListInstance(version: V2): TranscriptListInstance; export declare class TranscriptPage extends Page<V2, TranscriptPayload, TranscriptResource, TranscriptInstance> { /** * Initialize the TranscriptPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: TranscriptSolution); /** * Build an instance of TranscriptInstance * * @param payload - Payload response from the API */ getInstance(payload: TranscriptResource): TranscriptInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/intelligence/v2/operatorAttachments.js000064400000007625151677225100015117 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.OperatorAttachmentsListInstance = exports.OperatorAttachmentsInstance = exports.OperatorAttachmentsContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class OperatorAttachmentsContextImpl { constructor(_version, serviceSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } this._solution = { serviceSid }; this._uri = `/Services/${serviceSid}/Operators`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new OperatorAttachmentsInstance(operationVersion, payload, instance._solution.serviceSid)); 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.OperatorAttachmentsContextImpl = OperatorAttachmentsContextImpl; class OperatorAttachmentsInstance { constructor(_version, payload, serviceSid) { this._version = _version; this.serviceSid = payload.service_sid; this.operatorSids = payload.operator_sids; this.url = payload.url; this._solution = { serviceSid: serviceSid || this.serviceSid }; } get _proxy() { this._context = this._context || new OperatorAttachmentsContextImpl(this._version, this._solution.serviceSid); return this._context; } /** * Fetch a OperatorAttachmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorAttachmentsInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { serviceSid: this.serviceSid, operatorSids: this.operatorSids, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OperatorAttachmentsInstance = OperatorAttachmentsInstance; function OperatorAttachmentsListInstance(version) { const instance = ((serviceSid) => instance.get(serviceSid)); instance.get = function get(serviceSid) { return new OperatorAttachmentsContextImpl(version, serviceSid); }; 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; } exports.OperatorAttachmentsListInstance = OperatorAttachmentsListInstance; rest/intelligence/v2/service.d.ts000064400000037160151677225100012761 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; export type ServiceHttpMethod = "GET" | "POST" | "NULL"; /** * Options to pass to update a ServiceInstance */ export interface ServiceContextUpdateOptions { /** The If-Match HTTP request header */ ifMatch?: string; /** Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. */ autoTranscribe?: boolean; /** Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. */ dataLogging?: boolean; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; /** Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. */ uniqueName?: string; /** Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. */ autoRedaction?: boolean; /** Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. */ mediaRedaction?: boolean; /** The URL Twilio will request when executing the Webhook. */ webhookUrl?: string; /** */ webhookHttpMethod?: ServiceHttpMethod; } /** * Options to pass to create a ServiceInstance */ export interface ServiceListInstanceCreateOptions { /** Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. */ uniqueName: string; /** Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. */ autoTranscribe?: boolean; /** Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. */ dataLogging?: boolean; /** A human readable description of this resource, up to 64 characters. */ friendlyName?: string; /** The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it\\\'s set. */ languageCode?: string; /** Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. */ autoRedaction?: boolean; /** Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. */ mediaRedaction?: boolean; /** The URL Twilio will request when executing the Webhook. */ webhookUrl?: string; /** */ webhookHttpMethod?: ServiceHttpMethod; } /** * Options to pass to each */ export interface ServiceListInstanceEachOptions { /** 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: ServiceInstance, 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 ServiceListInstanceOptions { /** 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 ServiceListInstancePageOptions { /** 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 ServiceContext { /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface ServiceContextSolution { sid: string; } export declare class ServiceContextImpl implements ServiceContext { protected _version: V2; protected _solution: ServiceContextSolution; protected _uri: string; constructor(_version: V2, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; update(params?: ServiceContextUpdateOptions | ((error: Error | null, item?: ServiceInstance) => any), callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): ServiceContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface ServicePayload extends TwilioResponsePayload { services: ServiceResource[]; } interface ServiceResource { account_sid: string; auto_redaction: boolean; media_redaction: boolean; auto_transcribe: boolean; data_logging: boolean; date_created: Date; date_updated: Date; friendly_name: string; language_code: string; sid: string; unique_name: string; url: string; webhook_url: string; webhook_http_method: ServiceHttpMethod; read_only_attached_operator_sids: Array<string>; version: number; } export declare class ServiceInstance { protected _version: V2; protected _solution: ServiceContextSolution; protected _context?: ServiceContext; constructor(_version: V2, payload: ServiceResource, sid?: string); /** * The unique SID identifier of the Account the Service belongs to. */ accountSid: string; /** * Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. */ autoRedaction: boolean; /** * Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. */ mediaRedaction: boolean; /** * Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. */ autoTranscribe: boolean; /** * Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent. */ dataLogging: boolean; /** * The date that this Service was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this Service was updated, given in ISO 8601 format. */ dateUpdated: Date; /** * A human readable description of this resource, up to 64 characters. */ friendlyName: string; /** * The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it\'s set. */ languageCode: string; /** * A 34 character string that uniquely identifies this Service. */ sid: string; /** * Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. */ uniqueName: string; /** * The URL of this resource. */ url: string; /** * The URL Twilio will request when executing the Webhook. */ webhookUrl: string; webhookHttpMethod: ServiceHttpMethod; /** * Operator sids attached to this service, read only */ readOnlyAttachedOperatorSids: Array<string>; /** * The version number of this Service. */ version: number; private get _proxy(); /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Update a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ update(params: ServiceContextUpdateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; autoRedaction: boolean; mediaRedaction: boolean; autoTranscribe: boolean; dataLogging: boolean; dateCreated: Date; dateUpdated: Date; friendlyName: string; languageCode: string; sid: string; uniqueName: string; url: string; webhookUrl: string; webhookHttpMethod: ServiceHttpMethod; readOnlyAttachedOperatorSids: string[]; version: number; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface ServiceSolution { } export interface ServiceListInstance { _version: V2; _solution: ServiceSolution; _uri: string; (sid: string): ServiceContext; get(sid: string): ServiceContext; /** * Create a ServiceInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ create(params: ServiceListInstanceCreateOptions, callback?: (error: Error | null, item?: ServiceInstance) => any): Promise<ServiceInstance>; /** * Streams ServiceInstance 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 { ServiceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; each(params: ServiceListInstanceEachOptions, callback?: (item: ServiceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of ServiceInstance 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: ServicePage) => any): Promise<ServicePage>; /** * Lists ServiceInstance 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 { ServiceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; list(params: ServiceListInstanceOptions, callback?: (error: Error | null, items: ServiceInstance[]) => any): Promise<ServiceInstance[]>; /** * Retrieve a single page of ServiceInstance 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 { ServiceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; page(params: ServiceListInstancePageOptions, callback?: (error: Error | null, items: ServicePage) => any): Promise<ServicePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function ServiceListInstance(version: V2): ServiceListInstance; export declare class ServicePage extends Page<V2, ServicePayload, ServiceResource, ServiceInstance> { /** * Initialize the ServicePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: ServiceSolution); /** * Build an instance of ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload: ServiceResource): ServiceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/intelligence/v2/customOperator.js000064400000025304151677225100014110 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.CustomOperatorPage = exports.CustomOperatorListInstance = exports.CustomOperatorInstance = exports.CustomOperatorContextImpl = void 0; 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 CustomOperatorContextImpl { 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 = `/Operators/Custom/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CustomOperatorInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["config"] === null || params["config"] === undefined) { throw new Error("Required parameter \"params['config']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["Config"] = serialize.object(params["config"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CustomOperatorInstance(operationVersion, payload, 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.CustomOperatorContextImpl = CustomOperatorContextImpl; class CustomOperatorInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.description = payload.description; this.author = payload.author; this.operatorType = payload.operator_type; this.version = deserialize.integer(payload.version); this.availability = payload.availability; this.config = payload.config; 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 CustomOperatorContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CustomOperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CustomOperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomOperatorInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, friendlyName: this.friendlyName, description: this.description, author: this.author, operatorType: this.operatorType, version: this.version, availability: this.availability, config: this.config, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomOperatorInstance = CustomOperatorInstance; function CustomOperatorListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CustomOperatorContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Operators/Custom`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["friendlyName"] === null || params["friendlyName"] === undefined) { throw new Error("Required parameter \"params['friendlyName']\" missing."); } if (params["operatorType"] === null || params["operatorType"] === undefined) { throw new Error("Required parameter \"params['operatorType']\" missing."); } if (params["config"] === null || params["config"] === undefined) { throw new Error("Required parameter \"params['config']\" missing."); } let data = {}; data["FriendlyName"] = params["friendlyName"]; data["OperatorType"] = params["operatorType"]; data["Config"] = serialize.object(params["config"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CustomOperatorInstance(operationVersion, payload)); 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["availability"] !== undefined) data["Availability"] = params["availability"]; if (params["languageCode"] !== undefined) data["LanguageCode"] = params["languageCode"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CustomOperatorPage(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 CustomOperatorPage(instance._version, payload, 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; } exports.CustomOperatorListInstance = CustomOperatorListInstance; class CustomOperatorPage extends Page_1.default { /** * Initialize the CustomOperatorPage * * @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 CustomOperatorInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CustomOperatorInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CustomOperatorPage = CustomOperatorPage; rest/intelligence/v2/operatorType.js000064400000016220151677225100013554 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.OperatorTypePage = exports.OperatorTypeListInstance = exports.OperatorTypeInstance = exports.OperatorTypeContextImpl = void 0; 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 OperatorTypeContextImpl { 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 = `/OperatorTypes/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new OperatorTypeInstance(operationVersion, payload, 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.OperatorTypeContextImpl = OperatorTypeContextImpl; class OperatorTypeInstance { constructor(_version, payload, sid) { this._version = _version; this.name = payload.name; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.description = payload.description; this.docsLink = payload.docs_link; this.outputType = payload.output_type; this.supportedLanguages = payload.supported_languages; this.provider = payload.provider; this.availability = payload.availability; this.configurable = payload.configurable; this.configSchema = payload.config_schema; 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 OperatorTypeContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a OperatorTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorTypeInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { name: this.name, sid: this.sid, friendlyName: this.friendlyName, description: this.description, docsLink: this.docsLink, outputType: this.outputType, supportedLanguages: this.supportedLanguages, provider: this.provider, availability: this.availability, configurable: this.configurable, configSchema: this.configSchema, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OperatorTypeInstance = OperatorTypeInstance; function OperatorTypeListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new OperatorTypeContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/OperatorTypes`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new OperatorTypePage(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 OperatorTypePage(instance._version, payload, 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; } exports.OperatorTypeListInstance = OperatorTypeListInstance; class OperatorTypePage extends Page_1.default { /** * Initialize the OperatorTypePage * * @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 OperatorTypeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new OperatorTypeInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OperatorTypePage = OperatorTypePage; rest/intelligence/v2/customOperator.d.ts000064400000031620151677225100014342 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; export type CustomOperatorAvailability = "internal" | "beta" | "public" | "retired"; /** * Options to pass to update a CustomOperatorInstance */ export interface CustomOperatorContextUpdateOptions { /** A human-readable name of this resource, up to 64 characters. */ friendlyName: string; /** Operator configuration, following the schema defined by the Operator Type. */ config: any; /** The If-Match HTTP request header */ ifMatch?: string; } /** * Options to pass to create a CustomOperatorInstance */ export interface CustomOperatorListInstanceCreateOptions { /** A human readable description of the new Operator, up to 64 characters. */ friendlyName: string; /** Operator Type for this Operator. References an existing Operator Type resource. */ operatorType: string; /** Operator configuration, following the schema defined by the Operator Type. */ config: any; } /** * Options to pass to each */ export interface CustomOperatorListInstanceEachOptions { /** Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. */ availability?: CustomOperatorAvailability; /** Returns Custom Operators that support the provided language code. */ languageCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CustomOperatorInstance, 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 CustomOperatorListInstanceOptions { /** Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. */ availability?: CustomOperatorAvailability; /** Returns Custom Operators that support the provided language code. */ languageCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CustomOperatorListInstancePageOptions { /** Returns Custom Operators with the provided availability type. Possible values: internal, beta, public, retired. */ availability?: CustomOperatorAvailability; /** Returns Custom Operators that support the provided language code. */ languageCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CustomOperatorContext { /** * Remove a CustomOperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CustomOperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomOperatorInstance */ fetch(callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>; /** * Update a CustomOperatorInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomOperatorInstance */ update(params: CustomOperatorContextUpdateOptions, callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CustomOperatorContextSolution { sid: string; } export declare class CustomOperatorContextImpl implements CustomOperatorContext { protected _version: V2; protected _solution: CustomOperatorContextSolution; protected _uri: string; constructor(_version: V2, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>; update(params: CustomOperatorContextUpdateOptions, callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CustomOperatorContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CustomOperatorPayload extends TwilioResponsePayload { operators: CustomOperatorResource[]; } interface CustomOperatorResource { account_sid: string; sid: string; friendly_name: string; description: string; author: string; operator_type: string; version: number; availability: CustomOperatorAvailability; config: any; date_created: Date; date_updated: Date; url: string; } export declare class CustomOperatorInstance { protected _version: V2; protected _solution: CustomOperatorContextSolution; protected _context?: CustomOperatorContext; constructor(_version: V2, payload: CustomOperatorResource, sid?: string); /** * The unique SID identifier of the Account the Custom Operator belongs to. */ accountSid: string; /** * A 34 character string that uniquely identifies this Custom Operator. */ sid: string; /** * A human-readable name of this resource, up to 64 characters. */ friendlyName: string; /** * A human-readable description of this resource, longer than the friendly name. */ description: string; /** * The creator of the Custom Operator. Custom Operators can only be created by a Twilio Account. */ author: string; /** * Operator Type for this Operator. References an existing Operator Type resource. */ operatorType: string; /** * Numeric Custom Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Custom Operator. */ version: number; availability: CustomOperatorAvailability; /** * Operator configuration, following the schema defined by the Operator Type. Only available on Operators created by the Account. */ config: any; /** * The date that this Custom Operator was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this Custom Operator was updated, given in ISO 8601 format. */ dateUpdated: Date; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Remove a CustomOperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CustomOperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomOperatorInstance */ fetch(callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>; /** * Update a CustomOperatorInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomOperatorInstance */ update(params: CustomOperatorContextUpdateOptions, callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; friendlyName: string; description: string; author: string; operatorType: string; version: number; availability: CustomOperatorAvailability; config: any; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CustomOperatorSolution { } export interface CustomOperatorListInstance { _version: V2; _solution: CustomOperatorSolution; _uri: string; (sid: string): CustomOperatorContext; get(sid: string): CustomOperatorContext; /** * Create a CustomOperatorInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CustomOperatorInstance */ create(params: CustomOperatorListInstanceCreateOptions, callback?: (error: Error | null, item?: CustomOperatorInstance) => any): Promise<CustomOperatorInstance>; /** * Streams CustomOperatorInstance 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 { CustomOperatorListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CustomOperatorInstance, done: (err?: Error) => void) => void): void; each(params: CustomOperatorListInstanceEachOptions, callback?: (item: CustomOperatorInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CustomOperatorInstance 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: CustomOperatorPage) => any): Promise<CustomOperatorPage>; /** * Lists CustomOperatorInstance 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 { CustomOperatorListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CustomOperatorInstance[]) => any): Promise<CustomOperatorInstance[]>; list(params: CustomOperatorListInstanceOptions, callback?: (error: Error | null, items: CustomOperatorInstance[]) => any): Promise<CustomOperatorInstance[]>; /** * Retrieve a single page of CustomOperatorInstance 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 { CustomOperatorListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CustomOperatorPage) => any): Promise<CustomOperatorPage>; page(params: CustomOperatorListInstancePageOptions, callback?: (error: Error | null, items: CustomOperatorPage) => any): Promise<CustomOperatorPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CustomOperatorListInstance(version: V2): CustomOperatorListInstance; export declare class CustomOperatorPage extends Page<V2, CustomOperatorPayload, CustomOperatorResource, CustomOperatorInstance> { /** * Initialize the CustomOperatorPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: CustomOperatorSolution); /** * Build an instance of CustomOperatorInstance * * @param payload - Payload response from the API */ getInstance(payload: CustomOperatorResource): CustomOperatorInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/intelligence/v2/service.js000064400000027357151677225100012534 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.ServicePage = exports.ServiceListInstance = exports.ServiceInstance = exports.ServiceContextImpl = void 0; 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 ServiceContextImpl { 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 = `/Services/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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["autoTranscribe"] !== undefined) data["AutoTranscribe"] = serialize.bool(params["autoTranscribe"]); if (params["dataLogging"] !== undefined) data["DataLogging"] = serialize.bool(params["dataLogging"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["autoRedaction"] !== undefined) data["AutoRedaction"] = serialize.bool(params["autoRedaction"]); if (params["mediaRedaction"] !== undefined) data["MediaRedaction"] = serialize.bool(params["mediaRedaction"]); if (params["webhookUrl"] !== undefined) data["WebhookUrl"] = params["webhookUrl"]; if (params["webhookHttpMethod"] !== undefined) data["WebhookHttpMethod"] = params["webhookHttpMethod"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; if (params["ifMatch"] !== undefined) headers["If-Match"] = params["ifMatch"]; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload, 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.ServiceContextImpl = ServiceContextImpl; class ServiceInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.autoRedaction = payload.auto_redaction; this.mediaRedaction = payload.media_redaction; this.autoTranscribe = payload.auto_transcribe; this.dataLogging = payload.data_logging; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.friendlyName = payload.friendly_name; this.languageCode = payload.language_code; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.url = payload.url; this.webhookUrl = payload.webhook_url; this.webhookHttpMethod = payload.webhook_http_method; this.readOnlyAttachedOperatorSids = payload.read_only_attached_operator_sids; this.version = deserialize.integer(payload.version); this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new ServiceContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a ServiceInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed ServiceInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, autoRedaction: this.autoRedaction, mediaRedaction: this.mediaRedaction, autoTranscribe: this.autoTranscribe, dataLogging: this.dataLogging, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, friendlyName: this.friendlyName, languageCode: this.languageCode, sid: this.sid, uniqueName: this.uniqueName, url: this.url, webhookUrl: this.webhookUrl, webhookHttpMethod: this.webhookHttpMethod, readOnlyAttachedOperatorSids: this.readOnlyAttachedOperatorSids, version: this.version, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServiceInstance = ServiceInstance; function ServiceListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new ServiceContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Services`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["uniqueName"] === null || params["uniqueName"] === undefined) { throw new Error("Required parameter \"params['uniqueName']\" missing."); } let data = {}; data["UniqueName"] = params["uniqueName"]; if (params["autoTranscribe"] !== undefined) data["AutoTranscribe"] = serialize.bool(params["autoTranscribe"]); if (params["dataLogging"] !== undefined) data["DataLogging"] = serialize.bool(params["dataLogging"]); if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["languageCode"] !== undefined) data["LanguageCode"] = params["languageCode"]; if (params["autoRedaction"] !== undefined) data["AutoRedaction"] = serialize.bool(params["autoRedaction"]); if (params["mediaRedaction"] !== undefined) data["MediaRedaction"] = serialize.bool(params["mediaRedaction"]); if (params["webhookUrl"] !== undefined) data["WebhookUrl"] = params["webhookUrl"]; if (params["webhookHttpMethod"] !== undefined) data["WebhookHttpMethod"] = params["webhookHttpMethod"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new ServiceInstance(operationVersion, payload)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new ServicePage(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 ServicePage(instance._version, payload, 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; } exports.ServiceListInstance = ServiceListInstance; class ServicePage extends Page_1.default { /** * Initialize the ServicePage * * @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 ServiceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new ServiceInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.ServicePage = ServicePage; rest/intelligence/v2/transcript/sentence.d.ts000064400000015543151677225100015317 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; /** * Options to pass to each */ export interface SentenceListInstanceEachOptions { /** Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. */ redacted?: boolean; /** 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: SentenceInstance, 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 SentenceListInstanceOptions { /** Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. */ redacted?: boolean; /** 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 SentenceListInstancePageOptions { /** Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. */ redacted?: boolean; /** 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 SentenceSolution { transcriptSid: string; } export interface SentenceListInstance { _version: V2; _solution: SentenceSolution; _uri: string; /** * Streams SentenceInstance 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 { SentenceListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SentenceInstance, done: (err?: Error) => void) => void): void; each(params: SentenceListInstanceEachOptions, callback?: (item: SentenceInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SentenceInstance 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: SentencePage) => any): Promise<SentencePage>; /** * Lists SentenceInstance 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 { SentenceListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SentenceInstance[]) => any): Promise<SentenceInstance[]>; list(params: SentenceListInstanceOptions, callback?: (error: Error | null, items: SentenceInstance[]) => any): Promise<SentenceInstance[]>; /** * Retrieve a single page of SentenceInstance 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 { SentenceListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SentencePage) => any): Promise<SentencePage>; page(params: SentenceListInstancePageOptions, callback?: (error: Error | null, items: SentencePage) => any): Promise<SentencePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SentenceListInstance(version: V2, transcriptSid: string): SentenceListInstance; interface SentencePayload extends TwilioResponsePayload { sentences: SentenceResource[]; } interface SentenceResource { media_channel: number; sentence_index: number; start_time: number; end_time: number; transcript: string; sid: string; confidence: number; } export declare class SentenceInstance { protected _version: V2; constructor(_version: V2, payload: SentenceResource, transcriptSid: string); /** * The channel number. */ mediaChannel: number; /** * The index of the sentence in the transcript. */ sentenceIndex: number; /** * Offset from the beginning of the transcript when this sentence starts. */ startTime: number; /** * Offset from the beginning of the transcript when this sentence ends. */ endTime: number; /** * Transcript text. */ transcript: string; /** * A 34 character string that uniquely identifies this Sentence. */ sid: string; confidence: number; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { mediaChannel: number; sentenceIndex: number; startTime: number; endTime: number; transcript: string; sid: string; confidence: number; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class SentencePage extends Page<V2, SentencePayload, SentenceResource, SentenceInstance> { /** * Initialize the SentencePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: SentenceSolution); /** * Build an instance of SentenceInstance * * @param payload - Payload response from the API */ getInstance(payload: SentenceResource): SentenceInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/intelligence/v2/transcript/operatorResult.d.ts000064400000027352151677225100016546 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V2 from "../../V2"; export type OperatorResultOperatorType = "conversation_classify" | "utterance_classify" | "extract" | "extract_normalize" | "pii_extract"; /** * Options to pass to fetch a OperatorResultInstance */ export interface OperatorResultContextFetchOptions { /** Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. */ redacted?: boolean; } /** * Options to pass to each */ export interface OperatorResultListInstanceEachOptions { /** Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. */ redacted?: boolean; /** 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: OperatorResultInstance, 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 OperatorResultListInstanceOptions { /** Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. */ redacted?: boolean; /** 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 OperatorResultListInstancePageOptions { /** Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. */ redacted?: boolean; /** 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 OperatorResultContext { /** * Fetch a OperatorResultInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorResultInstance */ fetch(callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>; /** * Fetch a OperatorResultInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorResultInstance */ fetch(params: OperatorResultContextFetchOptions, callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface OperatorResultContextSolution { transcriptSid: string; operatorSid: string; } export declare class OperatorResultContextImpl implements OperatorResultContext { protected _version: V2; protected _solution: OperatorResultContextSolution; protected _uri: string; constructor(_version: V2, transcriptSid: string, operatorSid: string); fetch(params?: OperatorResultContextFetchOptions | ((error: Error | null, item?: OperatorResultInstance) => any), callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): OperatorResultContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface OperatorResultPayload extends TwilioResponsePayload { operator_results: OperatorResultResource[]; } interface OperatorResultResource { operator_type: OperatorResultOperatorType; name: string; operator_sid: string; extract_match: boolean; match_probability: number; normalized_result: string; utterance_results: Array<any>; utterance_match: boolean; predicted_label: string; predicted_probability: number; label_probabilities: any; extract_results: any; text_generation_results: any; transcript_sid: string; url: string; } export declare class OperatorResultInstance { protected _version: V2; protected _solution: OperatorResultContextSolution; protected _context?: OperatorResultContext; constructor(_version: V2, payload: OperatorResultResource, transcriptSid: string, operatorSid?: string); operatorType: OperatorResultOperatorType; /** * The name of the applied Language Understanding. */ name: string; /** * A 34 character string that identifies this Language Understanding operator sid. */ operatorSid: string; /** * Boolean to tell if extract Language Understanding Processing model matches results. */ extractMatch: boolean; /** * Percentage of \'matching\' class needed to consider a sentence matches */ matchProbability: number; /** * Normalized output of extraction stage which matches Label. */ normalizedResult: string; /** * List of mapped utterance object which matches sentences. */ utteranceResults: Array<any>; /** * Boolean to tell if Utterance matches results. */ utteranceMatch: boolean; /** * The \'matching\' class. This might be available on conversation classify model outputs. */ predictedLabel: string; /** * Percentage of \'matching\' class needed to consider a sentence matches. */ predictedProbability: number; /** * The labels probabilities. This might be available on conversation classify model outputs. */ labelProbabilities: any; /** * List of text extraction results. This might be available on classify-extract model outputs. */ extractResults: any; /** * Output of a text generation operator for example Conversation Sumamary. */ textGenerationResults: any; /** * A 34 character string that uniquely identifies this Transcript. */ transcriptSid: string; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a OperatorResultInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorResultInstance */ fetch(callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>; /** * Fetch a OperatorResultInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorResultInstance */ fetch(params: OperatorResultContextFetchOptions, callback?: (error: Error | null, item?: OperatorResultInstance) => any): Promise<OperatorResultInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { operatorType: OperatorResultOperatorType; name: string; operatorSid: string; extractMatch: boolean; matchProbability: number; normalizedResult: string; utteranceResults: any[]; utteranceMatch: boolean; predictedLabel: string; predictedProbability: number; labelProbabilities: any; extractResults: any; textGenerationResults: any; transcriptSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface OperatorResultSolution { transcriptSid: string; } export interface OperatorResultListInstance { _version: V2; _solution: OperatorResultSolution; _uri: string; (operatorSid: string): OperatorResultContext; get(operatorSid: string): OperatorResultContext; /** * Streams OperatorResultInstance 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 { OperatorResultListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: OperatorResultInstance, done: (err?: Error) => void) => void): void; each(params: OperatorResultListInstanceEachOptions, callback?: (item: OperatorResultInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of OperatorResultInstance 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: OperatorResultPage) => any): Promise<OperatorResultPage>; /** * Lists OperatorResultInstance 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 { OperatorResultListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: OperatorResultInstance[]) => any): Promise<OperatorResultInstance[]>; list(params: OperatorResultListInstanceOptions, callback?: (error: Error | null, items: OperatorResultInstance[]) => any): Promise<OperatorResultInstance[]>; /** * Retrieve a single page of OperatorResultInstance 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 { OperatorResultListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: OperatorResultPage) => any): Promise<OperatorResultPage>; page(params: OperatorResultListInstancePageOptions, callback?: (error: Error | null, items: OperatorResultPage) => any): Promise<OperatorResultPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function OperatorResultListInstance(version: V2, transcriptSid: string): OperatorResultListInstance; export declare class OperatorResultPage extends Page<V2, OperatorResultPayload, OperatorResultResource, OperatorResultInstance> { /** * Initialize the OperatorResultPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: OperatorResultSolution); /** * Build an instance of OperatorResultInstance * * @param payload - Payload response from the API */ getInstance(payload: OperatorResultResource): OperatorResultInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/intelligence/v2/transcript/media.d.ts000064400000007635151677225100014575 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../../V2"; /** * Options to pass to fetch a MediaInstance */ export interface MediaContextFetchOptions { /** Grant access to PII Redacted/Unredacted Media. If redaction is enabled, the default is `true` to access redacted media. */ redacted?: boolean; } export interface MediaContext { /** * Fetch a MediaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MediaInstance */ fetch(callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>; /** * Fetch a MediaInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MediaInstance */ fetch(params: MediaContextFetchOptions, callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface MediaContextSolution { sid: string; } export declare class MediaContextImpl implements MediaContext { protected _version: V2; protected _solution: MediaContextSolution; protected _uri: string; constructor(_version: V2, sid: string); fetch(params?: MediaContextFetchOptions | ((error: Error | null, item?: MediaInstance) => any), callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): MediaContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface MediaResource { account_sid: string; media_url: string; service_sid: string; sid: string; url: string; } export declare class MediaInstance { protected _version: V2; protected _solution: MediaContextSolution; protected _context?: MediaContext; constructor(_version: V2, payload: MediaResource, sid: string); /** * The unique SID identifier of the Account. */ accountSid: string; /** * Downloadable URL for media, if stored in Twilio AI. */ mediaUrl: string; /** * The unique SID identifier of the Service. */ serviceSid: string; /** * The unique SID identifier of the Transcript. */ sid: string; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a MediaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed MediaInstance */ fetch(callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>; /** * Fetch a MediaInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed MediaInstance */ fetch(params: MediaContextFetchOptions, callback?: (error: Error | null, item?: MediaInstance) => any): Promise<MediaInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; mediaUrl: string; serviceSid: string; sid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface MediaSolution { sid: string; } export interface MediaListInstance { _version: V2; _solution: MediaSolution; _uri: string; (): MediaContext; get(): MediaContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function MediaListInstance(version: V2, sid: string): MediaListInstance; export {}; rest/intelligence/v2/transcript/media.js000064400000010001151677225100014316 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.MediaListInstance = exports.MediaInstance = exports.MediaContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); class MediaContextImpl { 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 = `/Transcripts/${sid}/Media`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["redacted"] !== undefined) data["Redacted"] = serialize.bool(params["redacted"]); const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new MediaInstance(operationVersion, payload, 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.MediaContextImpl = MediaContextImpl; class MediaInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.mediaUrl = payload.media_url; this.serviceSid = payload.service_sid; this.sid = payload.sid; this.url = payload.url; this._solution = { sid }; } get _proxy() { this._context = this._context || new MediaContextImpl(this._version, this._solution.sid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, mediaUrl: this.mediaUrl, serviceSid: this.serviceSid, sid: this.sid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.MediaInstance = MediaInstance; function MediaListInstance(version, sid) { if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = (() => instance.get()); instance.get = function get() { return new MediaContextImpl(version, sid); }; instance._version = version; instance._solution = { sid }; 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; } exports.MediaListInstance = MediaListInstance; rest/intelligence/v2/transcript/operatorResult.js000064400000020732151677225100016305 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.OperatorResultPage = exports.OperatorResultListInstance = exports.OperatorResultInstance = exports.OperatorResultContextImpl = void 0; 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 OperatorResultContextImpl { constructor(_version, transcriptSid, operatorSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(transcriptSid)) { throw new Error("Parameter 'transcriptSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(operatorSid)) { throw new Error("Parameter 'operatorSid' is not valid."); } this._solution = { transcriptSid, operatorSid }; this._uri = `/Transcripts/${transcriptSid}/OperatorResults/${operatorSid}`; } fetch(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["redacted"] !== undefined) data["Redacted"] = serialize.bool(params["redacted"]); const headers = {}; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new OperatorResultInstance(operationVersion, payload, instance._solution.transcriptSid, instance._solution.operatorSid)); 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.OperatorResultContextImpl = OperatorResultContextImpl; class OperatorResultInstance { constructor(_version, payload, transcriptSid, operatorSid) { this._version = _version; this.operatorType = payload.operator_type; this.name = payload.name; this.operatorSid = payload.operator_sid; this.extractMatch = payload.extract_match; this.matchProbability = payload.match_probability; this.normalizedResult = payload.normalized_result; this.utteranceResults = payload.utterance_results; this.utteranceMatch = payload.utterance_match; this.predictedLabel = payload.predicted_label; this.predictedProbability = payload.predicted_probability; this.labelProbabilities = payload.label_probabilities; this.extractResults = payload.extract_results; this.textGenerationResults = payload.text_generation_results; this.transcriptSid = payload.transcript_sid; this.url = payload.url; this._solution = { transcriptSid, operatorSid: operatorSid || this.operatorSid, }; } get _proxy() { this._context = this._context || new OperatorResultContextImpl(this._version, this._solution.transcriptSid, this._solution.operatorSid); return this._context; } fetch(params, callback) { return this._proxy.fetch(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { operatorType: this.operatorType, name: this.name, operatorSid: this.operatorSid, extractMatch: this.extractMatch, matchProbability: this.matchProbability, normalizedResult: this.normalizedResult, utteranceResults: this.utteranceResults, utteranceMatch: this.utteranceMatch, predictedLabel: this.predictedLabel, predictedProbability: this.predictedProbability, labelProbabilities: this.labelProbabilities, extractResults: this.extractResults, textGenerationResults: this.textGenerationResults, transcriptSid: this.transcriptSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OperatorResultInstance = OperatorResultInstance; function OperatorResultListInstance(version, transcriptSid) { if (!(0, utility_1.isValidPathParam)(transcriptSid)) { throw new Error("Parameter 'transcriptSid' is not valid."); } const instance = ((operatorSid) => instance.get(operatorSid)); instance.get = function get(operatorSid) { return new OperatorResultContextImpl(version, transcriptSid, operatorSid); }; instance._version = version; instance._solution = { transcriptSid }; instance._uri = `/Transcripts/${transcriptSid}/OperatorResults`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["redacted"] !== undefined) data["Redacted"] = serialize.bool(params["redacted"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new OperatorResultPage(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 OperatorResultPage(instance._version, payload, 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; } exports.OperatorResultListInstance = OperatorResultListInstance; class OperatorResultPage extends Page_1.default { /** * Initialize the OperatorResultPage * * @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 OperatorResultInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new OperatorResultInstance(this._version, payload, this._solution.transcriptSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OperatorResultPage = OperatorResultPage; rest/intelligence/v2/transcript/sentence.js000064400000012103151677225100015050 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.SentencePage = exports.SentenceInstance = exports.SentenceListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function SentenceListInstance(version, transcriptSid) { if (!(0, utility_1.isValidPathParam)(transcriptSid)) { throw new Error("Parameter 'transcriptSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { transcriptSid }; instance._uri = `/Transcripts/${transcriptSid}/Sentences`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["redacted"] !== undefined) data["Redacted"] = serialize.bool(params["redacted"]); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SentencePage(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 SentencePage(instance._version, payload, 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; } exports.SentenceListInstance = SentenceListInstance; class SentenceInstance { constructor(_version, payload, transcriptSid) { this._version = _version; this.mediaChannel = deserialize.integer(payload.media_channel); this.sentenceIndex = deserialize.integer(payload.sentence_index); this.startTime = payload.start_time; this.endTime = payload.end_time; this.transcript = payload.transcript; this.sid = payload.sid; this.confidence = payload.confidence; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { mediaChannel: this.mediaChannel, sentenceIndex: this.sentenceIndex, startTime: this.startTime, endTime: this.endTime, transcript: this.transcript, sid: this.sid, confidence: this.confidence, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SentenceInstance = SentenceInstance; class SentencePage extends Page_1.default { /** * Initialize the SentencePage * * @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 SentenceInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SentenceInstance(this._version, payload, this._solution.transcriptSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SentencePage = SentencePage; rest/intelligence/v2/prebuiltOperator.js000064400000016425151677225100014430 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.PrebuiltOperatorPage = exports.PrebuiltOperatorListInstance = exports.PrebuiltOperatorInstance = exports.PrebuiltOperatorContextImpl = void 0; 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 PrebuiltOperatorContextImpl { 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 = `/Operators/PreBuilt/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new PrebuiltOperatorInstance(operationVersion, payload, 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.PrebuiltOperatorContextImpl = PrebuiltOperatorContextImpl; class PrebuiltOperatorInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.description = payload.description; this.author = payload.author; this.operatorType = payload.operator_type; this.version = deserialize.integer(payload.version); this.availability = payload.availability; this.config = payload.config; 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 PrebuiltOperatorContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a PrebuiltOperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PrebuiltOperatorInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, friendlyName: this.friendlyName, description: this.description, author: this.author, operatorType: this.operatorType, version: this.version, availability: this.availability, config: this.config, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PrebuiltOperatorInstance = PrebuiltOperatorInstance; function PrebuiltOperatorListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new PrebuiltOperatorContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Operators/PreBuilt`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["availability"] !== undefined) data["Availability"] = params["availability"]; if (params["languageCode"] !== undefined) data["LanguageCode"] = params["languageCode"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new PrebuiltOperatorPage(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 PrebuiltOperatorPage(instance._version, payload, 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; } exports.PrebuiltOperatorListInstance = PrebuiltOperatorListInstance; class PrebuiltOperatorPage extends Page_1.default { /** * Initialize the PrebuiltOperatorPage * * @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 PrebuiltOperatorInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new PrebuiltOperatorInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.PrebuiltOperatorPage = PrebuiltOperatorPage; rest/intelligence/v2/operatorAttachments.d.ts000064400000006151151677225100015344 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; export interface OperatorAttachmentsContext { /** * Fetch a OperatorAttachmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorAttachmentsInstance */ fetch(callback?: (error: Error | null, item?: OperatorAttachmentsInstance) => any): Promise<OperatorAttachmentsInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface OperatorAttachmentsContextSolution { serviceSid: string; } export declare class OperatorAttachmentsContextImpl implements OperatorAttachmentsContext { protected _version: V2; protected _solution: OperatorAttachmentsContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string); fetch(callback?: (error: Error | null, item?: OperatorAttachmentsInstance) => any): Promise<OperatorAttachmentsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): OperatorAttachmentsContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface OperatorAttachmentsResource { service_sid: string; operator_sids: Array<string>; url: string; } export declare class OperatorAttachmentsInstance { protected _version: V2; protected _solution: OperatorAttachmentsContextSolution; protected _context?: OperatorAttachmentsContext; constructor(_version: V2, payload: OperatorAttachmentsResource, serviceSid?: string); /** * The unique SID identifier of the Service. */ serviceSid: string; /** * List of Operator SIDs attached to the service. Includes both Custom and Pre-built Operators. */ operatorSids: Array<string>; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a OperatorAttachmentsInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorAttachmentsInstance */ fetch(callback?: (error: Error | null, item?: OperatorAttachmentsInstance) => any): Promise<OperatorAttachmentsInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { serviceSid: string; operatorSids: string[]; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface OperatorAttachmentsSolution { } export interface OperatorAttachmentsListInstance { _version: V2; _solution: OperatorAttachmentsSolution; _uri: string; (serviceSid: string): OperatorAttachmentsContext; get(serviceSid: string): OperatorAttachmentsContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function OperatorAttachmentsListInstance(version: V2): OperatorAttachmentsListInstance; export {}; rest/intelligence/v2/operatorAttachment.d.ts000064400000007350151677225100015163 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V2 from "../V2"; export interface OperatorAttachmentContext { /** * Create a OperatorAttachmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorAttachmentInstance */ create(callback?: (error: Error | null, item?: OperatorAttachmentInstance) => any): Promise<OperatorAttachmentInstance>; /** * Remove a OperatorAttachmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface OperatorAttachmentContextSolution { serviceSid: string; operatorSid: string; } export declare class OperatorAttachmentContextImpl implements OperatorAttachmentContext { protected _version: V2; protected _solution: OperatorAttachmentContextSolution; protected _uri: string; constructor(_version: V2, serviceSid: string, operatorSid: string); create(callback?: (error: Error | null, item?: OperatorAttachmentInstance) => any): Promise<OperatorAttachmentInstance>; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): OperatorAttachmentContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface OperatorAttachmentResource { service_sid: string; operator_sid: string; url: string; } export declare class OperatorAttachmentInstance { protected _version: V2; protected _solution: OperatorAttachmentContextSolution; protected _context?: OperatorAttachmentContext; constructor(_version: V2, payload: OperatorAttachmentResource, serviceSid?: string, operatorSid?: string); /** * The unique SID identifier of the Service. */ serviceSid: string; /** * The unique SID identifier of the Operator. */ operatorSid: string; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Create a OperatorAttachmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorAttachmentInstance */ create(callback?: (error: Error | null, item?: OperatorAttachmentInstance) => any): Promise<OperatorAttachmentInstance>; /** * Remove a OperatorAttachmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { serviceSid: string; operatorSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface OperatorAttachmentSolution { } export interface OperatorAttachmentListInstance { _version: V2; _solution: OperatorAttachmentSolution; _uri: string; (serviceSid: string, operatorSid: string): OperatorAttachmentContext; get(serviceSid: string, operatorSid: string): OperatorAttachmentContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function OperatorAttachmentListInstance(version: V2): OperatorAttachmentListInstance; export {}; rest/intelligence/v2/prebuiltOperator.d.ts000064400000024532151677225100014662 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; export type PrebuiltOperatorAvailability = "internal" | "beta" | "public" | "retired"; /** * Options to pass to each */ export interface PrebuiltOperatorListInstanceEachOptions { /** Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. */ availability?: PrebuiltOperatorAvailability; /** Returns Pre-built Operators that support the provided language code. */ languageCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: PrebuiltOperatorInstance, 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 PrebuiltOperatorListInstanceOptions { /** Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. */ availability?: PrebuiltOperatorAvailability; /** Returns Pre-built Operators that support the provided language code. */ languageCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface PrebuiltOperatorListInstancePageOptions { /** Returns Pre-built Operators with the provided availability type. Possible values: internal, beta, public, retired. */ availability?: PrebuiltOperatorAvailability; /** Returns Pre-built Operators that support the provided language code. */ languageCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface PrebuiltOperatorContext { /** * Fetch a PrebuiltOperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PrebuiltOperatorInstance */ fetch(callback?: (error: Error | null, item?: PrebuiltOperatorInstance) => any): Promise<PrebuiltOperatorInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface PrebuiltOperatorContextSolution { sid: string; } export declare class PrebuiltOperatorContextImpl implements PrebuiltOperatorContext { protected _version: V2; protected _solution: PrebuiltOperatorContextSolution; protected _uri: string; constructor(_version: V2, sid: string); fetch(callback?: (error: Error | null, item?: PrebuiltOperatorInstance) => any): Promise<PrebuiltOperatorInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): PrebuiltOperatorContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface PrebuiltOperatorPayload extends TwilioResponsePayload { operators: PrebuiltOperatorResource[]; } interface PrebuiltOperatorResource { account_sid: string; sid: string; friendly_name: string; description: string; author: string; operator_type: string; version: number; availability: PrebuiltOperatorAvailability; config: any; date_created: Date; date_updated: Date; url: string; } export declare class PrebuiltOperatorInstance { protected _version: V2; protected _solution: PrebuiltOperatorContextSolution; protected _context?: PrebuiltOperatorContext; constructor(_version: V2, payload: PrebuiltOperatorResource, sid?: string); /** * The unique SID identifier of the Account the Pre-built Operator belongs to. */ accountSid: string; /** * A 34 character string that uniquely identifies this Pre-built Operator. */ sid: string; /** * A human-readable name of this resource, up to 64 characters. */ friendlyName: string; /** * A human-readable description of this resource, longer than the friendly name. */ description: string; /** * The creator of the Operator. Pre-built Operators can only be created by Twilio. */ author: string; /** * Operator Type for this Operator. References an existing Operator Type resource. */ operatorType: string; /** * Numeric Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Operator. */ version: number; availability: PrebuiltOperatorAvailability; /** * Operator configuration, following the schema defined by the Operator Type. Only available on Custom Operators created by the Account, will be empty for Pre-Built Operators. */ config: any; /** * The date that this Pre-built Operator was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this Pre-built Operator was updated, given in ISO 8601 format. */ dateUpdated: Date; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a PrebuiltOperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed PrebuiltOperatorInstance */ fetch(callback?: (error: Error | null, item?: PrebuiltOperatorInstance) => any): Promise<PrebuiltOperatorInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; friendlyName: string; description: string; author: string; operatorType: string; version: number; availability: PrebuiltOperatorAvailability; config: any; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface PrebuiltOperatorSolution { } export interface PrebuiltOperatorListInstance { _version: V2; _solution: PrebuiltOperatorSolution; _uri: string; (sid: string): PrebuiltOperatorContext; get(sid: string): PrebuiltOperatorContext; /** * Streams PrebuiltOperatorInstance 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 { PrebuiltOperatorListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: PrebuiltOperatorInstance, done: (err?: Error) => void) => void): void; each(params: PrebuiltOperatorListInstanceEachOptions, callback?: (item: PrebuiltOperatorInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of PrebuiltOperatorInstance 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: PrebuiltOperatorPage) => any): Promise<PrebuiltOperatorPage>; /** * Lists PrebuiltOperatorInstance 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 { PrebuiltOperatorListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: PrebuiltOperatorInstance[]) => any): Promise<PrebuiltOperatorInstance[]>; list(params: PrebuiltOperatorListInstanceOptions, callback?: (error: Error | null, items: PrebuiltOperatorInstance[]) => any): Promise<PrebuiltOperatorInstance[]>; /** * Retrieve a single page of PrebuiltOperatorInstance 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 { PrebuiltOperatorListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: PrebuiltOperatorPage) => any): Promise<PrebuiltOperatorPage>; page(params: PrebuiltOperatorListInstancePageOptions, callback?: (error: Error | null, items: PrebuiltOperatorPage) => any): Promise<PrebuiltOperatorPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function PrebuiltOperatorListInstance(version: V2): PrebuiltOperatorListInstance; export declare class PrebuiltOperatorPage extends Page<V2, PrebuiltOperatorPayload, PrebuiltOperatorResource, PrebuiltOperatorInstance> { /** * Initialize the PrebuiltOperatorPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: PrebuiltOperatorSolution); /** * Build an instance of PrebuiltOperatorInstance * * @param payload - Payload response from the API */ getInstance(payload: PrebuiltOperatorResource): PrebuiltOperatorInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/intelligence/v2/transcript.js000064400000026203151677225100013252 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.TranscriptPage = exports.TranscriptListInstance = exports.TranscriptInstance = exports.TranscriptContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const media_1 = require("./transcript/media"); const operatorResult_1 = require("./transcript/operatorResult"); const sentence_1 = require("./transcript/sentence"); class TranscriptContextImpl { 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 = `/Transcripts/${sid}`; } get media() { this._media = this._media || (0, media_1.MediaListInstance)(this._version, this._solution.sid); return this._media; } get operatorResults() { this._operatorResults = this._operatorResults || (0, operatorResult_1.OperatorResultListInstance)(this._version, this._solution.sid); return this._operatorResults; } get sentences() { this._sentences = this._sentences || (0, sentence_1.SentenceListInstance)(this._version, this._solution.sid); return this._sentences; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new TranscriptInstance(operationVersion, payload, 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.TranscriptContextImpl = TranscriptContextImpl; class TranscriptInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.serviceSid = payload.service_sid; this.sid = payload.sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.status = payload.status; this.channel = payload.channel; this.dataLogging = payload.data_logging; this.languageCode = payload.language_code; this.customerKey = payload.customer_key; this.mediaStartTime = deserialize.iso8601DateTime(payload.media_start_time); this.duration = deserialize.integer(payload.duration); this.url = payload.url; this.redaction = payload.redaction; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new TranscriptContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a TranscriptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a TranscriptInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed TranscriptInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the media. */ media() { return this._proxy.media; } /** * Access the operatorResults. */ operatorResults() { return this._proxy.operatorResults; } /** * Access the sentences. */ sentences() { return this._proxy.sentences; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, serviceSid: this.serviceSid, sid: this.sid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, status: this.status, channel: this.channel, dataLogging: this.dataLogging, languageCode: this.languageCode, customerKey: this.customerKey, mediaStartTime: this.mediaStartTime, duration: this.duration, url: this.url, redaction: this.redaction, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TranscriptInstance = TranscriptInstance; function TranscriptListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new TranscriptContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Transcripts`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["serviceSid"] === null || params["serviceSid"] === undefined) { throw new Error("Required parameter \"params['serviceSid']\" missing."); } if (params["channel"] === null || params["channel"] === undefined) { throw new Error("Required parameter \"params['channel']\" missing."); } let data = {}; data["ServiceSid"] = params["serviceSid"]; data["Channel"] = serialize.object(params["channel"]); if (params["customerKey"] !== undefined) data["CustomerKey"] = params["customerKey"]; if (params["mediaStartTime"] !== undefined) data["MediaStartTime"] = serialize.iso8601DateTime(params["mediaStartTime"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new TranscriptInstance(operationVersion, payload)); 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["serviceSid"] !== undefined) data["ServiceSid"] = params["serviceSid"]; if (params["beforeStartTime"] !== undefined) data["BeforeStartTime"] = params["beforeStartTime"]; if (params["afterStartTime"] !== undefined) data["AfterStartTime"] = params["afterStartTime"]; if (params["beforeDateCreated"] !== undefined) data["BeforeDateCreated"] = params["beforeDateCreated"]; if (params["afterDateCreated"] !== undefined) data["AfterDateCreated"] = params["afterDateCreated"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["languageCode"] !== undefined) data["LanguageCode"] = params["languageCode"]; if (params["sourceSid"] !== undefined) data["SourceSid"] = params["sourceSid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new TranscriptPage(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 TranscriptPage(instance._version, payload, 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; } exports.TranscriptListInstance = TranscriptListInstance; class TranscriptPage extends Page_1.default { /** * Initialize the TranscriptPage * * @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 TranscriptInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new TranscriptInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.TranscriptPage = TranscriptPage; rest/intelligence/v2/operator.d.ts000064400000023203151677225100013145 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; export type OperatorAvailability = "internal" | "beta" | "public" | "retired"; /** * Options to pass to each */ export interface OperatorListInstanceEachOptions { /** Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. */ availability?: OperatorAvailability; /** Returns Operators that support the provided language code. */ languageCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: OperatorInstance, 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 OperatorListInstanceOptions { /** Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. */ availability?: OperatorAvailability; /** Returns Operators that support the provided language code. */ languageCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface OperatorListInstancePageOptions { /** Returns Operators with the provided availability type. Possible values: internal, beta, public, retired. */ availability?: OperatorAvailability; /** Returns Operators that support the provided language code. */ languageCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface OperatorContext { /** * Fetch a OperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorInstance */ fetch(callback?: (error: Error | null, item?: OperatorInstance) => any): Promise<OperatorInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface OperatorContextSolution { sid: string; } export declare class OperatorContextImpl implements OperatorContext { protected _version: V2; protected _solution: OperatorContextSolution; protected _uri: string; constructor(_version: V2, sid: string); fetch(callback?: (error: Error | null, item?: OperatorInstance) => any): Promise<OperatorInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): OperatorContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface OperatorPayload extends TwilioResponsePayload { operators: OperatorResource[]; } interface OperatorResource { account_sid: string; sid: string; friendly_name: string; description: string; author: string; operator_type: string; version: number; availability: OperatorAvailability; config: any; date_created: Date; date_updated: Date; url: string; } export declare class OperatorInstance { protected _version: V2; protected _solution: OperatorContextSolution; protected _context?: OperatorContext; constructor(_version: V2, payload: OperatorResource, sid?: string); /** * The unique SID identifier of the Account the Operator belongs to. */ accountSid: string; /** * A 34 character string that uniquely identifies this Operator. */ sid: string; /** * A human-readable name of this resource, up to 64 characters. */ friendlyName: string; /** * A human-readable description of this resource, longer than the friendly name. */ description: string; /** * The creator of the Operator. Either Twilio or the creating Account. */ author: string; /** * Operator Type for this Operator. References an existing Operator Type resource. */ operatorType: string; /** * Numeric Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Operator. */ version: number; availability: OperatorAvailability; /** * Operator configuration, following the schema defined by the Operator Type. Only available on Custom Operators created by the Account. */ config: any; /** * The date that this Operator was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this Operator was updated, given in ISO 8601 format. */ dateUpdated: Date; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a OperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorInstance */ fetch(callback?: (error: Error | null, item?: OperatorInstance) => any): Promise<OperatorInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; friendlyName: string; description: string; author: string; operatorType: string; version: number; availability: OperatorAvailability; config: any; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface OperatorSolution { } export interface OperatorListInstance { _version: V2; _solution: OperatorSolution; _uri: string; (sid: string): OperatorContext; get(sid: string): OperatorContext; /** * Streams OperatorInstance 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 { OperatorListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: OperatorInstance, done: (err?: Error) => void) => void): void; each(params: OperatorListInstanceEachOptions, callback?: (item: OperatorInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of OperatorInstance 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: OperatorPage) => any): Promise<OperatorPage>; /** * Lists OperatorInstance 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 { OperatorListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: OperatorInstance[]) => any): Promise<OperatorInstance[]>; list(params: OperatorListInstanceOptions, callback?: (error: Error | null, items: OperatorInstance[]) => any): Promise<OperatorInstance[]>; /** * Retrieve a single page of OperatorInstance 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 { OperatorListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: OperatorPage) => any): Promise<OperatorPage>; page(params: OperatorListInstancePageOptions, callback?: (error: Error | null, items: OperatorPage) => any): Promise<OperatorPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function OperatorListInstance(version: V2): OperatorListInstance; export declare class OperatorPage extends Page<V2, OperatorPayload, OperatorResource, OperatorInstance> { /** * Initialize the OperatorPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: OperatorSolution); /** * Build an instance of OperatorInstance * * @param payload - Payload response from the API */ getInstance(payload: OperatorResource): OperatorInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/intelligence/v2/operatorType.d.ts000064400000023000151677225100014002 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V2 from "../V2"; export type OperatorTypeAvailability = "internal" | "beta" | "public" | "retired"; export type OperatorTypeOutputType = "text-classification" | "text-extraction" | "text-extraction-normalized" | "text-generation"; export type OperatorTypeProvider = "twilio" | "amazon" | "openai"; /** * Options to pass to each */ export interface OperatorTypeListInstanceEachOptions { /** 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: OperatorTypeInstance, 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 OperatorTypeListInstanceOptions { /** 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 OperatorTypeListInstancePageOptions { /** 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 OperatorTypeContext { /** * Fetch a OperatorTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorTypeInstance */ fetch(callback?: (error: Error | null, item?: OperatorTypeInstance) => any): Promise<OperatorTypeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface OperatorTypeContextSolution { sid: string; } export declare class OperatorTypeContextImpl implements OperatorTypeContext { protected _version: V2; protected _solution: OperatorTypeContextSolution; protected _uri: string; constructor(_version: V2, sid: string); fetch(callback?: (error: Error | null, item?: OperatorTypeInstance) => any): Promise<OperatorTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): OperatorTypeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface OperatorTypePayload extends TwilioResponsePayload { operator_types: OperatorTypeResource[]; } interface OperatorTypeResource { name: string; sid: string; friendly_name: string; description: string; docs_link: string; output_type: OperatorTypeOutputType; supported_languages: Array<string>; provider: OperatorTypeProvider; availability: OperatorTypeAvailability; configurable: boolean; config_schema: any; date_created: Date; date_updated: Date; url: string; } export declare class OperatorTypeInstance { protected _version: V2; protected _solution: OperatorTypeContextSolution; protected _context?: OperatorTypeContext; constructor(_version: V2, payload: OperatorTypeResource, sid?: string); /** * A unique name that references an Operator\'s Operator Type. */ name: string; /** * A 34 character string that uniquely identifies this Operator Type. */ sid: string; /** * A human-readable name of this resource, up to 64 characters. */ friendlyName: string; /** * A human-readable description of this resource, longer than the friendly name. */ description: string; /** * Additional documentation for the Operator Type. */ docsLink: string; outputType: OperatorTypeOutputType; /** * List of languages this Operator Type supports. */ supportedLanguages: Array<string>; provider: OperatorTypeProvider; availability: OperatorTypeAvailability; /** * Operators can be created from configurable Operator Types. */ configurable: boolean; /** * JSON Schema for configuring an Operator with this Operator Type. Following https://json-schema.org/ */ configSchema: any; /** * The date that this Operator Type was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this Operator Type was updated, given in ISO 8601 format. */ dateUpdated: Date; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Fetch a OperatorTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorTypeInstance */ fetch(callback?: (error: Error | null, item?: OperatorTypeInstance) => any): Promise<OperatorTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { name: string; sid: string; friendlyName: string; description: string; docsLink: string; outputType: OperatorTypeOutputType; supportedLanguages: string[]; provider: OperatorTypeProvider; availability: OperatorTypeAvailability; configurable: boolean; configSchema: any; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface OperatorTypeSolution { } export interface OperatorTypeListInstance { _version: V2; _solution: OperatorTypeSolution; _uri: string; (sid: string): OperatorTypeContext; get(sid: string): OperatorTypeContext; /** * Streams OperatorTypeInstance 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 { OperatorTypeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: OperatorTypeInstance, done: (err?: Error) => void) => void): void; each(params: OperatorTypeListInstanceEachOptions, callback?: (item: OperatorTypeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of OperatorTypeInstance 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: OperatorTypePage) => any): Promise<OperatorTypePage>; /** * Lists OperatorTypeInstance 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 { OperatorTypeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: OperatorTypeInstance[]) => any): Promise<OperatorTypeInstance[]>; list(params: OperatorTypeListInstanceOptions, callback?: (error: Error | null, items: OperatorTypeInstance[]) => any): Promise<OperatorTypeInstance[]>; /** * Retrieve a single page of OperatorTypeInstance 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 { OperatorTypeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: OperatorTypePage) => any): Promise<OperatorTypePage>; page(params: OperatorTypeListInstancePageOptions, callback?: (error: Error | null, items: OperatorTypePage) => any): Promise<OperatorTypePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function OperatorTypeListInstance(version: V2): OperatorTypeListInstance; export declare class OperatorTypePage extends Page<V2, OperatorTypePayload, OperatorTypeResource, OperatorTypeInstance> { /** * Initialize the OperatorTypePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V2, response: Response<string>, solution: OperatorTypeSolution); /** * Build an instance of OperatorTypeInstance * * @param payload - Payload response from the API */ getInstance(payload: OperatorTypeResource): OperatorTypeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/intelligence/v2/operator.js000064400000016063151677225100012717 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.OperatorPage = exports.OperatorListInstance = exports.OperatorInstance = exports.OperatorContextImpl = void 0; 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 OperatorContextImpl { 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 = `/Operators/${sid}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new OperatorInstance(operationVersion, payload, 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.OperatorContextImpl = OperatorContextImpl; class OperatorInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.friendlyName = payload.friendly_name; this.description = payload.description; this.author = payload.author; this.operatorType = payload.operator_type; this.version = deserialize.integer(payload.version); this.availability = payload.availability; this.config = payload.config; 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 OperatorContextImpl(this._version, this._solution.sid); return this._context; } /** * Fetch a OperatorInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, friendlyName: this.friendlyName, description: this.description, author: this.author, operatorType: this.operatorType, version: this.version, availability: this.availability, config: this.config, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OperatorInstance = OperatorInstance; function OperatorListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new OperatorContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Operators`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["availability"] !== undefined) data["Availability"] = params["availability"]; if (params["languageCode"] !== undefined) data["LanguageCode"] = params["languageCode"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new OperatorPage(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 OperatorPage(instance._version, payload, 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; } exports.OperatorListInstance = OperatorListInstance; class OperatorPage extends Page_1.default { /** * Initialize the OperatorPage * * @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 OperatorInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new OperatorInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OperatorPage = OperatorPage; rest/intelligence/v2/operatorAttachment.js000064400000011551151677225100014725 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Intelligence * 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.OperatorAttachmentListInstance = exports.OperatorAttachmentInstance = exports.OperatorAttachmentContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class OperatorAttachmentContextImpl { constructor(_version, serviceSid, operatorSid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(serviceSid)) { throw new Error("Parameter 'serviceSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(operatorSid)) { throw new Error("Parameter 'operatorSid' is not valid."); } this._solution = { serviceSid, operatorSid }; this._uri = `/Services/${serviceSid}/Operators/${operatorSid}`; } create(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", }); operationPromise = operationPromise.then((payload) => new OperatorAttachmentInstance(operationVersion, payload, instance._solution.serviceSid, instance._solution.operatorSid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); 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.OperatorAttachmentContextImpl = OperatorAttachmentContextImpl; class OperatorAttachmentInstance { constructor(_version, payload, serviceSid, operatorSid) { this._version = _version; this.serviceSid = payload.service_sid; this.operatorSid = payload.operator_sid; this.url = payload.url; this._solution = { serviceSid: serviceSid || this.serviceSid, operatorSid: operatorSid || this.operatorSid, }; } get _proxy() { this._context = this._context || new OperatorAttachmentContextImpl(this._version, this._solution.serviceSid, this._solution.operatorSid); return this._context; } /** * Create a OperatorAttachmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed OperatorAttachmentInstance */ create(callback) { return this._proxy.create(callback); } /** * Remove a OperatorAttachmentInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { serviceSid: this.serviceSid, operatorSid: this.operatorSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.OperatorAttachmentInstance = OperatorAttachmentInstance; function OperatorAttachmentListInstance(version) { const instance = ((serviceSid, operatorSid) => instance.get(serviceSid, operatorSid)); instance.get = function get(serviceSid, operatorSid) { return new OperatorAttachmentContextImpl(version, serviceSid, operatorSid); }; 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; } exports.OperatorAttachmentListInstance = OperatorAttachmentListInstance; rest/BulkexportsBase.d.ts000064400000000466151677225100011444 0ustar00import Domain from "../base/Domain"; import V1 from "./bulkexports/V1"; declare class BulkexportsBase extends Domain { _v1?: V1; /** * Initialize bulkexports domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; } export = BulkexportsBase; rest/events/V1.d.ts000064400000002451151677225100010115 0ustar00import EventsBase from "../EventsBase"; import Version from "../../base/Version"; import { EventTypeListInstance } from "./v1/eventType"; import { SchemaListInstance } from "./v1/schema"; import { SinkListInstance } from "./v1/sink"; import { SubscriptionListInstance } from "./v1/subscription"; export default class V1 extends Version { /** * Initialize the V1 version of Events * * @param domain - The Twilio (Twilio.Events) domain */ constructor(domain: EventsBase); /** eventTypes - { Twilio.Events.V1.EventTypeListInstance } resource */ protected _eventTypes?: EventTypeListInstance; /** schemas - { Twilio.Events.V1.SchemaListInstance } resource */ protected _schemas?: SchemaListInstance; /** sinks - { Twilio.Events.V1.SinkListInstance } resource */ protected _sinks?: SinkListInstance; /** subscriptions - { Twilio.Events.V1.SubscriptionListInstance } resource */ protected _subscriptions?: SubscriptionListInstance; /** Getter for eventTypes resource */ get eventTypes(): EventTypeListInstance; /** Getter for schemas resource */ get schemas(): SchemaListInstance; /** Getter for sinks resource */ get sinks(): SinkListInstance; /** Getter for subscriptions resource */ get subscriptions(): SubscriptionListInstance; } rest/events/v1/eventType.d.ts000064400000020447151677225100012145 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to each */ export interface EventTypeListInstanceEachOptions { /** A string parameter filtering the results to return only the Event Types using a given schema. */ schemaId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: EventTypeInstance, 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 EventTypeListInstanceOptions { /** A string parameter filtering the results to return only the Event Types using a given schema. */ schemaId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface EventTypeListInstancePageOptions { /** A string parameter filtering the results to return only the Event Types using a given schema. */ schemaId?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface EventTypeContext { /** * Fetch a EventTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EventTypeInstance */ fetch(callback?: (error: Error | null, item?: EventTypeInstance) => any): Promise<EventTypeInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface EventTypeContextSolution { type: string; } export declare class EventTypeContextImpl implements EventTypeContext { protected _version: V1; protected _solution: EventTypeContextSolution; protected _uri: string; constructor(_version: V1, type: string); fetch(callback?: (error: Error | null, item?: EventTypeInstance) => any): Promise<EventTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): EventTypeContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface EventTypePayload extends TwilioResponsePayload { types: EventTypeResource[]; } interface EventTypeResource { type: string; schema_id: string; date_created: Date; date_updated: Date; description: string; url: string; links: Record<string, string>; } export declare class EventTypeInstance { protected _version: V1; protected _solution: EventTypeContextSolution; protected _context?: EventTypeContext; constructor(_version: V1, payload: EventTypeResource, type?: string); /** * A string that uniquely identifies this Event Type. */ type: string; /** * A string that uniquely identifies the Schema this Event Type adheres to. */ schemaId: string; /** * The date that this Event Type was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this Event Type was updated, given in ISO 8601 format. */ dateUpdated: Date; /** * A human readable description for this Event Type. */ description: string; /** * The URL of this resource. */ url: string; links: Record<string, string>; private get _proxy(); /** * Fetch a EventTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EventTypeInstance */ fetch(callback?: (error: Error | null, item?: EventTypeInstance) => any): Promise<EventTypeInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { type: string; schemaId: string; dateCreated: Date; dateUpdated: Date; description: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface EventTypeSolution { } export interface EventTypeListInstance { _version: V1; _solution: EventTypeSolution; _uri: string; (type: string): EventTypeContext; get(type: string): EventTypeContext; /** * Streams EventTypeInstance 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 { EventTypeListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: EventTypeInstance, done: (err?: Error) => void) => void): void; each(params: EventTypeListInstanceEachOptions, callback?: (item: EventTypeInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of EventTypeInstance 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: EventTypePage) => any): Promise<EventTypePage>; /** * Lists EventTypeInstance 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 { EventTypeListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: EventTypeInstance[]) => any): Promise<EventTypeInstance[]>; list(params: EventTypeListInstanceOptions, callback?: (error: Error | null, items: EventTypeInstance[]) => any): Promise<EventTypeInstance[]>; /** * Retrieve a single page of EventTypeInstance 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 { EventTypeListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: EventTypePage) => any): Promise<EventTypePage>; page(params: EventTypeListInstancePageOptions, callback?: (error: Error | null, items: EventTypePage) => any): Promise<EventTypePage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function EventTypeListInstance(version: V1): EventTypeListInstance; export declare class EventTypePage extends Page<V1, EventTypePayload, EventTypeResource, EventTypeInstance> { /** * Initialize the EventTypePage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: EventTypeSolution); /** * Build an instance of EventTypeInstance * * @param payload - Payload response from the API */ getInstance(payload: EventTypeResource): EventTypeInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/events/v1/eventType.js000064400000015007151677225100011705 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Events * 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.EventTypePage = exports.EventTypeListInstance = exports.EventTypeInstance = exports.EventTypeContextImpl = void 0; 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 EventTypeContextImpl { constructor(_version, type) { this._version = _version; if (!(0, utility_1.isValidPathParam)(type)) { throw new Error("Parameter 'type' is not valid."); } this._solution = { type }; this._uri = `/Types/${type}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new EventTypeInstance(operationVersion, payload, instance._solution.type)); 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.EventTypeContextImpl = EventTypeContextImpl; class EventTypeInstance { constructor(_version, payload, type) { this._version = _version; this.type = payload.type; this.schemaId = payload.schema_id; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.description = payload.description; this.url = payload.url; this.links = payload.links; this._solution = { type: type || this.type }; } get _proxy() { this._context = this._context || new EventTypeContextImpl(this._version, this._solution.type); return this._context; } /** * Fetch a EventTypeInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed EventTypeInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { type: this.type, schemaId: this.schemaId, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, description: this.description, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventTypeInstance = EventTypeInstance; function EventTypeListInstance(version) { const instance = ((type) => instance.get(type)); instance.get = function get(type) { return new EventTypeContextImpl(version, type); }; instance._version = version; instance._solution = {}; instance._uri = `/Types`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["schemaId"] !== undefined) data["SchemaId"] = params["schemaId"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new EventTypePage(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 EventTypePage(instance._version, payload, 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; } exports.EventTypeListInstance = EventTypeListInstance; class EventTypePage extends Page_1.default { /** * Initialize the EventTypePage * * @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 EventTypeInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new EventTypeInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.EventTypePage = EventTypePage; rest/events/v1/sink.js000064400000024742151677225100010674 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Events * 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.SinkPage = exports.SinkListInstance = exports.SinkInstance = exports.SinkContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const sinkTest_1 = require("./sink/sinkTest"); const sinkValidate_1 = require("./sink/sinkValidate"); class SinkContextImpl { 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 = `/Sinks/${sid}`; } get sinkTest() { this._sinkTest = this._sinkTest || (0, sinkTest_1.SinkTestListInstance)(this._version, this._solution.sid); return this._sinkTest; } get sinkValidate() { this._sinkValidate = this._sinkValidate || (0, sinkValidate_1.SinkValidateListInstance)(this._version, this._solution.sid); return this._sinkValidate; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SinkInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["description"] === null || params["description"] === undefined) { throw new Error("Required parameter \"params['description']\" missing."); } let data = {}; data["Description"] = params["description"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SinkInstance(operationVersion, payload, 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.SinkContextImpl = SinkContextImpl; class SinkInstance { constructor(_version, payload, sid) { this._version = _version; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.description = payload.description; this.sid = payload.sid; this.sinkConfiguration = payload.sink_configuration; this.sinkType = payload.sink_type; this.status = payload.status; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SinkContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a SinkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SinkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SinkInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the sinkTest. */ sinkTest() { return this._proxy.sinkTest; } /** * Access the sinkValidate. */ sinkValidate() { return this._proxy.sinkValidate; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, description: this.description, sid: this.sid, sinkConfiguration: this.sinkConfiguration, sinkType: this.sinkType, status: this.status, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SinkInstance = SinkInstance; function SinkListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SinkContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Sinks`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["description"] === null || params["description"] === undefined) { throw new Error("Required parameter \"params['description']\" missing."); } if (params["sinkConfiguration"] === null || params["sinkConfiguration"] === undefined) { throw new Error("Required parameter \"params['sinkConfiguration']\" missing."); } if (params["sinkType"] === null || params["sinkType"] === undefined) { throw new Error("Required parameter \"params['sinkType']\" missing."); } let data = {}; data["Description"] = params["description"]; data["SinkConfiguration"] = serialize.object(params["sinkConfiguration"]); data["SinkType"] = params["sinkType"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SinkInstance(operationVersion, payload)); 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["inUse"] !== undefined) data["InUse"] = serialize.bool(params["inUse"]); if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SinkPage(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 SinkPage(instance._version, payload, 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; } exports.SinkListInstance = SinkListInstance; class SinkPage extends Page_1.default { /** * Initialize the SinkPage * * @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 SinkInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SinkInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SinkPage = SinkPage; rest/events/v1/subscription/subscribedEvent.js000064400000023337151677225100015602 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Events * 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.SubscribedEventPage = exports.SubscribedEventListInstance = exports.SubscribedEventInstance = exports.SubscribedEventContextImpl = void 0; 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 SubscribedEventContextImpl { constructor(_version, subscriptionSid, type) { this._version = _version; if (!(0, utility_1.isValidPathParam)(subscriptionSid)) { throw new Error("Parameter 'subscriptionSid' is not valid."); } if (!(0, utility_1.isValidPathParam)(type)) { throw new Error("Parameter 'type' is not valid."); } this._solution = { subscriptionSid, type }; this._uri = `/Subscriptions/${subscriptionSid}/SubscribedEvents/${type}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SubscribedEventInstance(operationVersion, payload, instance._solution.subscriptionSid, instance._solution.type)); 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["schemaVersion"] !== undefined) data["SchemaVersion"] = params["schemaVersion"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SubscribedEventInstance(operationVersion, payload, instance._solution.subscriptionSid, instance._solution.type)); 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.SubscribedEventContextImpl = SubscribedEventContextImpl; class SubscribedEventInstance { constructor(_version, payload, subscriptionSid, type) { this._version = _version; this.accountSid = payload.account_sid; this.type = payload.type; this.schemaVersion = deserialize.integer(payload.schema_version); this.subscriptionSid = payload.subscription_sid; this.url = payload.url; this._solution = { subscriptionSid, type: type || this.type }; } get _proxy() { this._context = this._context || new SubscribedEventContextImpl(this._version, this._solution.subscriptionSid, this._solution.type); return this._context; } /** * Remove a SubscribedEventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SubscribedEventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedEventInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, type: this.type, schemaVersion: this.schemaVersion, subscriptionSid: this.subscriptionSid, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SubscribedEventInstance = SubscribedEventInstance; function SubscribedEventListInstance(version, subscriptionSid) { if (!(0, utility_1.isValidPathParam)(subscriptionSid)) { throw new Error("Parameter 'subscriptionSid' is not valid."); } const instance = ((type) => instance.get(type)); instance.get = function get(type) { return new SubscribedEventContextImpl(version, subscriptionSid, type); }; instance._version = version; instance._solution = { subscriptionSid }; instance._uri = `/Subscriptions/${subscriptionSid}/SubscribedEvents`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["type"] === null || params["type"] === undefined) { throw new Error("Required parameter \"params['type']\" missing."); } let data = {}; data["Type"] = params["type"]; if (params["schemaVersion"] !== undefined) data["SchemaVersion"] = params["schemaVersion"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SubscribedEventInstance(operationVersion, payload, instance._solution.subscriptionSid)); 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SubscribedEventPage(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 SubscribedEventPage(instance._version, payload, 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; } exports.SubscribedEventListInstance = SubscribedEventListInstance; class SubscribedEventPage extends Page_1.default { /** * Initialize the SubscribedEventPage * * @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 SubscribedEventInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SubscribedEventInstance(this._version, payload, this._solution.subscriptionSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SubscribedEventPage = SubscribedEventPage; rest/events/v1/subscription/subscribedEvent.d.ts000064400000026352151677225100016036 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to update a SubscribedEventInstance */ export interface SubscribedEventContextUpdateOptions { /** The schema version that the Subscription should use. */ schemaVersion?: number; } /** * Options to pass to create a SubscribedEventInstance */ export interface SubscribedEventListInstanceCreateOptions { /** Type of event being subscribed to. */ type: string; /** The schema version that the Subscription should use. */ schemaVersion?: number; } /** * Options to pass to each */ export interface SubscribedEventListInstanceEachOptions { /** 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: SubscribedEventInstance, 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 SubscribedEventListInstanceOptions { /** 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 SubscribedEventListInstancePageOptions { /** 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 SubscribedEventContext { /** * Remove a SubscribedEventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SubscribedEventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedEventInstance */ fetch(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>; /** * Update a SubscribedEventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedEventInstance */ update(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>; /** * Update a SubscribedEventInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedEventInstance */ update(params: SubscribedEventContextUpdateOptions, callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SubscribedEventContextSolution { subscriptionSid: string; type: string; } export declare class SubscribedEventContextImpl implements SubscribedEventContext { protected _version: V1; protected _solution: SubscribedEventContextSolution; protected _uri: string; constructor(_version: V1, subscriptionSid: string, type: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>; update(params?: SubscribedEventContextUpdateOptions | ((error: Error | null, item?: SubscribedEventInstance) => any), callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SubscribedEventContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SubscribedEventPayload extends TwilioResponsePayload { types: SubscribedEventResource[]; } interface SubscribedEventResource { account_sid: string; type: string; schema_version: number; subscription_sid: string; url: string; } export declare class SubscribedEventInstance { protected _version: V1; protected _solution: SubscribedEventContextSolution; protected _context?: SubscribedEventContext; constructor(_version: V1, payload: SubscribedEventResource, subscriptionSid: string, type?: string); /** * The unique SID identifier of the Account. */ accountSid: string; /** * Type of event being subscribed to. */ type: string; /** * The schema version that the Subscription should use. */ schemaVersion: number; /** * The unique SID identifier of the Subscription. */ subscriptionSid: string; /** * The URL of this resource. */ url: string; private get _proxy(); /** * Remove a SubscribedEventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SubscribedEventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedEventInstance */ fetch(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>; /** * Update a SubscribedEventInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedEventInstance */ update(callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>; /** * Update a SubscribedEventInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedEventInstance */ update(params: SubscribedEventContextUpdateOptions, callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; type: string; schemaVersion: number; subscriptionSid: string; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SubscribedEventSolution { subscriptionSid: string; } export interface SubscribedEventListInstance { _version: V1; _solution: SubscribedEventSolution; _uri: string; (type: string): SubscribedEventContext; get(type: string): SubscribedEventContext; /** * Create a SubscribedEventInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscribedEventInstance */ create(params: SubscribedEventListInstanceCreateOptions, callback?: (error: Error | null, item?: SubscribedEventInstance) => any): Promise<SubscribedEventInstance>; /** * Streams SubscribedEventInstance 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 { SubscribedEventListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SubscribedEventInstance, done: (err?: Error) => void) => void): void; each(params: SubscribedEventListInstanceEachOptions, callback?: (item: SubscribedEventInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SubscribedEventInstance 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: SubscribedEventPage) => any): Promise<SubscribedEventPage>; /** * Lists SubscribedEventInstance 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 { SubscribedEventListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SubscribedEventInstance[]) => any): Promise<SubscribedEventInstance[]>; list(params: SubscribedEventListInstanceOptions, callback?: (error: Error | null, items: SubscribedEventInstance[]) => any): Promise<SubscribedEventInstance[]>; /** * Retrieve a single page of SubscribedEventInstance 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 { SubscribedEventListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SubscribedEventPage) => any): Promise<SubscribedEventPage>; page(params: SubscribedEventListInstancePageOptions, callback?: (error: Error | null, items: SubscribedEventPage) => any): Promise<SubscribedEventPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SubscribedEventListInstance(version: V1, subscriptionSid: string): SubscribedEventListInstance; export declare class SubscribedEventPage extends Page<V1, SubscribedEventPayload, SubscribedEventResource, SubscribedEventInstance> { /** * Initialize the SubscribedEventPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SubscribedEventSolution); /** * Build an instance of SubscribedEventInstance * * @param payload - Payload response from the API */ getInstance(payload: SubscribedEventResource): SubscribedEventInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/events/v1/schema.d.ts000064400000006606151677225100011423 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../V1"; import { SchemaVersionListInstance } from "./schema/schemaVersion"; export interface SchemaContext { versions: SchemaVersionListInstance; /** * Fetch a SchemaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SchemaInstance */ fetch(callback?: (error: Error | null, item?: SchemaInstance) => any): Promise<SchemaInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SchemaContextSolution { id: string; } export declare class SchemaContextImpl implements SchemaContext { protected _version: V1; protected _solution: SchemaContextSolution; protected _uri: string; protected _versions?: SchemaVersionListInstance; constructor(_version: V1, id: string); get versions(): SchemaVersionListInstance; fetch(callback?: (error: Error | null, item?: SchemaInstance) => any): Promise<SchemaInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SchemaContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SchemaResource { id: string; url: string; links: Record<string, string>; latest_version_date_created: Date; latest_version: number; } export declare class SchemaInstance { protected _version: V1; protected _solution: SchemaContextSolution; protected _context?: SchemaContext; constructor(_version: V1, payload: SchemaResource, id?: string); /** * The unique identifier of the schema. Each schema can have multiple versions, that share the same id. */ id: string; /** * The URL of this resource. */ url: string; /** * Contains a dictionary of URL links to nested resources of this schema. */ links: Record<string, string>; /** * The date that the latest schema version was created, given in ISO 8601 format. */ latestVersionDateCreated: Date; /** * The latest version published of this schema. */ latestVersion: number; private get _proxy(); /** * Fetch a SchemaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SchemaInstance */ fetch(callback?: (error: Error | null, item?: SchemaInstance) => any): Promise<SchemaInstance>; /** * Access the versions. */ versions(): SchemaVersionListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { id: string; url: string; links: Record<string, string>; latestVersionDateCreated: Date; latestVersion: number; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SchemaSolution { } export interface SchemaListInstance { _version: V1; _solution: SchemaSolution; _uri: string; (id: string): SchemaContext; get(id: string): SchemaContext; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SchemaListInstance(version: V1): SchemaListInstance; export {}; rest/events/v1/schema.js000064400000010177151677225100011165 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Events * 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.SchemaListInstance = exports.SchemaInstance = exports.SchemaContextImpl = void 0; const util_1 = require("util"); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const schemaVersion_1 = require("./schema/schemaVersion"); class SchemaContextImpl { constructor(_version, id) { this._version = _version; if (!(0, utility_1.isValidPathParam)(id)) { throw new Error("Parameter 'id' is not valid."); } this._solution = { id }; this._uri = `/Schemas/${id}`; } get versions() { this._versions = this._versions || (0, schemaVersion_1.SchemaVersionListInstance)(this._version, this._solution.id); return this._versions; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SchemaInstance(operationVersion, payload, instance._solution.id)); 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.SchemaContextImpl = SchemaContextImpl; class SchemaInstance { constructor(_version, payload, id) { this._version = _version; this.id = payload.id; this.url = payload.url; this.links = payload.links; this.latestVersionDateCreated = deserialize.iso8601DateTime(payload.latest_version_date_created); this.latestVersion = deserialize.integer(payload.latest_version); this._solution = { id: id || this.id }; } get _proxy() { this._context = this._context || new SchemaContextImpl(this._version, this._solution.id); return this._context; } /** * Fetch a SchemaInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SchemaInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Access the versions. */ versions() { return this._proxy.versions; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { id: this.id, url: this.url, links: this.links, latestVersionDateCreated: this.latestVersionDateCreated, latestVersion: this.latestVersion, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SchemaInstance = SchemaInstance; function SchemaListInstance(version) { const instance = ((id) => instance.get(id)); instance.get = function get(id) { return new SchemaContextImpl(version, id); }; 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; } exports.SchemaListInstance = SchemaListInstance; rest/events/v1/subscription.js000064400000024311151677225100012444 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Events * 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.SubscriptionPage = exports.SubscriptionListInstance = exports.SubscriptionInstance = exports.SubscriptionContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const subscribedEvent_1 = require("./subscription/subscribedEvent"); class SubscriptionContextImpl { 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 = `/Subscriptions/${sid}`; } get subscribedEvents() { this._subscribedEvents = this._subscribedEvents || (0, subscribedEvent_1.SubscribedEventListInstance)(this._version, this._solution.sid); return this._subscribedEvents; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SubscriptionInstance(operationVersion, payload, 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["description"] !== undefined) data["Description"] = params["description"]; if (params["sinkSid"] !== undefined) data["SinkSid"] = params["sinkSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SubscriptionInstance(operationVersion, payload, 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.SubscriptionContextImpl = SubscriptionContextImpl; class SubscriptionInstance { constructor(_version, payload, sid) { this._version = _version; this.accountSid = payload.account_sid; this.sid = payload.sid; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.description = payload.description; this.sinkSid = payload.sink_sid; this.url = payload.url; this.links = payload.links; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SubscriptionContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a SubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscriptionInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the subscribedEvents. */ subscribedEvents() { return this._proxy.subscribedEvents; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, sid: this.sid, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, description: this.description, sinkSid: this.sinkSid, url: this.url, links: this.links, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SubscriptionInstance = SubscriptionInstance; function SubscriptionListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SubscriptionContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Subscriptions`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["description"] === null || params["description"] === undefined) { throw new Error("Required parameter \"params['description']\" missing."); } if (params["sinkSid"] === null || params["sinkSid"] === undefined) { throw new Error("Required parameter \"params['sinkSid']\" missing."); } if (params["types"] === null || params["types"] === undefined) { throw new Error("Required parameter \"params['types']\" missing."); } let data = {}; data["Description"] = params["description"]; data["SinkSid"] = params["sinkSid"]; data["Types"] = serialize.map(params["types"], (e) => serialize.object(e)); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SubscriptionInstance(operationVersion, payload)); 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["sinkSid"] !== undefined) data["SinkSid"] = params["sinkSid"]; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SubscriptionPage(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 SubscriptionPage(instance._version, payload, 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; } exports.SubscriptionListInstance = SubscriptionListInstance; class SubscriptionPage extends Page_1.default { /** * Initialize the SubscriptionPage * * @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 SubscriptionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SubscriptionInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SubscriptionPage = SubscriptionPage; rest/events/v1/subscription.d.ts000064400000030735151677225100012707 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { SubscribedEventListInstance } from "./subscription/subscribedEvent"; /** * Options to pass to update a SubscriptionInstance */ export interface SubscriptionContextUpdateOptions { /** A human readable description for the Subscription. */ description?: string; /** The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. */ sinkSid?: string; } /** * Options to pass to create a SubscriptionInstance */ export interface SubscriptionListInstanceCreateOptions { /** A human readable description for the Subscription **This value should not contain PII.** */ description: string; /** The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. */ sinkSid: string; /** An array of objects containing the subscribed Event Types */ types: Array<any>; } /** * Options to pass to each */ export interface SubscriptionListInstanceEachOptions { /** The SID of the sink that the list of Subscriptions should be filtered by. */ sinkSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: SubscriptionInstance, 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 SubscriptionListInstanceOptions { /** The SID of the sink that the list of Subscriptions should be filtered by. */ sinkSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface SubscriptionListInstancePageOptions { /** The SID of the sink that the list of Subscriptions should be filtered by. */ sinkSid?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface SubscriptionContext { subscribedEvents: SubscribedEventListInstance; /** * Remove a SubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscriptionInstance */ fetch(callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>; /** * Update a SubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscriptionInstance */ update(callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>; /** * Update a SubscriptionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscriptionInstance */ update(params: SubscriptionContextUpdateOptions, callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SubscriptionContextSolution { sid: string; } export declare class SubscriptionContextImpl implements SubscriptionContext { protected _version: V1; protected _solution: SubscriptionContextSolution; protected _uri: string; protected _subscribedEvents?: SubscribedEventListInstance; constructor(_version: V1, sid: string); get subscribedEvents(): SubscribedEventListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>; update(params?: SubscriptionContextUpdateOptions | ((error: Error | null, item?: SubscriptionInstance) => any), callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SubscriptionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SubscriptionPayload extends TwilioResponsePayload { subscriptions: SubscriptionResource[]; } interface SubscriptionResource { account_sid: string; sid: string; date_created: Date; date_updated: Date; description: string; sink_sid: string; url: string; links: Record<string, string>; } export declare class SubscriptionInstance { protected _version: V1; protected _solution: SubscriptionContextSolution; protected _context?: SubscriptionContext; constructor(_version: V1, payload: SubscriptionResource, sid?: string); /** * The unique SID identifier of the Account. */ accountSid: string; /** * A 34 character string that uniquely identifies this Subscription. */ sid: string; /** * The date that this Subscription was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this Subscription was updated, given in ISO 8601 format. */ dateUpdated: Date; /** * A human readable description for the Subscription */ description: string; /** * The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. */ sinkSid: string; /** * The URL of this resource. */ url: string; /** * Contains a dictionary of URL links to nested resources of this Subscription. */ links: Record<string, string>; private get _proxy(); /** * Remove a SubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscriptionInstance */ fetch(callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>; /** * Update a SubscriptionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscriptionInstance */ update(callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>; /** * Update a SubscriptionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscriptionInstance */ update(params: SubscriptionContextUpdateOptions, callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>; /** * Access the subscribedEvents. */ subscribedEvents(): SubscribedEventListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; sid: string; dateCreated: Date; dateUpdated: Date; description: string; sinkSid: string; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SubscriptionSolution { } export interface SubscriptionListInstance { _version: V1; _solution: SubscriptionSolution; _uri: string; (sid: string): SubscriptionContext; get(sid: string): SubscriptionContext; /** * Create a SubscriptionInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SubscriptionInstance */ create(params: SubscriptionListInstanceCreateOptions, callback?: (error: Error | null, item?: SubscriptionInstance) => any): Promise<SubscriptionInstance>; /** * Streams SubscriptionInstance 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 { SubscriptionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SubscriptionInstance, done: (err?: Error) => void) => void): void; each(params: SubscriptionListInstanceEachOptions, callback?: (item: SubscriptionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SubscriptionInstance 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: SubscriptionPage) => any): Promise<SubscriptionPage>; /** * Lists SubscriptionInstance 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 { SubscriptionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SubscriptionInstance[]) => any): Promise<SubscriptionInstance[]>; list(params: SubscriptionListInstanceOptions, callback?: (error: Error | null, items: SubscriptionInstance[]) => any): Promise<SubscriptionInstance[]>; /** * Retrieve a single page of SubscriptionInstance 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 { SubscriptionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SubscriptionPage) => any): Promise<SubscriptionPage>; page(params: SubscriptionListInstancePageOptions, callback?: (error: Error | null, items: SubscriptionPage) => any): Promise<SubscriptionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SubscriptionListInstance(version: V1): SubscriptionListInstance; export declare class SubscriptionPage extends Page<V1, SubscriptionPayload, SubscriptionResource, SubscriptionInstance> { /** * Initialize the SubscriptionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SubscriptionSolution); /** * Build an instance of SubscriptionInstance * * @param payload - Payload response from the API */ getInstance(payload: SubscriptionResource): SubscriptionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/events/v1/sink/sinkTest.js000064400000004536151677225100012477 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Events * 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.SinkTestInstance = exports.SinkTestListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function SinkTestListInstance(version, sid) { if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { sid }; instance._uri = `/Sinks/${sid}/Test`; instance.create = function create(callback) { let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", }); operationPromise = operationPromise.then((payload) => new SinkTestInstance(operationVersion, payload, instance._solution.sid)); 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; } exports.SinkTestListInstance = SinkTestListInstance; class SinkTestInstance { constructor(_version, payload, sid) { this._version = _version; this.result = payload.result; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { result: this.result, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SinkTestInstance = SinkTestInstance; rest/events/v1/sink/sinkValidate.js000064400000005606151677225100013310 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Events * 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.SinkValidateInstance = exports.SinkValidateListInstance = void 0; const util_1 = require("util"); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function SinkValidateListInstance(version, sid) { if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { sid }; instance._uri = `/Sinks/${sid}/Validate`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["testId"] === null || params["testId"] === undefined) { throw new Error("Required parameter \"params['testId']\" missing."); } let data = {}; data["TestId"] = params["testId"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SinkValidateInstance(operationVersion, payload, instance._solution.sid)); 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; } exports.SinkValidateListInstance = SinkValidateListInstance; class SinkValidateInstance { constructor(_version, payload, sid) { this._version = _version; this.result = payload.result; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { result: this.result, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SinkValidateInstance = SinkValidateInstance; rest/events/v1/sink/sinkTest.d.ts000064400000002433151677225100012725 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; export interface SinkTestSolution { sid: string; } export interface SinkTestListInstance { _version: V1; _solution: SinkTestSolution; _uri: string; /** * Create a SinkTestInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SinkTestInstance */ create(callback?: (error: Error | null, item?: SinkTestInstance) => any): Promise<SinkTestInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SinkTestListInstance(version: V1, sid: string): SinkTestListInstance; interface SinkTestResource { result: string; } export declare class SinkTestInstance { protected _version: V1; constructor(_version: V1, payload: SinkTestResource, sid: string); /** * Feedback indicating whether the test event was generated. */ result: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { result: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/events/v1/sink/sinkValidate.d.ts000064400000003227151677225100013541 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import V1 from "../../V1"; /** * Options to pass to create a SinkValidateInstance */ export interface SinkValidateListInstanceCreateOptions { /** A 34 character string that uniquely identifies the test event for a Sink being validated. */ testId: string; } export interface SinkValidateSolution { sid: string; } export interface SinkValidateListInstance { _version: V1; _solution: SinkValidateSolution; _uri: string; /** * Create a SinkValidateInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SinkValidateInstance */ create(params: SinkValidateListInstanceCreateOptions, callback?: (error: Error | null, item?: SinkValidateInstance) => any): Promise<SinkValidateInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SinkValidateListInstance(version: V1, sid: string): SinkValidateListInstance; interface SinkValidateResource { result: string; } export declare class SinkValidateInstance { protected _version: V1; constructor(_version: V1, payload: SinkValidateResource, sid: string); /** * Feedback indicating whether the given Sink was validated. */ result: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { result: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export {}; rest/events/v1/sink.d.ts000064400000027233151677225100011126 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { SinkTestListInstance } from "./sink/sinkTest"; import { SinkValidateListInstance } from "./sink/sinkValidate"; export type SinkSinkType = "kinesis" | "webhook" | "segment"; export type SinkStatus = "initialized" | "validating" | "active" | "failed"; /** * Options to pass to update a SinkInstance */ export interface SinkContextUpdateOptions { /** A human readable description for the Sink **This value should not contain PII.** */ description: string; } /** * Options to pass to create a SinkInstance */ export interface SinkListInstanceCreateOptions { /** A human readable description for the Sink **This value should not contain PII.** */ description: string; /** The information required for Twilio to connect to the provided Sink encoded as JSON. */ sinkConfiguration: any; /** */ sinkType: SinkSinkType; } /** * Options to pass to each */ export interface SinkListInstanceEachOptions { /** A boolean query parameter filtering the results to return sinks used/not used by a subscription. */ inUse?: boolean; /** A String query parameter filtering the results by status `initialized`, `validating`, `active` or `failed`. */ status?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: SinkInstance, 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 SinkListInstanceOptions { /** A boolean query parameter filtering the results to return sinks used/not used by a subscription. */ inUse?: boolean; /** A String query parameter filtering the results by status `initialized`, `validating`, `active` or `failed`. */ status?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface SinkListInstancePageOptions { /** A boolean query parameter filtering the results to return sinks used/not used by a subscription. */ inUse?: boolean; /** A String query parameter filtering the results by status `initialized`, `validating`, `active` or `failed`. */ status?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface SinkContext { sinkTest: SinkTestListInstance; sinkValidate: SinkValidateListInstance; /** * Remove a SinkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SinkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SinkInstance */ fetch(callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>; /** * Update a SinkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SinkInstance */ update(params: SinkContextUpdateOptions, callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SinkContextSolution { sid: string; } export declare class SinkContextImpl implements SinkContext { protected _version: V1; protected _solution: SinkContextSolution; protected _uri: string; protected _sinkTest?: SinkTestListInstance; protected _sinkValidate?: SinkValidateListInstance; constructor(_version: V1, sid: string); get sinkTest(): SinkTestListInstance; get sinkValidate(): SinkValidateListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>; update(params: SinkContextUpdateOptions, callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SinkContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SinkPayload extends TwilioResponsePayload { sinks: SinkResource[]; } interface SinkResource { date_created: Date; date_updated: Date; description: string; sid: string; sink_configuration: any; sink_type: SinkSinkType; status: SinkStatus; url: string; links: Record<string, string>; } export declare class SinkInstance { protected _version: V1; protected _solution: SinkContextSolution; protected _context?: SinkContext; constructor(_version: V1, payload: SinkResource, sid?: string); /** * The date that this Sink was created, given in ISO 8601 format. */ dateCreated: Date; /** * The date that this Sink was updated, given in ISO 8601 format. */ dateUpdated: Date; /** * A human readable description for the Sink */ description: string; /** * A 34 character string that uniquely identifies this Sink. */ sid: string; /** * The information required for Twilio to connect to the provided Sink encoded as JSON. */ sinkConfiguration: any; sinkType: SinkSinkType; status: SinkStatus; /** * The URL of this resource. */ url: string; /** * Contains a dictionary of URL links to nested resources of this Sink. */ links: Record<string, string>; private get _proxy(); /** * Remove a SinkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SinkInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SinkInstance */ fetch(callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>; /** * Update a SinkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SinkInstance */ update(params: SinkContextUpdateOptions, callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>; /** * Access the sinkTest. */ sinkTest(): SinkTestListInstance; /** * Access the sinkValidate. */ sinkValidate(): SinkValidateListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { dateCreated: Date; dateUpdated: Date; description: string; sid: string; sinkConfiguration: any; sinkType: SinkSinkType; status: SinkStatus; url: string; links: Record<string, string>; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SinkSolution { } export interface SinkListInstance { _version: V1; _solution: SinkSolution; _uri: string; (sid: string): SinkContext; get(sid: string): SinkContext; /** * Create a SinkInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SinkInstance */ create(params: SinkListInstanceCreateOptions, callback?: (error: Error | null, item?: SinkInstance) => any): Promise<SinkInstance>; /** * Streams SinkInstance 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 { SinkListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SinkInstance, done: (err?: Error) => void) => void): void; each(params: SinkListInstanceEachOptions, callback?: (item: SinkInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SinkInstance 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: SinkPage) => any): Promise<SinkPage>; /** * Lists SinkInstance 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 { SinkListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SinkInstance[]) => any): Promise<SinkInstance[]>; list(params: SinkListInstanceOptions, callback?: (error: Error | null, items: SinkInstance[]) => any): Promise<SinkInstance[]>; /** * Retrieve a single page of SinkInstance 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 { SinkListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SinkPage) => any): Promise<SinkPage>; page(params: SinkListInstancePageOptions, callback?: (error: Error | null, items: SinkPage) => any): Promise<SinkPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SinkListInstance(version: V1): SinkListInstance; export declare class SinkPage extends Page<V1, SinkPayload, SinkResource, SinkInstance> { /** * Initialize the SinkPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SinkSolution); /** * Build an instance of SinkInstance * * @param payload - Payload response from the API */ getInstance(payload: SinkResource): SinkInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/events/v1/schema/schemaVersion.d.ts000064400000017707151677225100014235 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to each */ export interface SchemaVersionListInstanceEachOptions { /** 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: SchemaVersionInstance, 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 SchemaVersionListInstanceOptions { /** 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 SchemaVersionListInstancePageOptions { /** 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 SchemaVersionContext { /** * Fetch a SchemaVersionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SchemaVersionInstance */ fetch(callback?: (error: Error | null, item?: SchemaVersionInstance) => any): Promise<SchemaVersionInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SchemaVersionContextSolution { id: string; schemaVersion: number; } export declare class SchemaVersionContextImpl implements SchemaVersionContext { protected _version: V1; protected _solution: SchemaVersionContextSolution; protected _uri: string; constructor(_version: V1, id: string, schemaVersion: number); fetch(callback?: (error: Error | null, item?: SchemaVersionInstance) => any): Promise<SchemaVersionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SchemaVersionContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SchemaVersionPayload extends TwilioResponsePayload { schema_versions: SchemaVersionResource[]; } interface SchemaVersionResource { id: string; schema_version: number; date_created: Date; url: string; raw: string; } export declare class SchemaVersionInstance { protected _version: V1; protected _solution: SchemaVersionContextSolution; protected _context?: SchemaVersionContext; constructor(_version: V1, payload: SchemaVersionResource, id: string, schemaVersion?: number); /** * The unique identifier of the schema. Each schema can have multiple versions, that share the same id. */ id: string; /** * The version of this schema. */ schemaVersion: number; /** * The date the schema version was created, given in ISO 8601 format. */ dateCreated: Date; /** * The URL of this resource. */ url: string; raw: string; private get _proxy(); /** * Fetch a SchemaVersionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SchemaVersionInstance */ fetch(callback?: (error: Error | null, item?: SchemaVersionInstance) => any): Promise<SchemaVersionInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { id: string; schemaVersion: number; dateCreated: Date; url: string; raw: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SchemaVersionSolution { id: string; } export interface SchemaVersionListInstance { _version: V1; _solution: SchemaVersionSolution; _uri: string; (schemaVersion: number): SchemaVersionContext; get(schemaVersion: number): SchemaVersionContext; /** * Streams SchemaVersionInstance 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 { SchemaVersionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SchemaVersionInstance, done: (err?: Error) => void) => void): void; each(params: SchemaVersionListInstanceEachOptions, callback?: (item: SchemaVersionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SchemaVersionInstance 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: SchemaVersionPage) => any): Promise<SchemaVersionPage>; /** * Lists SchemaVersionInstance 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 { SchemaVersionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SchemaVersionInstance[]) => any): Promise<SchemaVersionInstance[]>; list(params: SchemaVersionListInstanceOptions, callback?: (error: Error | null, items: SchemaVersionInstance[]) => any): Promise<SchemaVersionInstance[]>; /** * Retrieve a single page of SchemaVersionInstance 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 { SchemaVersionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SchemaVersionPage) => any): Promise<SchemaVersionPage>; page(params: SchemaVersionListInstancePageOptions, callback?: (error: Error | null, items: SchemaVersionPage) => any): Promise<SchemaVersionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SchemaVersionListInstance(version: V1, id: string): SchemaVersionListInstance; export declare class SchemaVersionPage extends Page<V1, SchemaVersionPayload, SchemaVersionResource, SchemaVersionInstance> { /** * Initialize the SchemaVersionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SchemaVersionSolution); /** * Build an instance of SchemaVersionInstance * * @param payload - Payload response from the API */ getInstance(payload: SchemaVersionResource): SchemaVersionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/events/v1/schema/schemaVersion.js000064400000015513151677225100013772 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Events * 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.SchemaVersionPage = exports.SchemaVersionListInstance = exports.SchemaVersionInstance = exports.SchemaVersionContextImpl = void 0; 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 SchemaVersionContextImpl { constructor(_version, id, schemaVersion) { this._version = _version; if (!(0, utility_1.isValidPathParam)(id)) { throw new Error("Parameter 'id' is not valid."); } if (!(0, utility_1.isValidPathParam)(schemaVersion)) { throw new Error("Parameter 'schemaVersion' is not valid."); } this._solution = { id, schemaVersion }; this._uri = `/Schemas/${id}/Versions/${schemaVersion}`; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SchemaVersionInstance(operationVersion, payload, instance._solution.id, instance._solution.schemaVersion)); 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.SchemaVersionContextImpl = SchemaVersionContextImpl; class SchemaVersionInstance { constructor(_version, payload, id, schemaVersion) { this._version = _version; this.id = payload.id; this.schemaVersion = deserialize.integer(payload.schema_version); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.url = payload.url; this.raw = payload.raw; this._solution = { id, schemaVersion: schemaVersion || this.schemaVersion }; } get _proxy() { this._context = this._context || new SchemaVersionContextImpl(this._version, this._solution.id, this._solution.schemaVersion); return this._context; } /** * Fetch a SchemaVersionInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SchemaVersionInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { id: this.id, schemaVersion: this.schemaVersion, dateCreated: this.dateCreated, url: this.url, raw: this.raw, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SchemaVersionInstance = SchemaVersionInstance; function SchemaVersionListInstance(version, id) { if (!(0, utility_1.isValidPathParam)(id)) { throw new Error("Parameter 'id' is not valid."); } const instance = ((schemaVersion) => instance.get(schemaVersion)); instance.get = function get(schemaVersion) { return new SchemaVersionContextImpl(version, id, schemaVersion); }; instance._version = version; instance._solution = { id }; instance._uri = `/Schemas/${id}/Versions`; 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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SchemaVersionPage(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 SchemaVersionPage(instance._version, payload, 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; } exports.SchemaVersionListInstance = SchemaVersionListInstance; class SchemaVersionPage extends Page_1.default { /** * Initialize the SchemaVersionPage * * @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 SchemaVersionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SchemaVersionInstance(this._version, payload, this._solution.id); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SchemaVersionPage = SchemaVersionPage; rest/events/V1.js000064400000003637151677225100007670 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Events * 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 eventType_1 = require("./v1/eventType"); const schema_1 = require("./v1/schema"); const sink_1 = require("./v1/sink"); const subscription_1 = require("./v1/subscription"); class V1 extends Version_1.default { /** * Initialize the V1 version of Events * * @param domain - The Twilio (Twilio.Events) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for eventTypes resource */ get eventTypes() { this._eventTypes = this._eventTypes || (0, eventType_1.EventTypeListInstance)(this); return this._eventTypes; } /** Getter for schemas resource */ get schemas() { this._schemas = this._schemas || (0, schema_1.SchemaListInstance)(this); return this._schemas; } /** Getter for sinks resource */ get sinks() { this._sinks = this._sinks || (0, sink_1.SinkListInstance)(this); return this._sinks; } /** Getter for subscriptions resource */ get subscriptions() { this._subscriptions = this._subscriptions || (0, subscription_1.SubscriptionListInstance)(this); return this._subscriptions; } } exports.default = V1; rest/wireless/V1.d.ts000064400000002451151677225100010446 0ustar00import WirelessBase from "../WirelessBase"; import Version from "../../base/Version"; import { CommandListInstance } from "./v1/command"; import { RatePlanListInstance } from "./v1/ratePlan"; import { SimListInstance } from "./v1/sim"; import { UsageRecordListInstance } from "./v1/usageRecord"; export default class V1 extends Version { /** * Initialize the V1 version of Wireless * * @param domain - The Twilio (Twilio.Wireless) domain */ constructor(domain: WirelessBase); /** commands - { Twilio.Wireless.V1.CommandListInstance } resource */ protected _commands?: CommandListInstance; /** ratePlans - { Twilio.Wireless.V1.RatePlanListInstance } resource */ protected _ratePlans?: RatePlanListInstance; /** sims - { Twilio.Wireless.V1.SimListInstance } resource */ protected _sims?: SimListInstance; /** usageRecords - { Twilio.Wireless.V1.UsageRecordListInstance } resource */ protected _usageRecords?: UsageRecordListInstance; /** Getter for commands resource */ get commands(): CommandListInstance; /** Getter for ratePlans resource */ get ratePlans(): RatePlanListInstance; /** Getter for sims resource */ get sims(): SimListInstance; /** Getter for usageRecords resource */ get usageRecords(): UsageRecordListInstance; } rest/wireless/v1/sim.js000064400000030721151677225100011043 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Wireless * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimPage = exports.SimListInstance = exports.SimInstance = exports.SimContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); const dataSession_1 = require("./sim/dataSession"); const usageRecord_1 = require("./sim/usageRecord"); class SimContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/Sims/${sid}`; } get dataSessions() { this._dataSessions = this._dataSessions || (0, dataSession_1.DataSessionListInstance)(this._version, this._solution.sid); return this._dataSessions; } get usageRecords() { this._usageRecords = this._usageRecords || (0, usageRecord_1.UsageRecordListInstance)(this._version, this._solution.sid); return this._usageRecords; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new SimInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["ratePlan"] !== undefined) data["RatePlan"] = params["ratePlan"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["commandsCallbackMethod"] !== undefined) data["CommandsCallbackMethod"] = params["commandsCallbackMethod"]; if (params["commandsCallbackUrl"] !== undefined) data["CommandsCallbackUrl"] = params["commandsCallbackUrl"]; if (params["smsFallbackMethod"] !== undefined) data["SmsFallbackMethod"] = params["smsFallbackMethod"]; if (params["smsFallbackUrl"] !== undefined) data["SmsFallbackUrl"] = params["smsFallbackUrl"]; if (params["smsMethod"] !== undefined) data["SmsMethod"] = params["smsMethod"]; if (params["smsUrl"] !== undefined) data["SmsUrl"] = params["smsUrl"]; if (params["voiceFallbackMethod"] !== undefined) data["VoiceFallbackMethod"] = params["voiceFallbackMethod"]; if (params["voiceFallbackUrl"] !== undefined) data["VoiceFallbackUrl"] = params["voiceFallbackUrl"]; if (params["voiceMethod"] !== undefined) data["VoiceMethod"] = params["voiceMethod"]; if (params["voiceUrl"] !== undefined) data["VoiceUrl"] = params["voiceUrl"]; if (params["resetStatus"] !== undefined) data["ResetStatus"] = params["resetStatus"]; if (params["accountSid"] !== undefined) data["AccountSid"] = params["accountSid"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new SimInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimContextImpl = SimContextImpl; class SimInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.ratePlanSid = payload.rate_plan_sid; this.friendlyName = payload.friendly_name; this.iccid = payload.iccid; this.eId = payload.e_id; this.status = payload.status; this.resetStatus = payload.reset_status; this.commandsCallbackUrl = payload.commands_callback_url; this.commandsCallbackMethod = payload.commands_callback_method; this.smsFallbackMethod = payload.sms_fallback_method; this.smsFallbackUrl = payload.sms_fallback_url; this.smsMethod = payload.sms_method; this.smsUrl = payload.sms_url; this.voiceFallbackMethod = payload.voice_fallback_method; this.voiceFallbackUrl = payload.voice_fallback_url; this.voiceMethod = payload.voice_method; this.voiceUrl = payload.voice_url; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this.links = payload.links; this.ipAddress = payload.ip_address; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new SimContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Access the dataSessions. */ dataSessions() { return this._proxy.dataSessions; } /** * Access the usageRecords. */ usageRecords() { return this._proxy.usageRecords; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, ratePlanSid: this.ratePlanSid, friendlyName: this.friendlyName, iccid: this.iccid, eId: this.eId, status: this.status, resetStatus: this.resetStatus, commandsCallbackUrl: this.commandsCallbackUrl, commandsCallbackMethod: this.commandsCallbackMethod, smsFallbackMethod: this.smsFallbackMethod, smsFallbackUrl: this.smsFallbackUrl, smsMethod: this.smsMethod, smsUrl: this.smsUrl, voiceFallbackMethod: this.voiceFallbackMethod, voiceFallbackUrl: this.voiceFallbackUrl, voiceMethod: this.voiceMethod, voiceUrl: this.voiceUrl, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, links: this.links, ipAddress: this.ipAddress, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimInstance = SimInstance; function SimListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new SimContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Sims`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["iccid"] !== undefined) data["Iccid"] = params["iccid"]; if (params["ratePlan"] !== undefined) data["RatePlan"] = params["ratePlan"]; if (params["eId"] !== undefined) data["EId"] = params["eId"]; if (params["simRegistrationCode"] !== undefined) data["SimRegistrationCode"] = params["simRegistrationCode"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new SimPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new SimPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.SimListInstance = SimListInstance; class SimPage extends Page_1.default { /** * Initialize the SimPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of SimInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new SimInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.SimPage = SimPage; rest/wireless/v1/command.js000064400000022562151677225100011675 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Wireless * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CommandPage = exports.CommandListInstance = exports.CommandInstance = exports.CommandContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class CommandContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/Commands/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new CommandInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CommandContextImpl = CommandContextImpl; class CommandInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.accountSid = payload.account_sid; this.simSid = payload.sim_sid; this.command = payload.command; this.commandMode = payload.command_mode; this.transport = payload.transport; this.deliveryReceiptRequested = payload.delivery_receipt_requested; this.status = payload.status; this.direction = payload.direction; this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new CommandContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a CommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a CommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CommandInstance */ fetch(callback) { return this._proxy.fetch(callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, accountSid: this.accountSid, simSid: this.simSid, command: this.command, commandMode: this.commandMode, transport: this.transport, deliveryReceiptRequested: this.deliveryReceiptRequested, status: this.status, direction: this.direction, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CommandInstance = CommandInstance; function CommandListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new CommandContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/Commands`; instance.create = function create(params, callback) { if (params === null || params === undefined) { throw new Error('Required parameter "params" missing.'); } if (params["command"] === null || params["command"] === undefined) { throw new Error("Required parameter \"params['command']\" missing."); } let data = {}; data["Command"] = params["command"]; if (params["sim"] !== undefined) data["Sim"] = params["sim"]; if (params["callbackMethod"] !== undefined) data["CallbackMethod"] = params["callbackMethod"]; if (params["callbackUrl"] !== undefined) data["CallbackUrl"] = params["callbackUrl"]; if (params["commandMode"] !== undefined) data["CommandMode"] = params["commandMode"]; if (params["includeSid"] !== undefined) data["IncludeSid"] = params["includeSid"]; if (params["deliveryReceiptRequested"] !== undefined) data["DeliveryReceiptRequested"] = serialize.bool(params["deliveryReceiptRequested"]); const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new CommandInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["sim"] !== undefined) data["Sim"] = params["sim"]; if (params["status"] !== undefined) data["Status"] = params["status"]; if (params["direction"] !== undefined) data["Direction"] = params["direction"]; if (params["transport"] !== undefined) data["Transport"] = params["transport"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new CommandPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new CommandPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.CommandListInstance = CommandListInstance; class CommandPage extends Page_1.default { /** * Initialize the CommandPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of CommandInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new CommandInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.CommandPage = CommandPage; rest/wireless/v1/usageRecord.d.ts000064400000020376151677225100012757 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type UsageRecordGranularity = "hourly" | "daily" | "all"; /** * Options to pass to each */ export interface UsageRecordListInstanceEachOptions { /** Only include usage that has occurred on or before this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */ end?: Date; /** Only include usage that has occurred on or after this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */ start?: Date; /** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */ granularity?: UsageRecordGranularity; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface UsageRecordListInstanceOptions { /** Only include usage that has occurred on or before this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */ end?: Date; /** Only include usage that has occurred on or after this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */ start?: Date; /** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */ granularity?: UsageRecordGranularity; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface UsageRecordListInstancePageOptions { /** Only include usage that has occurred on or before this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */ end?: Date; /** Only include usage that has occurred on or after this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). */ start?: Date; /** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */ granularity?: UsageRecordGranularity; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface UsageRecordSolution { } export interface UsageRecordListInstance { _version: V1; _solution: UsageRecordSolution; _uri: string; /** * Streams UsageRecordInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { UsageRecordListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void; each(params: UsageRecordListInstanceEachOptions, callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UsageRecordInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>; /** * Lists UsageRecordInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { UsageRecordListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UsageRecordInstance[]) => any): Promise<UsageRecordInstance[]>; list(params: UsageRecordListInstanceOptions, callback?: (error: Error | null, items: UsageRecordInstance[]) => any): Promise<UsageRecordInstance[]>; /** * Retrieve a single page of UsageRecordInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { UsageRecordListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>; page(params: UsageRecordListInstancePageOptions, callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UsageRecordListInstance(version: V1): UsageRecordListInstance; interface UsageRecordPayload extends TwilioResponsePayload { usage_records: UsageRecordResource[]; } interface UsageRecordResource { account_sid: string; period: any; commands: any; data: any; } export declare class UsageRecordInstance { protected _version: V1; constructor(_version: V1, payload: UsageRecordResource); /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AccountUsageRecord resource. */ accountSid: string; /** * The time period for which usage is reported. Contains `start` and `end` properties that describe the period using GMT date-time values specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ period: any; /** * An object that describes the aggregated Commands usage for all SIMs during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/iot/wireless/api/account-usagerecord-resource#commands-usage-object). */ commands: any; /** * An object that describes the aggregated Data usage for all SIMs over the period. See [Data Usage Object](https://www.twilio.com/docs/iot/wireless/api/account-usagerecord-resource#data-usage-object). */ data: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { accountSid: string; period: any; commands: any; data: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class UsageRecordPage extends Page<V1, UsageRecordPayload, UsageRecordResource, UsageRecordInstance> { /** * Initialize the UsageRecordPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UsageRecordSolution); /** * Build an instance of UsageRecordInstance * * @param payload - Payload response from the API */ getInstance(payload: UsageRecordResource): UsageRecordInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/wireless/v1/ratePlan.d.ts000064400000040513151677225100012255 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; /** * Options to pass to update a RatePlanInstance */ export interface RatePlanContextUpdateOptions { /** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */ uniqueName?: string; /** A descriptive string that you create to describe the resource. It does not have to be unique. */ friendlyName?: string; } /** * Options to pass to create a RatePlanInstance */ export interface RatePlanListInstanceCreateOptions { /** An application-defined string that uniquely identifies the resource. It can be used in place of the resource\\\'s `sid` in the URL to address the resource. */ uniqueName?: string; /** A descriptive string that you create to describe the resource. It does not have to be unique. */ friendlyName?: string; /** Whether SIMs can use GPRS/3G/4G/LTE data connectivity. */ dataEnabled?: boolean; /** The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB and the default value is `1000`. */ dataLimit?: number; /** The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#payg-vs-quota-data-plans). */ dataMetering?: string; /** Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/iot/wireless/api/command-resource). */ messagingEnabled?: boolean; /** Deprecated. */ voiceEnabled?: boolean; /** Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming). */ nationalRoamingEnabled?: boolean; /** The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. */ internationalRoaming?: Array<string>; /** The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. */ nationalRoamingDataLimit?: number; /** The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. */ internationalRoamingDataLimit?: number; } /** * Options to pass to each */ export interface RatePlanListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface RatePlanListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface RatePlanListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface RatePlanContext { /** * Remove a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Update a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ update(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Update a RatePlanInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ update(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface RatePlanContextSolution { sid: string; } export declare class RatePlanContextImpl implements RatePlanContext { protected _version: V1; protected _solution: RatePlanContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; update(params?: RatePlanContextUpdateOptions | ((error: Error | null, item?: RatePlanInstance) => any), callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): RatePlanContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface RatePlanPayload extends TwilioResponsePayload { rate_plans: RatePlanResource[]; } interface RatePlanResource { sid: string; unique_name: string; account_sid: string; friendly_name: string; data_enabled: boolean; data_metering: string; data_limit: number; messaging_enabled: boolean; voice_enabled: boolean; national_roaming_enabled: boolean; national_roaming_data_limit: number; international_roaming: Array<string>; international_roaming_data_limit: number; date_created: Date; date_updated: Date; url: string; } export declare class RatePlanInstance { protected _version: V1; protected _solution: RatePlanContextSolution; protected _context?: RatePlanContext; constructor(_version: V1, payload: RatePlanResource, sid?: string); /** * The unique string that we created to identify the RatePlan resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RatePlan resource. */ accountSid: string; /** * The string that you assigned to describe the resource. */ friendlyName: string; /** * Whether SIMs can use GPRS/3G/4G/LTE data connectivity. */ dataEnabled: boolean; /** * The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#payg-vs-quota-data-plans). */ dataMetering: string; /** * The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. */ dataLimit: number; /** * Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/iot/wireless/api/command-resource). */ messagingEnabled: boolean; /** * Deprecated. Whether SIMs can make and receive voice calls. */ voiceEnabled: boolean; /** * Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming). */ nationalRoamingEnabled: boolean; /** * The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. */ nationalRoamingDataLimit: number; /** * The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. */ internationalRoaming: Array<string>; /** * The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. */ internationalRoamingDataLimit: number; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ fetch(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Update a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ update(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Update a RatePlanInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ update(params: RatePlanContextUpdateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; friendlyName: string; dataEnabled: boolean; dataMetering: string; dataLimit: number; messagingEnabled: boolean; voiceEnabled: boolean; nationalRoamingEnabled: boolean; nationalRoamingDataLimit: number; internationalRoaming: string[]; internationalRoamingDataLimit: number; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface RatePlanSolution { } export interface RatePlanListInstance { _version: V1; _solution: RatePlanSolution; _uri: string; (sid: string): RatePlanContext; get(sid: string): RatePlanContext; /** * Create a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ create(callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Create a RatePlanInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ create(params: RatePlanListInstanceCreateOptions, callback?: (error: Error | null, item?: RatePlanInstance) => any): Promise<RatePlanInstance>; /** * Streams RatePlanInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { RatePlanListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void; each(params: RatePlanListInstanceEachOptions, callback?: (item: RatePlanInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of RatePlanInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>; /** * Lists RatePlanInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { RatePlanListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: RatePlanInstance[]) => any): Promise<RatePlanInstance[]>; list(params: RatePlanListInstanceOptions, callback?: (error: Error | null, items: RatePlanInstance[]) => any): Promise<RatePlanInstance[]>; /** * Retrieve a single page of RatePlanInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { RatePlanListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>; page(params: RatePlanListInstancePageOptions, callback?: (error: Error | null, items: RatePlanPage) => any): Promise<RatePlanPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function RatePlanListInstance(version: V1): RatePlanListInstance; export declare class RatePlanPage extends Page<V1, RatePlanPayload, RatePlanResource, RatePlanInstance> { /** * Initialize the RatePlanPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: RatePlanSolution); /** * Build an instance of RatePlanInstance * * @param payload - Payload response from the API */ getInstance(payload: RatePlanResource): RatePlanInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/wireless/v1/sim/dataSession.js000064400000013513151677225100013320 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Wireless * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DataSessionPage = exports.DataSessionInstance = exports.DataSessionListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function DataSessionListInstance(version, simSid) { if (!(0, utility_1.isValidPathParam)(simSid)) { throw new Error("Parameter 'simSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { simSid }; instance._uri = `/Sims/${simSid}/DataSessions`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new DataSessionPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new DataSessionPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.DataSessionListInstance = DataSessionListInstance; class DataSessionInstance { constructor(_version, payload, simSid) { this._version = _version; this.sid = payload.sid; this.simSid = payload.sim_sid; this.accountSid = payload.account_sid; this.radioLink = payload.radio_link; this.operatorMcc = payload.operator_mcc; this.operatorMnc = payload.operator_mnc; this.operatorCountry = payload.operator_country; this.operatorName = payload.operator_name; this.cellId = payload.cell_id; this.cellLocationEstimate = payload.cell_location_estimate; this.packetsUploaded = deserialize.integer(payload.packets_uploaded); this.packetsDownloaded = deserialize.integer(payload.packets_downloaded); this.lastUpdated = deserialize.iso8601DateTime(payload.last_updated); this.start = deserialize.iso8601DateTime(payload.start); this.end = deserialize.iso8601DateTime(payload.end); this.imei = payload.imei; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, simSid: this.simSid, accountSid: this.accountSid, radioLink: this.radioLink, operatorMcc: this.operatorMcc, operatorMnc: this.operatorMnc, operatorCountry: this.operatorCountry, operatorName: this.operatorName, cellId: this.cellId, cellLocationEstimate: this.cellLocationEstimate, packetsUploaded: this.packetsUploaded, packetsDownloaded: this.packetsDownloaded, lastUpdated: this.lastUpdated, start: this.start, end: this.end, imei: this.imei, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DataSessionInstance = DataSessionInstance; class DataSessionPage extends Page_1.default { /** * Initialize the DataSessionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of DataSessionInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new DataSessionInstance(this._version, payload, this._solution.simSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.DataSessionPage = DataSessionPage; rest/wireless/v1/sim/usageRecord.d.ts000064400000021435151677225100013544 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; export type UsageRecordGranularity = "hourly" | "daily" | "all"; /** * Options to pass to each */ export interface UsageRecordListInstanceEachOptions { /** Only include usage that occurred on or before this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is the current time. */ end?: Date; /** Only include usage that has occurred on or after this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is one month before the `end` parameter value. */ start?: Date; /** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */ granularity?: UsageRecordGranularity; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface UsageRecordListInstanceOptions { /** Only include usage that occurred on or before this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is the current time. */ end?: Date; /** Only include usage that has occurred on or after this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is one month before the `end` parameter value. */ start?: Date; /** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */ granularity?: UsageRecordGranularity; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface UsageRecordListInstancePageOptions { /** Only include usage that occurred on or before this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is the current time. */ end?: Date; /** Only include usage that has occurred on or after this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is one month before the `end` parameter value. */ start?: Date; /** How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. */ granularity?: UsageRecordGranularity; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface UsageRecordSolution { simSid: string; } export interface UsageRecordListInstance { _version: V1; _solution: UsageRecordSolution; _uri: string; /** * Streams UsageRecordInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { UsageRecordListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void; each(params: UsageRecordListInstanceEachOptions, callback?: (item: UsageRecordInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of UsageRecordInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>; /** * Lists UsageRecordInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { UsageRecordListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: UsageRecordInstance[]) => any): Promise<UsageRecordInstance[]>; list(params: UsageRecordListInstanceOptions, callback?: (error: Error | null, items: UsageRecordInstance[]) => any): Promise<UsageRecordInstance[]>; /** * Retrieve a single page of UsageRecordInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { UsageRecordListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>; page(params: UsageRecordListInstancePageOptions, callback?: (error: Error | null, items: UsageRecordPage) => any): Promise<UsageRecordPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function UsageRecordListInstance(version: V1, simSid: string): UsageRecordListInstance; interface UsageRecordPayload extends TwilioResponsePayload { usage_records: UsageRecordResource[]; } interface UsageRecordResource { sim_sid: string; account_sid: string; period: any; commands: any; data: any; } export declare class UsageRecordInstance { protected _version: V1; constructor(_version: V1, payload: UsageRecordResource, simSid: string); /** * The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that this Usage Record is for. */ simSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resource. */ accountSid: string; /** * The time period for which the usage is reported. Contains `start` and `end` datetime values given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ period: any; /** * An object that describes the SIM\'s usage of Commands during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/iot/wireless/api/sim-usagerecord-resource#commands-usage-object). */ commands: any; /** * An object that describes the SIM\'s data usage during the specified period. See [Data Usage Object](https://www.twilio.com/docs/iot/wireless/api/sim-usagerecord-resource#data-usage-object). */ data: any; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { simSid: string; accountSid: string; period: any; commands: any; data: any; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class UsageRecordPage extends Page<V1, UsageRecordPayload, UsageRecordResource, UsageRecordInstance> { /** * Initialize the UsageRecordPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: UsageRecordSolution); /** * Build an instance of UsageRecordInstance * * @param payload - Payload response from the API */ getInstance(payload: UsageRecordResource): UsageRecordInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/wireless/v1/sim/usageRecord.js000064400000012024151677225100013302 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Wireless * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.UsageRecordPage = exports.UsageRecordInstance = exports.UsageRecordListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../../base/Page")); const deserialize = require("../../../../base/deserialize"); const serialize = require("../../../../base/serialize"); const utility_1 = require("../../../../base/utility"); function UsageRecordListInstance(version, simSid) { if (!(0, utility_1.isValidPathParam)(simSid)) { throw new Error("Parameter 'simSid' is not valid."); } const instance = {}; instance._version = version; instance._solution = { simSid }; instance._uri = `/Sims/${simSid}/UsageRecords`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["end"] !== undefined) data["End"] = serialize.iso8601DateTime(params["end"]); if (params["start"] !== undefined) data["Start"] = serialize.iso8601DateTime(params["start"]); if (params["granularity"] !== undefined) data["Granularity"] = params["granularity"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UsageRecordPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new UsageRecordPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.UsageRecordListInstance = UsageRecordListInstance; class UsageRecordInstance { constructor(_version, payload, simSid) { this._version = _version; this.simSid = payload.sim_sid; this.accountSid = payload.account_sid; this.period = payload.period; this.commands = payload.commands; this.data = payload.data; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { simSid: this.simSid, accountSid: this.accountSid, period: this.period, commands: this.commands, data: this.data, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsageRecordInstance = UsageRecordInstance; class UsageRecordPage extends Page_1.default { /** * Initialize the UsageRecordPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of UsageRecordInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UsageRecordInstance(this._version, payload, this._solution.simSid); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsageRecordPage = UsageRecordPage; rest/wireless/v1/sim/dataSession.d.ts000064400000022512151677225100013553 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../../base/Page"; import Response from "../../../../http/response"; import V1 from "../../V1"; /** * Options to pass to each */ export interface DataSessionListInstanceEachOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: DataSessionInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface DataSessionListInstanceOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface DataSessionListInstancePageOptions { /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface DataSessionSolution { simSid: string; } export interface DataSessionListInstance { _version: V1; _solution: DataSessionSolution; _uri: string; /** * Streams DataSessionInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { DataSessionListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: DataSessionInstance, done: (err?: Error) => void) => void): void; each(params: DataSessionListInstanceEachOptions, callback?: (item: DataSessionInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of DataSessionInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: DataSessionPage) => any): Promise<DataSessionPage>; /** * Lists DataSessionInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { DataSessionListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: DataSessionInstance[]) => any): Promise<DataSessionInstance[]>; list(params: DataSessionListInstanceOptions, callback?: (error: Error | null, items: DataSessionInstance[]) => any): Promise<DataSessionInstance[]>; /** * Retrieve a single page of DataSessionInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { DataSessionListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: DataSessionPage) => any): Promise<DataSessionPage>; page(params: DataSessionListInstancePageOptions, callback?: (error: Error | null, items: DataSessionPage) => any): Promise<DataSessionPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function DataSessionListInstance(version: V1, simSid: string): DataSessionListInstance; interface DataSessionPayload extends TwilioResponsePayload { data_sessions: DataSessionResource[]; } interface DataSessionResource { sid: string; sim_sid: string; account_sid: string; radio_link: string; operator_mcc: string; operator_mnc: string; operator_country: string; operator_name: string; cell_id: string; cell_location_estimate: any; packets_uploaded: number; packets_downloaded: number; last_updated: Date; start: Date; end: Date; imei: string; } export declare class DataSessionInstance { protected _version: V1; constructor(_version: V1, payload: DataSessionResource, simSid: string); /** * The unique string that we created to identify the DataSession resource. */ sid: string; /** * The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that the Data Session is for. */ simSid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DataSession resource. */ accountSid: string; /** * The generation of wireless technology that the device was using. */ radioLink: string; /** * The \'mobile country code\' is the unique ID of the home country where the Data Session took place. See: [MCC/MNC lookup](http://mcc-mnc.com/). */ operatorMcc: string; /** * The \'mobile network code\' is the unique ID specific to the mobile operator network where the Data Session took place. */ operatorMnc: string; /** * The three letter country code representing where the device\'s Data Session took place. This is determined by looking up the `operator_mcc`. */ operatorCountry: string; /** * The friendly name of the mobile operator network that the [SIM](https://www.twilio.com/docs/iot/wireless/api/sim-resource)-connected device is attached to. This is determined by looking up the `operator_mnc`. */ operatorName: string; /** * The unique ID of the cellular tower that the device was attached to at the moment when the Data Session was last updated. */ cellId: string; /** * An object that describes the estimated location in latitude and longitude where the device\'s Data Session took place. The location is derived from the `cell_id` when the Data Session was last updated. See [Cell Location Estimate Object](https://www.twilio.com/docs/iot/wireless/api/datasession-resource#cell-location-estimate-object). */ cellLocationEstimate: any; /** * The number of packets uploaded by the device between the `start` time and when the Data Session was last updated. */ packetsUploaded: number; /** * The number of packets downloaded by the device between the `start` time and when the Data Session was last updated. */ packetsDownloaded: number; /** * The date that the resource was last updated, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ lastUpdated: Date; /** * The date that the Data Session started, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ start: Date; /** * The date that the record ended, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ end: Date; /** * The \'international mobile equipment identity\' is the unique ID of the device using the SIM to connect. An IMEI is a 15-digit string: 14 digits for the device identifier plus a check digit calculated using the Luhn formula. */ imei: string; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; simSid: string; accountSid: string; radioLink: string; operatorMcc: string; operatorMnc: string; operatorCountry: string; operatorName: string; cellId: string; cellLocationEstimate: any; packetsUploaded: number; packetsDownloaded: number; lastUpdated: Date; start: Date; end: Date; imei: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export declare class DataSessionPage extends Page<V1, DataSessionPayload, DataSessionResource, DataSessionInstance> { /** * Initialize the DataSessionPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: DataSessionSolution); /** * Build an instance of DataSessionInstance * * @param payload - Payload response from the API */ getInstance(payload: DataSessionResource): DataSessionInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/wireless/v1/ratePlan.js000064400000026570151677225100012030 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Wireless * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RatePlanPage = exports.RatePlanListInstance = exports.RatePlanInstance = exports.RatePlanContextImpl = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); const utility_1 = require("../../../base/utility"); class RatePlanContextImpl { constructor(_version, sid) { this._version = _version; if (!(0, utility_1.isValidPathParam)(sid)) { throw new Error("Parameter 'sid' is not valid."); } this._solution = { sid }; this._uri = `/RatePlans/${sid}`; } remove(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.remove({ uri: instance._uri, method: "delete", }); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } fetch(callback) { const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", }); operationPromise = operationPromise.then((payload) => new RatePlanInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } update(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.update({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RatePlanInstance(operationVersion, payload, instance._solution.sid)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return this._solution; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RatePlanContextImpl = RatePlanContextImpl; class RatePlanInstance { constructor(_version, payload, sid) { this._version = _version; this.sid = payload.sid; this.uniqueName = payload.unique_name; this.accountSid = payload.account_sid; this.friendlyName = payload.friendly_name; this.dataEnabled = payload.data_enabled; this.dataMetering = payload.data_metering; this.dataLimit = deserialize.integer(payload.data_limit); this.messagingEnabled = payload.messaging_enabled; this.voiceEnabled = payload.voice_enabled; this.nationalRoamingEnabled = payload.national_roaming_enabled; this.nationalRoamingDataLimit = deserialize.integer(payload.national_roaming_data_limit); this.internationalRoaming = payload.international_roaming; this.internationalRoamingDataLimit = deserialize.integer(payload.international_roaming_data_limit); this.dateCreated = deserialize.iso8601DateTime(payload.date_created); this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); this.url = payload.url; this._solution = { sid: sid || this.sid }; } get _proxy() { this._context = this._context || new RatePlanContextImpl(this._version, this._solution.sid); return this._context; } /** * Remove a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback) { return this._proxy.remove(callback); } /** * Fetch a RatePlanInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed RatePlanInstance */ fetch(callback) { return this._proxy.fetch(callback); } update(params, callback) { return this._proxy.update(params, callback); } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { sid: this.sid, uniqueName: this.uniqueName, accountSid: this.accountSid, friendlyName: this.friendlyName, dataEnabled: this.dataEnabled, dataMetering: this.dataMetering, dataLimit: this.dataLimit, messagingEnabled: this.messagingEnabled, voiceEnabled: this.voiceEnabled, nationalRoamingEnabled: this.nationalRoamingEnabled, nationalRoamingDataLimit: this.nationalRoamingDataLimit, internationalRoaming: this.internationalRoaming, internationalRoamingDataLimit: this.internationalRoamingDataLimit, dateCreated: this.dateCreated, dateUpdated: this.dateUpdated, url: this.url, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RatePlanInstance = RatePlanInstance; function RatePlanListInstance(version) { const instance = ((sid) => instance.get(sid)); instance.get = function get(sid) { return new RatePlanContextImpl(version, sid); }; instance._version = version; instance._solution = {}; instance._uri = `/RatePlans`; instance.create = function create(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["uniqueName"] !== undefined) data["UniqueName"] = params["uniqueName"]; if (params["friendlyName"] !== undefined) data["FriendlyName"] = params["friendlyName"]; if (params["dataEnabled"] !== undefined) data["DataEnabled"] = serialize.bool(params["dataEnabled"]); if (params["dataLimit"] !== undefined) data["DataLimit"] = params["dataLimit"]; if (params["dataMetering"] !== undefined) data["DataMetering"] = params["dataMetering"]; if (params["messagingEnabled"] !== undefined) data["MessagingEnabled"] = serialize.bool(params["messagingEnabled"]); if (params["voiceEnabled"] !== undefined) data["VoiceEnabled"] = serialize.bool(params["voiceEnabled"]); if (params["nationalRoamingEnabled"] !== undefined) data["NationalRoamingEnabled"] = serialize.bool(params["nationalRoamingEnabled"]); if (params["internationalRoaming"] !== undefined) data["InternationalRoaming"] = serialize.map(params["internationalRoaming"], (e) => e); if (params["nationalRoamingDataLimit"] !== undefined) data["NationalRoamingDataLimit"] = params["nationalRoamingDataLimit"]; if (params["internationalRoamingDataLimit"] !== undefined) data["InternationalRoamingDataLimit"] = params["internationalRoamingDataLimit"]; const headers = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; let operationVersion = version, operationPromise = operationVersion.create({ uri: instance._uri, method: "post", data, headers, }); operationPromise = operationPromise.then((payload) => new RatePlanInstance(operationVersion, payload)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.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 = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new RatePlanPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new RatePlanPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.RatePlanListInstance = RatePlanListInstance; class RatePlanPage extends Page_1.default { /** * Initialize the RatePlanPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of RatePlanInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new RatePlanInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.RatePlanPage = RatePlanPage; rest/wireless/v1/usageRecord.js000064400000011327151677225100012517 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Wireless * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.UsageRecordPage = exports.UsageRecordInstance = exports.UsageRecordListInstance = void 0; const util_1 = require("util"); const Page_1 = __importDefault(require("../../../base/Page")); const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); function UsageRecordListInstance(version) { const instance = {}; instance._version = version; instance._solution = {}; instance._uri = `/UsageRecords`; instance.page = function page(params, callback) { if (params instanceof Function) { callback = params; params = {}; } else { params = params || {}; } let data = {}; if (params["end"] !== undefined) data["End"] = serialize.iso8601DateTime(params["end"]); if (params["start"] !== undefined) data["Start"] = serialize.iso8601DateTime(params["start"]); if (params["granularity"] !== undefined) data["Granularity"] = params["granularity"]; if (params["pageSize"] !== undefined) data["PageSize"] = params["pageSize"]; if (params.pageNumber !== undefined) data["Page"] = params.pageNumber; if (params.pageToken !== undefined) data["PageToken"] = params.pageToken; const headers = {}; let operationVersion = version, operationPromise = operationVersion.page({ uri: instance._uri, method: "get", params: data, headers, }); operationPromise = operationPromise.then((payload) => new UsageRecordPage(operationVersion, payload, instance._solution)); operationPromise = instance._version.setPromiseCallback(operationPromise, callback); return operationPromise; }; instance.each = instance._version.each; instance.list = instance._version.list; instance.getPage = function getPage(targetUrl, callback) { const operationPromise = instance._version._domain.twilio.request({ method: "get", uri: targetUrl, }); let pagePromise = operationPromise.then((payload) => new UsageRecordPage(instance._version, payload, instance._solution)); pagePromise = instance._version.setPromiseCallback(pagePromise, callback); return pagePromise; }; instance.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; } exports.UsageRecordListInstance = UsageRecordListInstance; class UsageRecordInstance { constructor(_version, payload) { this._version = _version; this.accountSid = payload.account_sid; this.period = payload.period; this.commands = payload.commands; this.data = payload.data; } /** * Provide a user-friendly representation * * @returns Object */ toJSON() { return { accountSid: this.accountSid, period: this.period, commands: this.commands, data: this.data, }; } [util_1.inspect.custom](_depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsageRecordInstance = UsageRecordInstance; class UsageRecordPage extends Page_1.default { /** * Initialize the UsageRecordPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version, response, solution) { super(version, response, solution); } /** * Build an instance of UsageRecordInstance * * @param payload - Payload response from the API */ getInstance(payload) { return new UsageRecordInstance(this._version, payload); } [util_1.inspect.custom](depth, options) { return (0, util_1.inspect)(this.toJSON(), options); } } exports.UsageRecordPage = UsageRecordPage; rest/wireless/v1/sim.d.ts000064400000044373151677225100011307 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; import { DataSessionListInstance } from "./sim/dataSession"; import { UsageRecordListInstance } from "./sim/usageRecord"; export type SimResetStatus = "resetting"; export type SimStatus = "new" | "ready" | "active" | "suspended" | "deactivated" | "canceled" | "scheduled" | "updating"; /** * Options to pass to update a SimInstance */ export interface SimContextUpdateOptions { /** An application-defined string that uniquely identifies the resource. It can be used in place of the `sid` in the URL path to address the resource. */ uniqueName?: string; /** The HTTP method we should use to call `callback_url`. Can be: `POST` or `GET`. The default is `POST`. */ callbackMethod?: string; /** The URL we should call using the `callback_url` when the SIM has finished updating. When the SIM transitions from `new` to `ready` or from any status to `deactivated`, we call this URL when the status changes to an intermediate status (`ready` or `deactivated`) and again when the status changes to its final status (`active` or `canceled`). */ callbackUrl?: string; /** A descriptive string that you create to describe the Sim resource. It does not need to be unique. */ friendlyName?: string; /** The SID or unique name of the [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource should be assigned. */ ratePlan?: string; /** */ status?: SimStatus; /** The HTTP method we should use to call `commands_callback_url`. Can be: `POST` or `GET`. The default is `POST`. */ commandsCallbackMethod?: string; /** The URL we should call using the `commands_callback_method` when the SIM sends a [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body is ignored. */ commandsCallbackUrl?: string; /** The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. */ smsFallbackMethod?: string; /** The URL we should call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `sms_url`. */ smsFallbackUrl?: string; /** The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. Default is `POST`. */ smsMethod?: string; /** The URL we should call using the `sms_method` when the SIM-connected device sends an SMS message that is not a [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). */ smsUrl?: string; /** Deprecated. */ voiceFallbackMethod?: string; /** Deprecated. */ voiceFallbackUrl?: string; /** Deprecated. */ voiceMethod?: string; /** Deprecated. */ voiceUrl?: string; /** */ resetStatus?: SimResetStatus; /** The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a [Subaccount](https://www.twilio.com/docs/iam/api/subaccounts) of the requesting Account. Only valid when the Sim resource\\\'s status is `new`. For more information, see the [Move SIMs between Subaccounts documentation](https://www.twilio.com/docs/iot/wireless/api/sim-resource#move-sims-between-subaccounts). */ accountSid?: string; } /** * Options to pass to each */ export interface SimListInstanceEachOptions { /** Only return Sim resources with this status. */ status?: SimStatus; /** Only return Sim resources with this ICCID. This will return a list with a maximum size of 1. */ iccid?: string; /** The SID or unique name of a [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource). Only return Sim resources assigned to this RatePlan resource. */ ratePlan?: string; /** Deprecated. */ eId?: string; /** Only return Sim resources with this registration code. This will return a list with a maximum size of 1. */ simRegistrationCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: SimInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface SimListInstanceOptions { /** Only return Sim resources with this status. */ status?: SimStatus; /** Only return Sim resources with this ICCID. This will return a list with a maximum size of 1. */ iccid?: string; /** The SID or unique name of a [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource). Only return Sim resources assigned to this RatePlan resource. */ ratePlan?: string; /** Deprecated. */ eId?: string; /** Only return Sim resources with this registration code. This will return a list with a maximum size of 1. */ simRegistrationCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface SimListInstancePageOptions { /** Only return Sim resources with this status. */ status?: SimStatus; /** Only return Sim resources with this ICCID. This will return a list with a maximum size of 1. */ iccid?: string; /** The SID or unique name of a [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource). Only return Sim resources assigned to this RatePlan resource. */ ratePlan?: string; /** Deprecated. */ eId?: string; /** Only return Sim resources with this registration code. This will return a list with a maximum size of 1. */ simRegistrationCode?: string; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface SimContext { dataSessions: DataSessionListInstance; usageRecords: UsageRecordListInstance; /** * Remove a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface SimContextSolution { sid: string; } export declare class SimContextImpl implements SimContext { protected _version: V1; protected _solution: SimContextSolution; protected _uri: string; protected _dataSessions?: DataSessionListInstance; protected _usageRecords?: UsageRecordListInstance; constructor(_version: V1, sid: string); get dataSessions(): DataSessionListInstance; get usageRecords(): UsageRecordListInstance; remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; update(params?: SimContextUpdateOptions | ((error: Error | null, item?: SimInstance) => any), callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): SimContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface SimPayload extends TwilioResponsePayload { sims: SimResource[]; } interface SimResource { sid: string; unique_name: string; account_sid: string; rate_plan_sid: string; friendly_name: string; iccid: string; e_id: string; status: SimStatus; reset_status: SimResetStatus; commands_callback_url: string; commands_callback_method: string; sms_fallback_method: string; sms_fallback_url: string; sms_method: string; sms_url: string; voice_fallback_method: string; voice_fallback_url: string; voice_method: string; voice_url: string; date_created: Date; date_updated: Date; url: string; links: Record<string, string>; ip_address: string; } export declare class SimInstance { protected _version: V1; protected _solution: SimContextSolution; protected _context?: SimContext; constructor(_version: V1, payload: SimResource, sid?: string); /** * The unique string that we created to identify the Sim resource. */ sid: string; /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource\'s `sid` in the URL to address the resource. */ uniqueName: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource belongs. */ accountSid: string; /** * The SID of the [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource is assigned. */ ratePlanSid: string; /** * The string that you assigned to describe the Sim resource. */ friendlyName: string; /** * The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. */ iccid: string; /** * Deprecated. */ eId: string; status: SimStatus; resetStatus: SimResetStatus; /** * The URL we call using the `commands_callback_method` when the SIM originates a machine-to-machine [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. */ commandsCallbackUrl: string; /** * The HTTP method we use to call `commands_callback_url`. Can be: `POST` or `GET`. Default is `POST`. */ commandsCallbackMethod: string; /** * Deprecated. */ smsFallbackMethod: string; /** * Deprecated. */ smsFallbackUrl: string; /** * Deprecated. */ smsMethod: string; /** * Deprecated. */ smsUrl: string; /** * Deprecated. The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. */ voiceFallbackMethod: string; /** * Deprecated. The URL we call using the `voice_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `voice_url`. */ voiceFallbackUrl: string; /** * Deprecated. The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. Default is `POST`. */ voiceMethod: string; /** * Deprecated. The URL we call using the `voice_method` when the SIM-connected device makes a voice call. */ voiceUrl: string; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ dateCreated: Date; /** * The date and time in GMT when the Sim resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; /** * The URLs of related subresources. */ links: Record<string, string>; /** * Deprecated. */ ipAddress: string; private get _proxy(); /** * Remove a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ fetch(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Update a SimInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed SimInstance */ update(params: SimContextUpdateOptions, callback?: (error: Error | null, item?: SimInstance) => any): Promise<SimInstance>; /** * Access the dataSessions. */ dataSessions(): DataSessionListInstance; /** * Access the usageRecords. */ usageRecords(): UsageRecordListInstance; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; uniqueName: string; accountSid: string; ratePlanSid: string; friendlyName: string; iccid: string; eId: string; status: SimStatus; resetStatus: "resetting"; commandsCallbackUrl: string; commandsCallbackMethod: string; smsFallbackMethod: string; smsFallbackUrl: string; smsMethod: string; smsUrl: string; voiceFallbackMethod: string; voiceFallbackUrl: string; voiceMethod: string; voiceUrl: string; dateCreated: Date; dateUpdated: Date; url: string; links: Record<string, string>; ipAddress: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface SimSolution { } export interface SimListInstance { _version: V1; _solution: SimSolution; _uri: string; (sid: string): SimContext; get(sid: string): SimContext; /** * Streams SimInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: SimInstance, done: (err?: Error) => void) => void): void; each(params: SimListInstanceEachOptions, callback?: (item: SimInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of SimInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>; /** * Lists SimInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: SimInstance[]) => any): Promise<SimInstance[]>; list(params: SimListInstanceOptions, callback?: (error: Error | null, items: SimInstance[]) => any): Promise<SimInstance[]>; /** * Retrieve a single page of SimInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { SimListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>; page(params: SimListInstancePageOptions, callback?: (error: Error | null, items: SimPage) => any): Promise<SimPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function SimListInstance(version: V1): SimListInstance; export declare class SimPage extends Page<V1, SimPayload, SimResource, SimInstance> { /** * Initialize the SimPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: SimSolution); /** * Build an instance of SimInstance * * @param payload - Payload response from the API */ getInstance(payload: SimResource): SimInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/wireless/v1/command.d.ts000064400000032226151677225100012127 0ustar00/// <reference types="node" /> import { inspect, InspectOptions } from "util"; import Page, { TwilioResponsePayload } from "../../../base/Page"; import Response from "../../../http/response"; import V1 from "../V1"; export type CommandCommandMode = "text" | "binary"; export type CommandDirection = "from_sim" | "to_sim"; export type CommandStatus = "queued" | "sent" | "delivered" | "received" | "failed"; export type CommandTransport = "sms" | "ip"; /** * Options to pass to create a CommandInstance */ export interface CommandListInstanceCreateOptions { /** The message body of the Command. Can be plain text in text mode or a Base64 encoded byte string in binary mode. */ command: string; /** The `sid` or `unique_name` of the [SIM](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to send the Command to. */ sim?: string; /** The HTTP method we use to call `callback_url`. Can be: `POST` or `GET`, and the default is `POST`. */ callbackMethod?: string; /** The URL we call using the `callback_url` when the Command has finished sending, whether the command was delivered or it failed. */ callbackUrl?: string; /** */ commandMode?: CommandCommandMode; /** Whether to include the SID of the command in the message body. Can be: `none`, `start`, or `end`, and the default behavior is `none`. When sending a Command to a SIM in text mode, we can automatically include the SID of the Command in the message body, which could be used to ensure that the device does not process the same Command more than once. A value of `start` will prepend the message with the Command SID, and `end` will append it to the end, separating the Command SID from the message body with a space. The length of the Command SID is included in the 160 character limit so the SMS body must be 128 characters or less before the Command SID is included. */ includeSid?: string; /** Whether to request delivery receipt from the recipient. For Commands that request delivery receipt, the Command state transitions to \\\'delivered\\\' once the server has received a delivery receipt from the device. The default value is `true`. */ deliveryReceiptRequested?: boolean; } /** * Options to pass to each */ export interface CommandListInstanceEachOptions { /** The `sid` or `unique_name` of the [Sim resources](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to read. */ sim?: string; /** The status of the resources to read. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. */ status?: CommandStatus; /** Only return Commands with this direction value. */ direction?: CommandDirection; /** Only return Commands with this transport value. Can be: `sms` or `ip`. */ transport?: CommandTransport; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Function to process each record. If this and a positional callback are passed, this one will be used */ callback?: (item: CommandInstance, done: (err?: Error) => void) => void; /** Function to be called upon completion of streaming */ done?: Function; /** Upper limit for the number of records to return. each() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to list */ export interface CommandListInstanceOptions { /** The `sid` or `unique_name` of the [Sim resources](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to read. */ sim?: string; /** The status of the resources to read. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. */ status?: CommandStatus; /** Only return Commands with this direction value. */ direction?: CommandDirection; /** Only return Commands with this transport value. Can be: `sms` or `ip`. */ transport?: CommandTransport; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit */ limit?: number; } /** * Options to pass to page */ export interface CommandListInstancePageOptions { /** The `sid` or `unique_name` of the [Sim resources](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to read. */ sim?: string; /** The status of the resources to read. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. */ status?: CommandStatus; /** Only return Commands with this direction value. */ direction?: CommandDirection; /** Only return Commands with this transport value. Can be: `sms` or `ip`. */ transport?: CommandTransport; /** How many resources to return in each list page. The default is 50, and the maximum is 1000. */ pageSize?: number; /** Page Number, this value is simply for client state */ pageNumber?: number; /** PageToken provided by the API */ pageToken?: string; } export interface CommandContext { /** * Remove a CommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CommandInstance */ fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export interface CommandContextSolution { sid: string; } export declare class CommandContextImpl implements CommandContext { protected _version: V1; protected _solution: CommandContextSolution; protected _uri: string; constructor(_version: V1, sid: string); remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): CommandContextSolution; [inspect.custom](_depth: any, options: InspectOptions): string; } interface CommandPayload extends TwilioResponsePayload { commands: CommandResource[]; } interface CommandResource { sid: string; account_sid: string; sim_sid: string; command: string; command_mode: CommandCommandMode; transport: CommandTransport; delivery_receipt_requested: boolean; status: CommandStatus; direction: CommandDirection; date_created: Date; date_updated: Date; url: string; } export declare class CommandInstance { protected _version: V1; protected _solution: CommandContextSolution; protected _context?: CommandContext; constructor(_version: V1, payload: CommandResource, sid?: string); /** * The unique string that we created to identify the Command resource. */ sid: string; /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Command resource. */ accountSid: string; /** * The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that the Command was sent to or from. */ simSid: string; /** * The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64. */ command: string; commandMode: CommandCommandMode; transport: CommandTransport; /** * Whether to request a delivery receipt. */ deliveryReceiptRequested: boolean; status: CommandStatus; direction: CommandDirection; /** * The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ dateCreated: Date; /** * The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. */ dateUpdated: Date; /** * The absolute URL of the resource. */ url: string; private get _proxy(); /** * Remove a CommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed boolean */ remove(callback?: (error: Error | null, item?: boolean) => any): Promise<boolean>; /** * Fetch a CommandInstance * * @param callback - Callback to handle processed record * * @returns Resolves to processed CommandInstance */ fetch(callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>; /** * Provide a user-friendly representation * * @returns Object */ toJSON(): { sid: string; accountSid: string; simSid: string; command: string; commandMode: CommandCommandMode; transport: CommandTransport; deliveryReceiptRequested: boolean; status: CommandStatus; direction: CommandDirection; dateCreated: Date; dateUpdated: Date; url: string; }; [inspect.custom](_depth: any, options: InspectOptions): string; } export interface CommandSolution { } export interface CommandListInstance { _version: V1; _solution: CommandSolution; _uri: string; (sid: string): CommandContext; get(sid: string): CommandContext; /** * Create a CommandInstance * * @param params - Parameter for request * @param callback - Callback to handle processed record * * @returns Resolves to processed CommandInstance */ create(params: CommandListInstanceCreateOptions, callback?: (error: Error | null, item?: CommandInstance) => any): Promise<CommandInstance>; /** * Streams CommandInstance records from the API. * * This operation lazily loads records as efficiently as possible until the limit * is reached. * * The results are passed into the callback function, so this operation is memory * efficient. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { CommandListInstanceEachOptions } [params] - Options for request * @param { function } [callback] - Function to process each record */ each(callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void; each(params: CommandListInstanceEachOptions, callback?: (item: CommandInstance, done: (err?: Error) => void) => void): void; /** * Retrieve a single target page of CommandInstance records from the API. * * The request is executed immediately. * * @param { string } [targetUrl] - API-generated URL for the requested results page * @param { function } [callback] - Callback to handle list of records */ getPage(targetUrl: string, callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>; /** * Lists CommandInstance records from the API as a list. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { CommandListInstanceOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ list(callback?: (error: Error | null, items: CommandInstance[]) => any): Promise<CommandInstance[]>; list(params: CommandListInstanceOptions, callback?: (error: Error | null, items: CommandInstance[]) => any): Promise<CommandInstance[]>; /** * Retrieve a single page of CommandInstance records from the API. * * The request is executed immediately. * * If a function is passed as the first argument, it will be used as the callback * function. * * @param { CommandListInstancePageOptions } [params] - Options for request * @param { function } [callback] - Callback to handle list of records */ page(callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>; page(params: CommandListInstancePageOptions, callback?: (error: Error | null, items: CommandPage) => any): Promise<CommandPage>; /** * Provide a user-friendly representation */ toJSON(): any; [inspect.custom](_depth: any, options: InspectOptions): any; } export declare function CommandListInstance(version: V1): CommandListInstance; export declare class CommandPage extends Page<V1, CommandPayload, CommandResource, CommandInstance> { /** * Initialize the CommandPage * * @param version - Version of the resource * @param response - Response from the API * @param solution - Path solution */ constructor(version: V1, response: Response<string>, solution: CommandSolution); /** * Build an instance of CommandInstance * * @param payload - Payload response from the API */ getInstance(payload: CommandResource): CommandInstance; [inspect.custom](depth: any, options: InspectOptions): string; } export {}; rest/wireless/V1.js000064400000003623151677225100010214 0ustar00"use strict"; /* * This code was generated by * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * * Twilio - Wireless * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Version_1 = __importDefault(require("../../base/Version")); const command_1 = require("./v1/command"); const ratePlan_1 = require("./v1/ratePlan"); const sim_1 = require("./v1/sim"); const usageRecord_1 = require("./v1/usageRecord"); class V1 extends Version_1.default { /** * Initialize the V1 version of Wireless * * @param domain - The Twilio (Twilio.Wireless) domain */ constructor(domain) { super(domain, "v1"); } /** Getter for commands resource */ get commands() { this._commands = this._commands || (0, command_1.CommandListInstance)(this); return this._commands; } /** Getter for ratePlans resource */ get ratePlans() { this._ratePlans = this._ratePlans || (0, ratePlan_1.RatePlanListInstance)(this); return this._ratePlans; } /** Getter for sims resource */ get sims() { this._sims = this._sims || (0, sim_1.SimListInstance)(this); return this._sims; } /** Getter for usageRecords resource */ get usageRecords() { this._usageRecords = this._usageRecords || (0, usageRecord_1.UsageRecordListInstance)(this); return this._usageRecords; } } exports.default = V1; rest/IpMessagingBase.d.ts000064400000000571151677225100011325 0ustar00import Domain from "../base/Domain"; import V1 from "./ipMessaging/V1"; import V2 from "./ipMessaging/V2"; declare class IpMessagingBase extends Domain { _v1?: V1; _v2?: V2; /** * Initialize ipMessaging domain * * @param twilio - The twilio client */ constructor(twilio: any); get v1(): V1; get v2(): V2; } export = IpMessagingBase; index.js000064400000000323151677225100006215 0ustar00'use strict'; var stringify = require('./stringify'); var parse = require('./parse'); var formats = require('./formats'); module.exports = { formats: formats, parse: parse, stringify: stringify }; interfaces.d.ts000064400000005420151677225100007470 0ustar00export type HttpMethod = "get" | "post" | "put" | "patch" | "delete"; export type Url = string; export type PhoneNumber = string; export type PhoneNumberCapabilities = { mms: boolean; sms: boolean; voice: boolean; fax: boolean; }; export type Sid = string; export interface ListEachOptions<TInstance> { /** * Upper limit for the number of records to return. * each() guarantees never to return more than limit. * Default is no limit */ limit?: number; /** * Number of records to fetch per request, * when not set will use the default value of 50 records. * If no pageSize is defined but a limit is defined, * each() will attempt to read the limit with the most efficient * page size, i.e. min(limit, 1000) */ pageSize?: number; /** * Function to process each record. If this and a positional * callback are passed, this one will be used */ callback?: (item: TInstance, done: (err?: Error) => void) => void; /** * Function to be called upon completion of streaming */ done?: (err?: Error) => void; } export interface ListOptions<TInstance> { /** * Upper limit for the number of records to return. * each() guarantees never to return more than limit. * Default is no limit */ limit?: number; /** * Number of records to fetch per request, * when not set will use the default value of 50 records. * If no pageSize is defined but a limit is defined, * each() will attempt to read the limit with the most efficient * page size, i.e. min(limit, 1000) */ pageSize?: number; /** * Callback to handle list of records */ callback?: (items: TInstance[]) => void; } export interface PageOptions<TPage> { /** * PageToken provided by the API */ pageToken?: string; /** * Page Number, this value is simply for client state */ pageNumber?: number; /** * Number of records to return, defaults to 50 */ pageSize?: number; /** * Callback to handle list of records */ callback?: (page: TPage) => void; } /** * A generic type that returns all property names of a class whose type is not "function" */ export type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]; /** * A generic type that returns only properties of a class that are not functions */ export type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>; /** * A type alias for better readibility */ export type Json<T> = NonFunctionProperties<T>; export declare class SerializableClass { /** * Converts the current instance in a regular JSON. * It will be automatically called by JSON.stringify() */ toJSON(): Json<this>; } webhooks/webhooks.js000064400000027041151677225100010556 0ustar00"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.webhook = exports.validateExpressRequest = exports.validateIncomingRequest = exports.validateRequestWithBody = exports.validateBody = exports.validateRequest = exports.getExpectedBodyHash = exports.getExpectedTwilioSignature = void 0; const scmp = require("scmp"); const crypto_1 = __importDefault(require("crypto")); const url_1 = __importDefault(require("url")); /** * Utility function to construct the URL string, since Node.js url library won't include standard port numbers * * @param parsedUrl - The parsed url object that Twilio requested on your server * @returns URL with standard port number included */ function buildUrlWithStandardPort(parsedUrl) { let url = ""; const port = parsedUrl.protocol === "https:" ? ":443" : ":80"; url += parsedUrl.protocol ? parsedUrl.protocol + "//" : ""; url += parsedUrl.username; url += parsedUrl.password ? ":" + parsedUrl.password : ""; url += parsedUrl.username || parsedUrl.password ? "@" : ""; url += parsedUrl.host ? parsedUrl.host + port : ""; url += parsedUrl.pathname + parsedUrl.search + parsedUrl.hash; return url; } /** Utility function to add a port number to a URL @param parsedUrl - The parsed url object that Twilio requested on your server @returns URL with port */ function addPort(parsedUrl) { if (!parsedUrl.port) { return buildUrlWithStandardPort(parsedUrl); } return parsedUrl.toString(); } /** Utility function to remove a port number from a URL @param parsedUrl - The parsed url object that Twilio requested on your server @returns URL without port */ function removePort(parsedUrl) { parsedUrl.port = ""; return parsedUrl.toString(); } /** Utility function to convert request parameter to a string format @param paramName - The request parameter name @param paramValue - The request parameter value @returns Formatted parameter string */ function toFormUrlEncodedParam(paramName, paramValue) { if (paramValue instanceof Array) { return Array.from(new Set(paramValue)) .sort() .map((val) => toFormUrlEncodedParam(paramName, val)) .reduce((acc, val) => acc + val, ""); } return paramName + paramValue; } /** Utility function to get the expected signature for a given request @param authToken - The auth token, as seen in the Twilio portal @param url - The full URL (with query string) you configured to handle this request @param params - the parameters sent with this request @returns signature */ function getExpectedTwilioSignature(authToken, url, params) { if (url.indexOf("bodySHA256") !== -1 && params === null) { params = {}; } var data = Object.keys(params) .sort() .reduce((acc, key) => acc + toFormUrlEncodedParam(key, params[key]), url); return crypto_1.default .createHmac("sha1", authToken) .update(Buffer.from(data, "utf-8")) .digest("base64"); } exports.getExpectedTwilioSignature = getExpectedTwilioSignature; /** Utility function to get the expected body hash for a given request's body @param body - The plain-text body of the request */ function getExpectedBodyHash(body) { return crypto_1.default .createHash("sha256") .update(Buffer.from(body, "utf-8")) .digest("hex"); } exports.getExpectedBodyHash = getExpectedBodyHash; /** Utility function to validate an incoming request is indeed from Twilio @param authToken - The auth token, as seen in the Twilio portal @param twilioHeader - The value of the X-Twilio-Signature header from the request @param url - The full URL (with query string) you configured to handle this request @param params - the parameters sent with this request @returns valid */ function validateRequest(authToken, twilioHeader, url, params) { twilioHeader = twilioHeader || ""; const urlObject = new URL(url); const urlWithPort = addPort(urlObject); const urlWithoutPort = removePort(urlObject); /* * Check signature of the url with and without the port number * since signature generation on the back end is inconsistent */ const signatureWithPort = getExpectedTwilioSignature(authToken, urlWithPort, params); const signatureWithoutPort = getExpectedTwilioSignature(authToken, urlWithoutPort, params); const validSignatureWithPort = scmp(Buffer.from(twilioHeader), Buffer.from(signatureWithPort)); const validSignatureWithoutPort = scmp(Buffer.from(twilioHeader), Buffer.from(signatureWithoutPort)); return validSignatureWithoutPort || validSignatureWithPort; } exports.validateRequest = validateRequest; function validateBody(body, bodyHash) { var expectedHash = getExpectedBodyHash(body); return scmp(Buffer.from(bodyHash), Buffer.from(expectedHash)); } exports.validateBody = validateBody; /** Utility function to validate an incoming request is indeed from Twilio. This also validates the request body against the bodySHA256 post parameter. @param authToken - The auth token, as seen in the Twilio portal @param twilioHeader - The value of the X-Twilio-Signature header from the request @param url - The full URL (with query string) you configured to handle this request @param body - The body of the request @returns valid */ function validateRequestWithBody(authToken, twilioHeader, url, body) { const urlObject = new URL(url); return (validateRequest(authToken, twilioHeader, url, {}) && validateBody(body, urlObject.searchParams.get("bodySHA256") || "")); } exports.validateRequestWithBody = validateRequestWithBody; /** Utility function to validate an incoming request is indeed from Twilio. adapted from https://github.com/crabasa/twiliosig @param request - A request object (based on Express implementation http://expressjs.com/api.html#req.params) @param authToken - The auth token, as seen in the Twilio portal @param opts - options for request validation: -> url: The full URL (with query string) you used to configure the webhook with Twilio - overrides host/protocol options -> host: manually specify the host name used by Twilio in a number's webhook config -> protocol: manually specify the protocol used by Twilio in a number's webhook config */ function validateIncomingRequest(request, authToken, opts) { var options = opts || {}; var webhookUrl; if (options.url) { // Let the user specify the full URL webhookUrl = options.url; } else { // Use configured host/protocol, or infer based on request var protocol = options.protocol || request.protocol; var host = options.host || request.headers.host; webhookUrl = url_1.default.format({ protocol: protocol, host: host, pathname: request.originalUrl, }); if (request.originalUrl.search(/\?/) >= 0) { webhookUrl = webhookUrl.replace(/%3F/g, "?"); } } if (webhookUrl.indexOf("bodySHA256") > 0) { return validateRequestWithBody(authToken, request.header("X-Twilio-Signature") || "", webhookUrl, request.rawBody || "{}"); } else { return validateRequest(authToken, request.header("X-Twilio-Signature") || "", webhookUrl, request.body || {}); } } exports.validateIncomingRequest = validateIncomingRequest; function validateExpressRequest(request, authToken, opts) { return validateIncomingRequest(request, authToken, opts); } exports.validateExpressRequest = validateExpressRequest; /** Express middleware to accompany a Twilio webhook. Provides Twilio request validation, and makes the response a little more friendly for our TwiML generator. Request validation requires the express.urlencoded middleware to have been applied (e.g. app.use(express.urlencoded()); in your app config). Options: - validate: {Boolean} whether or not the middleware should validate the request came from Twilio. Default true. If the request does not originate from Twilio, we will return a text body and a 403. If there is no configured auth token and validate=true, this is an error condition, so we will return a 500. - host: manually specify the host name used by Twilio in a number's webhook config - protocol: manually specify the protocol used by Twilio in a number's webhook config - url: The full URL (with query string) you used to configure the webhook with Twilio - overrides host/protocol options Returns a middleware function. Examples: var webhookMiddleware = twilio.webhook(); var webhookMiddleware = twilio.webhook('asdha9dhjasd'); //init with auth token var webhookMiddleware = twilio.webhook({ validate:false // don't attempt request validation }); var webhookMiddleware = twilio.webhook({ host: 'hook.twilio.com', protocol: 'https' }); */ function webhook(opts, authToken) { let token; let options = undefined; // Narrowing the args if (opts) { if (typeof opts === "string") { token = opts; } if (typeof opts === "object") { options = opts; } } if (authToken) { if (typeof authToken === "string") { token = authToken; } if (typeof authToken === "object") { options = authToken; } } if (!options) options = {}; if (options.validate == undefined) options.validate = true; // Process arguments var tokenString; for (var i = 0, l = arguments.length; i < l; i++) { var arg = arguments[i]; if (typeof arg === "string") { tokenString = arg; } else { options = Object.assign(options || {}, arg); } } // set auth token from input or environment variable if (options) { options.authToken = tokenString ? tokenString : process.env.TWILIO_AUTH_TOKEN; } // Create middleware function return function hook(request, response, next) { // Do validation if requested if (options?.validate) { // Check if the 'X-Twilio-Signature' header exists or not if (!request.header("X-Twilio-Signature")) { return response .type("text/plain") .status(400) .send("No signature header error - X-Twilio-Signature header does not exist, maybe this request is not coming from Twilio."); } // Check for a valid auth token if (!options?.authToken) { console.error("[Twilio]: Error - Twilio auth token is required for webhook request validation."); response .type("text/plain") .status(500) .send("Webhook Error - we attempted to validate this request without first configuring our auth token."); } else { // Check that the request originated from Twilio var valid = validateExpressRequest(request, options?.authToken, { url: options?.url, host: options?.host, protocol: options?.protocol, }); if (valid) { next(); } else { return response .type("text/plain") .status(403) .send("Twilio Request Validation Failed."); } } } else { next(); } }; } exports.webhook = webhook; webhooks/webhooks.d.ts000064400000013407151677225100011013 0ustar00/// <reference types="node" /> /// <reference types="node" /> import { IncomingHttpHeaders } from "http2"; export interface Request { protocol: string; header(name: string): string | undefined; headers: IncomingHttpHeaders; originalUrl: string; rawBody?: any; body: any; } export interface RequestValidatorOptions { /** * The full URL (with query string) you used to configure the webhook with Twilio - overrides host/protocol options */ url?: string; /** * Manually specify the host name used by Twilio in a number's webhook config */ host?: string; /** * Manually specify the protocol used by Twilio in a number's webhook config */ protocol?: string; } export interface WebhookOptions { /** * Whether or not the middleware should validate the request * came from Twilio. Default true. If the request does not originate from * Twilio, we will return a text body and a 403. If there is no configured * auth token and validate=true, this is an error condition, so we will return * a 500. */ validate?: boolean; /** * Add helpers to the response object to improve support for XML (TwiML) rendering. Default true. */ includeHelpers?: boolean; /** * The full URL (with query string) you used to configure the webhook with Twilio - overrides host/protocol options */ url?: string; /** * Manually specify the host name used by Twilio in a number's webhook config */ host?: string; /** * Manually specify the protocol used by Twilio in a number's webhook config */ protocol?: string; /** * Authentication token */ authToken?: string; } /** Utility function to get the expected signature for a given request @param authToken - The auth token, as seen in the Twilio portal @param url - The full URL (with query string) you configured to handle this request @param params - the parameters sent with this request @returns signature */ export declare function getExpectedTwilioSignature(authToken: string, url: string, params: Record<string, any>): string; /** Utility function to get the expected body hash for a given request's body @param body - The plain-text body of the request */ export declare function getExpectedBodyHash(body: string): string; /** Utility function to validate an incoming request is indeed from Twilio @param authToken - The auth token, as seen in the Twilio portal @param twilioHeader - The value of the X-Twilio-Signature header from the request @param url - The full URL (with query string) you configured to handle this request @param params - the parameters sent with this request @returns valid */ export declare function validateRequest(authToken: string, twilioHeader: string, url: string, params: Record<string, any>): boolean; export declare function validateBody(body: string, bodyHash: any[] | string | Buffer): boolean; /** Utility function to validate an incoming request is indeed from Twilio. This also validates the request body against the bodySHA256 post parameter. @param authToken - The auth token, as seen in the Twilio portal @param twilioHeader - The value of the X-Twilio-Signature header from the request @param url - The full URL (with query string) you configured to handle this request @param body - The body of the request @returns valid */ export declare function validateRequestWithBody(authToken: string, twilioHeader: string, url: string, body: string): boolean; /** Utility function to validate an incoming request is indeed from Twilio. adapted from https://github.com/crabasa/twiliosig @param request - A request object (based on Express implementation http://expressjs.com/api.html#req.params) @param authToken - The auth token, as seen in the Twilio portal @param opts - options for request validation: -> url: The full URL (with query string) you used to configure the webhook with Twilio - overrides host/protocol options -> host: manually specify the host name used by Twilio in a number's webhook config -> protocol: manually specify the protocol used by Twilio in a number's webhook config */ export declare function validateIncomingRequest(request: Request, authToken: string, opts?: RequestValidatorOptions): boolean; export declare function validateExpressRequest(request: Request, authToken: string, opts?: RequestValidatorOptions): boolean; /** Express middleware to accompany a Twilio webhook. Provides Twilio request validation, and makes the response a little more friendly for our TwiML generator. Request validation requires the express.urlencoded middleware to have been applied (e.g. app.use(express.urlencoded()); in your app config). Options: - validate: {Boolean} whether or not the middleware should validate the request came from Twilio. Default true. If the request does not originate from Twilio, we will return a text body and a 403. If there is no configured auth token and validate=true, this is an error condition, so we will return a 500. - host: manually specify the host name used by Twilio in a number's webhook config - protocol: manually specify the protocol used by Twilio in a number's webhook config - url: The full URL (with query string) you used to configure the webhook with Twilio - overrides host/protocol options Returns a middleware function. Examples: var webhookMiddleware = twilio.webhook(); var webhookMiddleware = twilio.webhook('asdha9dhjasd'); //init with auth token var webhookMiddleware = twilio.webhook({ validate:false // don't attempt request validation }); var webhookMiddleware = twilio.webhook({ host: 'hook.twilio.com', protocol: 'https' }); */ export declare function webhook(opts?: string | WebhookOptions, authToken?: string | WebhookOptions): (req: any, res: any, next: any) => void; index.d.ts000064400000001756151677225100006464 0ustar00/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. * REQUIREMENT: This definition is dependent on the @types/node definition. * Install with `npm install @types/node --save-dev` *--------------------------------------------------------------------------------------------*/ declare module 'iconv-lite' { export function decode(buffer: Buffer, encoding: string, options?: Options): string; export function encode(content: string, encoding: string, options?: Options): Buffer; export function encodingExists(encoding: string): boolean; export function decodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; export function encodeStream(encoding: string, options?: Options): NodeJS.ReadWriteStream; } export interface Options { stripBOM?: boolean; addBOM?: boolean; defaultEncoding?: string; } http/response.js000064400000000542151677225100007726 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Response { constructor(statusCode, body, headers) { this.statusCode = statusCode; this.body = body; this.headers = headers; } toString() { return "HTTP " + this.statusCode + " " + this.body; } } exports.default = Response; http/response.d.ts000064400000000305151677225100010157 0ustar00export default class Response<TPayload> { statusCode: number; body: TPayload; headers: any; constructor(statusCode: number, body: TPayload, headers: any); toString(): string; } http/request.js000064400000005443151677225100007565 0ustar00"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Request { constructor(opts) { opts = opts || {}; this.method = opts.method || this.ANY; this.url = opts.url || this.ANY; this.auth = opts.auth || this.ANY; this.params = opts.params || this.ANY; this.data = opts.data || this.ANY; this.headers = opts.headers || this.ANY; } get ANY() { return "*"; } attributeEqual(lhs, rhs) { if (lhs === this.ANY || rhs === this.ANY) { return true; } lhs = lhs || undefined; rhs = rhs || undefined; if (typeof lhs !== typeof rhs) { return false; } if (typeof lhs !== "object") { return lhs === rhs; } return (Object.entries(lhs) .sort((a, b) => a[0].localeCompare(b[0])) .toString() === Object.entries(rhs) .sort((a, b) => a[0].localeCompare(b[0])) .toString()); } isEqual(other) { return (this.attributeEqual(this.method, other.method) && this.attributeEqual(this.url, other.url) && this.attributeEqual(this.auth, other.auth) && this.attributeEqual(this.params, other.params) && this.attributeEqual(this.data, other.data) && this.attributeEqual(this.headers, other.headers)); } toString() { var auth = ""; if (this.auth && this.auth !== this.ANY) { auth = this.auth + " "; } var params = ""; if (this.params && this.params !== this.ANY) { params = "?" + Object.keys(this.params) .map((key) => function () { return key + "=" + this.params[key]; }.bind(this)()) .join("&"); } var data = ""; if (this.data && this.data !== this.ANY) { if (this.method === "get") { data = "\n -G"; } data = data + "\n" + Object.entries(this.data) .map((d) => { return " -d " + d[0] + "=" + d[1]; }) .join("\n"); } var headers = ""; if (this.headers && this.headers !== this.ANY) { headers = "\n" + Object.entries(this.headers) .map((header) => { return " -H " + header[0] + "=" + header[1]; }) .join("\n"); } return auth + this.method + " " + this.url + params + data + headers; } } exports.default = Request; http/request.d.ts000064400000001215151677225100010012 0ustar00import { HttpMethod } from "../interfaces"; export interface RequestOptions<TData> { method?: HttpMethod | "*"; url?: string; auth?: string; params?: object | "*"; data?: TData | "*"; headers?: Headers; } export interface Headers { [header: string]: string; } export default class Request<TData> { method: HttpMethod | "*"; url: string; auth: string; params: object | "*"; data: TData | "*"; headers: Headers | "*"; constructor(opts?: RequestOptions<TData>); get ANY(): "*"; attributeEqual(lhs: any, rhs: any): boolean; isEqual(other: Request<any>): boolean; toString(): string; } twiml/FaxResponse.js000064400000003115151677225100010501 0ustar00"use strict"; /** * This code was generated by * \ / _ _ _| _ _ * | (_)\/(_)(_|\/| |(/_ v1.0.0 * / / */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const TwiML_1 = __importDefault(require("./TwiML")); class FaxResponse extends TwiML_1.default { /** * <Response> TwiML for Faxes */ constructor() { super(); this._propertyName = "response"; } /** * Comments in <Response> * * @param comment - XML Comment */ comment(comment) { return this.response.comment(comment); } /** * Comments after <Response> * * @param comment - XML Comment */ commentAfter(comment) { return this.response.commentAfter(comment); } /** * Comments before <Response> * * @param comment - XML Comment */ commentBefore(comment) { return this.response.commentBefore(comment); } /** * <Receive> TwiML Verb * * @param attributes - TwiML attributes */ receive(attributes) { return new FaxResponse.Receive(this.response.ele("Receive", attributes)); } } (function (FaxResponse) { class Receive extends TwiML_1.default { /** * <Receive> TwiML Verb */ constructor(receive) { super(); this.receive = receive; this._propertyName = "receive"; } } FaxResponse.Receive = Receive; })(FaxResponse || (FaxResponse = {})); module.exports = FaxResponse; twiml/MessagingResponse.d.ts000064400000006351151677225100012141 0ustar00/** * This code was generated by * \ / _ _ _| _ _ * | (_)\/(_)(_|\/| |(/_ v1.0.0 * / / */ import { XMLElement } from "xmlbuilder"; import TwiML from "./TwiML"; declare class MessagingResponse extends TwiML { /** * <Response> TwiML for Messages */ constructor(); /** * Comments in <Response> * * @param comment - XML Comment */ comment(comment: string): XMLElement; /** * Comments after <Response> * * @param comment - XML Comment */ commentAfter(comment: string): XMLElement; /** * Comments before <Response> * * @param comment - XML Comment */ commentBefore(comment: string): XMLElement; /** * <Message> TwiML Verb * * @param attributes - TwiML attributes * @param body - Message Body */ message(body: string): MessagingResponse.Message; message(attributes: MessagingResponse.MessageAttributes, body: string): MessagingResponse.Message; /** * <Redirect> TwiML Verb * * @param attributes - TwiML attributes * @param url - Redirect URL */ redirect(url: string): MessagingResponse.Redirect; redirect(attributes: MessagingResponse.RedirectAttributes, url: string): MessagingResponse.Redirect; } declare namespace MessagingResponse { /** * Attributes to pass to message */ interface MessageAttributes { /** action - A URL specifying where Twilio should send status callbacks for the created outbound message. */ action?: string; /** from - Phone Number to send Message from */ from?: string; /** method - Action URL Method */ method?: string; /** statusCallback - Status callback URL. Deprecated in favor of action. */ statusCallback?: string; /** to - Phone Number to send Message to */ to?: string; } /** * Attributes to pass to redirect */ interface RedirectAttributes { /** method - Redirect URL me