From ed8ad97dbdb6c49b91a86f45025faf8eaf3772ab Mon Sep 17 00:00:00 2001 From: sbansla <104902068+sbansla@users.noreply.github.com> Date: Fri, 13 Oct 2023 17:24:02 +0530 Subject: [PATCH 01/10] chore: upgraded semver versions (#966) --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 19b350f4a..d13668d52 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,9 @@ "xmlbuilder": "^13.0.2" }, "devDependencies": { - "@babel/preset-env": "^7.20.2", + "@babel/preset-env": "^7.23.0", "@babel/preset-typescript": "^7.18.6", - "@types/jest": "^29.2.5", + "@types/jest": "^29.5.5", "@types/jsonwebtoken": "^9.0.0", "@types/node": "^18.11.18", "@types/qs": "^6.9.7", @@ -40,13 +40,13 @@ "babel-plugin-replace-ts-export-assignment": "^0.0.2", "eslint": "^8.31.0", "express": "^4.17.1", - "jest": "^29.3.1", + "jest": "^29.5.5", "jshint": "^2.11.0", "mock-fs": "^5.2.0", "nock": "^13.2.9", "node-mocks-http": "^1.8.1", "prettier": "^2.7.1", - "ts-jest": "^29.0.5", + "ts-jest": "^29.1.1", "typescript": "^4.7.2", "typedoc": "^0.23.21" }, From b86e2e0296f972eb0a6213996b4ee9a25b4bb58c Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 19 Oct 2023 11:33:19 +0000 Subject: [PATCH 02/10] [Librarian] Regenerated @ 922c1fef02b8c8fbbbe2315aa9b9d1dba49f3fc0 --- CHANGES.md | 32 ++++++++++ src/rest/accounts/V1.ts | 9 +++ .../{api/v2010 => accounts/v1}/safelist.ts | 12 ++-- src/rest/api/V2010.ts | 9 --- .../v2010/account/conference/participant.ts | 4 ++ src/rest/flexApi/v1/configuration.ts | 7 +++ src/rest/intelligence/v2/transcript.ts | 58 +------------------ src/rest/intelligence/v2/transcript/media.ts | 2 +- .../v2/transcript/operatorResult.ts | 8 +-- .../intelligence/v2/transcript/sentence.ts | 6 +- src/rest/lookups/v2/phoneNumber.ts | 10 ++-- .../messaging/v1/service/usAppToPerson.ts | 4 +- src/rest/taskrouter/v1/workspace/task.ts | 27 ++++++++- 13 files changed, 98 insertions(+), 90 deletions(-) rename src/rest/{api/v2010 => accounts/v1}/safelist.ts (96%) diff --git a/CHANGES.md b/CHANGES.md index e9169a632..9392e5acc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,38 @@ twilio-node changelog ===================== +[2023-10-19] Version 4.19.0 +--------------------------- +**Library - Chore** +- [PR #966](https://github.com/twilio/twilio-node/pull/966): upgraded semver versions. Thanks to [@sbansla](https://github.com/sbansla)! +- [PR #964](https://github.com/twilio/twilio-node/pull/964): added feature request issue template. Thanks to [@sbansla](https://github.com/sbansla)! + +**Accounts** +- Updated Safelist metadata to correct the docs. +- Add Global SafeList API changes + +**Api** +- Added optional parameter `CallToken` for create participant api + +**Flex** +- Adding `offline_config` to Flex Configuration + +**Intelligence** +- Deleted `redacted` parameter from fetching transcript in v2 **(breaking change)** + +**Lookups** +- Add new `phone_number_quality_score` package to the lookup response +- Remove `disposable_phone_number_risk` package **(breaking change)** + +**Messaging** +- Update US App To Person documentation with current `message_samples` requirements + +**Taskrouter** +- Remove beta_feature check on task_queue_bulk_real_time_statistics endpoint +- Add `virtual_start_time` property to tasks +- Updating `task_queue_data` format from `map` to `array` in the response of bulk get endpoint of TaskQueue Real Time Statistics API **(breaking change)** + + [2023-10-05] Version 4.18.1 --------------------------- **Library - Fix** diff --git a/src/rest/accounts/V1.ts b/src/rest/accounts/V1.ts index 519cfeffe..aede0cf6c 100644 --- a/src/rest/accounts/V1.ts +++ b/src/rest/accounts/V1.ts @@ -16,6 +16,7 @@ import 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 { @@ -32,6 +33,8 @@ export default class V1 extends Version { 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; @@ -48,6 +51,12 @@ export default class V1 extends Version { return this._credentials; } + /** Getter for safelist resource */ + get safelist(): SafelistListInstance { + this._safelist = this._safelist || SafelistListInstance(this); + return this._safelist; + } + /** Getter for secondaryAuthToken resource */ get secondaryAuthToken(): SecondaryAuthTokenListInstance { this._secondaryAuthToken = diff --git a/src/rest/api/v2010/safelist.ts b/src/rest/accounts/v1/safelist.ts similarity index 96% rename from src/rest/api/v2010/safelist.ts rename to src/rest/accounts/v1/safelist.ts index f00fe1397..f2a784d6d 100644 --- a/src/rest/api/v2010/safelist.ts +++ b/src/rest/accounts/v1/safelist.ts @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Api + * Twilio - Accounts * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -13,7 +13,7 @@ */ import { inspect, InspectOptions } from "util"; -import V2010 from "../V2010"; +import V1 from "../V1"; const deserialize = require("../../../base/deserialize"); const serialize = require("../../../base/serialize"); import { isValidPathParam } from "../../../base/utility"; @@ -45,7 +45,7 @@ export interface SafelistListInstanceFetchOptions { export interface SafelistSolution {} export interface SafelistListInstance { - _version: V2010; + _version: V1; _solution: SafelistSolution; _uri: string; @@ -115,12 +115,12 @@ export interface SafelistListInstance { [inspect.custom](_depth: any, options: InspectOptions): any; } -export function SafelistListInstance(version: V2010): SafelistListInstance { +export function SafelistListInstance(version: V1): SafelistListInstance { const instance = {} as SafelistListInstance; instance._version = version; instance._solution = {}; - instance._uri = `/SafeList/Numbers.json`; + instance._uri = `/SafeList/Numbers`; instance.create = function create( params: SafelistListInstanceCreateOptions, @@ -256,7 +256,7 @@ interface SafelistResource { } export class SafelistInstance { - constructor(protected _version: V2010, payload: SafelistResource) { + constructor(protected _version: V1, payload: SafelistResource) { this.sid = payload.sid; this.phoneNumber = payload.phone_number; } diff --git a/src/rest/api/V2010.ts b/src/rest/api/V2010.ts index 3c0571655..c2b512765 100644 --- a/src/rest/api/V2010.ts +++ b/src/rest/api/V2010.ts @@ -15,7 +15,6 @@ import ApiBase from "../ApiBase"; import Version from "../../base/Version"; import { AccountListInstance } from "./v2010/account"; -import { SafelistListInstance } from "./v2010/safelist"; import { AccountContext } from "./v2010/account"; export default class V2010 extends Version { @@ -30,8 +29,6 @@ export default class V2010 extends Version { /** accounts - { Twilio.Api.V2010.AccountListInstance } resource */ protected _accounts?: AccountListInstance; - /** safelist - { Twilio.Api.V2010.SafelistListInstance } resource */ - protected _safelist?: SafelistListInstance; /** account - { Twilio.Api.V2010.AccountContext } resource */ protected _account?: AccountContext; @@ -41,12 +38,6 @@ export default class V2010 extends Version { return this._accounts; } - /** Getter for safelist resource */ - get safelist(): SafelistListInstance { - this._safelist = this._safelist || SafelistListInstance(this); - return this._safelist; - } - /** Getter for account resource */ get account(): AccountContext { this._account = diff --git a/src/rest/api/v2010/account/conference/participant.ts b/src/rest/api/v2010/account/conference/participant.ts index 6b46e24c0..259ce27cd 100644 --- a/src/rest/api/v2010/account/conference/participant.ts +++ b/src/rest/api/v2010/account/conference/participant.ts @@ -156,6 +156,8 @@ export interface ParticipantListInstanceCreateOptions { 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 @@ -887,6 +889,8 @@ export function ParticipantListInstance( 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: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; diff --git a/src/rest/flexApi/v1/configuration.ts b/src/rest/flexApi/v1/configuration.ts index 6ff89cd50..599714e6f 100644 --- a/src/rest/flexApi/v1/configuration.ts +++ b/src/rest/flexApi/v1/configuration.ts @@ -174,6 +174,7 @@ interface ConfigurationResource { flex_ui_status_report: any; agent_conv_end_methods: any; citrix_voice_vdi: any; + offline_config: any; } export class ConfigurationInstance { @@ -228,6 +229,7 @@ export class ConfigurationInstance { 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 = {}; } @@ -417,6 +419,10 @@ export class ConfigurationInstance { * Citrix voice vdi configuration and settings. */ citrixVoiceVdi: any; + /** + * Presence and presence ttl configuration + */ + offlineConfig: any; private get _proxy(): ConfigurationContext { this._context = @@ -508,6 +514,7 @@ export class ConfigurationInstance { flexUiStatusReport: this.flexUiStatusReport, agentConvEndMethods: this.agentConvEndMethods, citrixVoiceVdi: this.citrixVoiceVdi, + offlineConfig: this.offlineConfig, }; } diff --git a/src/rest/intelligence/v2/transcript.ts b/src/rest/intelligence/v2/transcript.ts index 633cfc2ca..a91ba8f79 100644 --- a/src/rest/intelligence/v2/transcript.ts +++ b/src/rest/intelligence/v2/transcript.ts @@ -30,14 +30,6 @@ export type TranscriptStatus = | "failed" | "canceled"; -/** - * Options to pass to fetch a TranscriptInstance - */ -export interface TranscriptContextFetchOptions { - /** Grant access to PII Redacted/Unredacted Transcript. The default is `true` to access redacted Transcript. */ - redacted?: boolean; -} - /** * Options to pass to create a TranscriptInstance */ @@ -161,18 +153,6 @@ export interface TranscriptContext { fetch( callback?: (error: Error | null, item?: TranscriptInstance) => any ): Promise; - /** - * Fetch a TranscriptInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TranscriptInstance - */ - fetch( - params: TranscriptContextFetchOptions, - callback?: (error: Error | null, item?: TranscriptInstance) => any - ): Promise; /** * Provide a user-friendly representation @@ -240,32 +220,13 @@ export class TranscriptContextImpl implements TranscriptContext { } fetch( - params?: - | TranscriptContextFetchOptions - | ((error: Error | null, item?: TranscriptInstance) => any), callback?: (error: Error | null, item?: TranscriptInstance) => any ): Promise { - if (params instanceof Function) { - callback = params; - params = {}; - } else { - params = params || {}; - } - - let data: any = {}; - - if (params["redacted"] !== undefined) - data["Redacted"] = serialize.bool(params["redacted"]); - - const headers: any = {}; - const instance = this; let operationVersion = instance._version, operationPromise = operationVersion.fetch({ uri: instance._uri, method: "get", - params: data, - headers, }); operationPromise = operationPromise.then( @@ -429,25 +390,8 @@ export class TranscriptInstance { */ fetch( callback?: (error: Error | null, item?: TranscriptInstance) => any - ): Promise; - /** - * Fetch a TranscriptInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TranscriptInstance - */ - fetch( - params: TranscriptContextFetchOptions, - callback?: (error: Error | null, item?: TranscriptInstance) => any - ): Promise; - - fetch( - params?: any, - callback?: (error: Error | null, item?: TranscriptInstance) => any ): Promise { - return this._proxy.fetch(params, callback); + return this._proxy.fetch(callback); } /** diff --git a/src/rest/intelligence/v2/transcript/media.ts b/src/rest/intelligence/v2/transcript/media.ts index 68a391c61..0a0da5521 100644 --- a/src/rest/intelligence/v2/transcript/media.ts +++ b/src/rest/intelligence/v2/transcript/media.ts @@ -22,7 +22,7 @@ import { isValidPathParam } from "../../../../base/utility"; * Options to pass to fetch a MediaInstance */ export interface MediaContextFetchOptions { - /** Grant access to PII Redacted/Unredacted Media. The default is `true` to access redacted media. */ + /** Grant access to PII Redacted/Unredacted Media. If redaction is enabled, the default is `true` to access redacted media. */ redacted?: boolean; } diff --git a/src/rest/intelligence/v2/transcript/operatorResult.ts b/src/rest/intelligence/v2/transcript/operatorResult.ts index 94ddf28bc..fc64bf2aa 100644 --- a/src/rest/intelligence/v2/transcript/operatorResult.ts +++ b/src/rest/intelligence/v2/transcript/operatorResult.ts @@ -31,14 +31,14 @@ export type OperatorResultOperatorType = * Options to pass to fetch a OperatorResultInstance */ export interface OperatorResultContextFetchOptions { - /** Grant access to PII redacted/unredacted Language Understanding operator. The default is True. */ + /** 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. The default is True. */ + /** 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; @@ -57,7 +57,7 @@ export interface OperatorResultListInstanceEachOptions { * Options to pass to list */ export interface OperatorResultListInstanceOptions { - /** Grant access to PII redacted/unredacted Language Understanding operator. The default is True. */ + /** 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; @@ -69,7 +69,7 @@ export interface OperatorResultListInstanceOptions { * Options to pass to page */ export interface OperatorResultListInstancePageOptions { - /** Grant access to PII redacted/unredacted Language Understanding operator. The default is True. */ + /** 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; diff --git a/src/rest/intelligence/v2/transcript/sentence.ts b/src/rest/intelligence/v2/transcript/sentence.ts index 397fee373..d9d1478ae 100644 --- a/src/rest/intelligence/v2/transcript/sentence.ts +++ b/src/rest/intelligence/v2/transcript/sentence.ts @@ -24,7 +24,7 @@ import { isValidPathParam } from "../../../../base/utility"; * Options to pass to each */ export interface SentenceListInstanceEachOptions { - /** Grant access to PII Redacted/Unredacted Sentences. The default is `true` to access redacted sentences. */ + /** 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; @@ -40,7 +40,7 @@ export interface SentenceListInstanceEachOptions { * Options to pass to list */ export interface SentenceListInstanceOptions { - /** Grant access to PII Redacted/Unredacted Sentences. The default is `true` to access redacted sentences. */ + /** 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; @@ -52,7 +52,7 @@ export interface SentenceListInstanceOptions { * Options to pass to page */ export interface SentenceListInstancePageOptions { - /** Grant access to PII Redacted/Unredacted Sentences. The default is `true` to access redacted sentences. */ + /** 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; diff --git a/src/rest/lookups/v2/phoneNumber.ts b/src/rest/lookups/v2/phoneNumber.ts index 43098ec77..8a7151eb4 100644 --- a/src/rest/lookups/v2/phoneNumber.ts +++ b/src/rest/lookups/v2/phoneNumber.ts @@ -202,7 +202,7 @@ interface PhoneNumberResource { identity_match: any; reassigned_number: any; sms_pumping_risk: any; - disposable_phone_number_risk: any; + phone_number_quality_score: any; url: string; } @@ -229,7 +229,7 @@ export class PhoneNumberInstance { this.identityMatch = payload.identity_match; this.reassignedNumber = payload.reassigned_number; this.smsPumpingRisk = payload.sms_pumping_risk; - this.disposablePhoneNumberRisk = payload.disposable_phone_number_risk; + this.phoneNumberQualityScore = payload.phone_number_quality_score; this.url = payload.url; this._solution = { phoneNumber: phoneNumber || this.phoneNumber }; @@ -292,9 +292,9 @@ export class PhoneNumberInstance { */ smsPumpingRisk: any; /** - * An object that contains information on if a mobile phone number could be a disposable or burner number. + * An object that contains information of a mobile phone number quality score. Quality score will return a risk score about the phone number. */ - disposablePhoneNumberRisk: any; + phoneNumberQualityScore: any; /** * The absolute URL of the resource. */ @@ -358,7 +358,7 @@ export class PhoneNumberInstance { identityMatch: this.identityMatch, reassignedNumber: this.reassignedNumber, smsPumpingRisk: this.smsPumpingRisk, - disposablePhoneNumberRisk: this.disposablePhoneNumberRisk, + phoneNumberQualityScore: this.phoneNumberQualityScore, url: this.url, }; } diff --git a/src/rest/messaging/v1/service/usAppToPerson.ts b/src/rest/messaging/v1/service/usAppToPerson.ts index 11ba68304..ee9529734 100644 --- a/src/rest/messaging/v1/service/usAppToPerson.ts +++ b/src/rest/messaging/v1/service/usAppToPerson.ts @@ -30,7 +30,7 @@ export interface UsAppToPersonListInstanceCreateOptions { 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; - /** Message samples, at least 1 and up to 5 sample messages (at least 2 for sole proprietor), >=20 chars, <=1024 chars each. */ + /** 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; /** A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] */ usAppToPersonUsecase: string; @@ -293,7 +293,7 @@ export class UsAppToPersonInstance { */ description: string; /** - * Message samples, at least 1 and up to 5 sample messages (at least 2 for starter/sole proprietor), >=20 chars, <=1024 chars each. + * 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; /** diff --git a/src/rest/taskrouter/v1/workspace/task.ts b/src/rest/taskrouter/v1/workspace/task.ts index bbb18889f..d86c38d4f 100644 --- a/src/rest/taskrouter/v1/workspace/task.ts +++ b/src/rest/taskrouter/v1/workspace/task.ts @@ -53,6 +53,8 @@ export interface TaskContextUpdateOptions { 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; } /** @@ -69,6 +71,8 @@ export interface TaskListInstanceCreateOptions { 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; } /** * Options to pass to each @@ -88,7 +92,7 @@ export interface TaskListInstanceEachOptions { taskQueueName?: string; /** The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. */ evaluateTaskAttributes?: string; - /** How to order the returned Task resources. y default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `Priority` or `DateCreated` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Multiple 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. */ + /** 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 addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. */ hasAddons?: boolean; @@ -120,7 +124,7 @@ export interface TaskListInstanceOptions { taskQueueName?: string; /** The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. */ evaluateTaskAttributes?: string; - /** How to order the returned Task resources. y default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `Priority` or `DateCreated` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Multiple 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. */ + /** 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 addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. */ hasAddons?: boolean; @@ -148,7 +152,7 @@ export interface TaskListInstancePageOptions { taskQueueName?: string; /** The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. */ evaluateTaskAttributes?: string; - /** How to order the returned Task resources. y default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `Priority` or `DateCreated` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Multiple 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. */ + /** 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 addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. */ hasAddons?: boolean; @@ -347,6 +351,10 @@ export class TaskContextImpl implements TaskContext { 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: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; @@ -419,6 +427,7 @@ interface TaskResource { workspace_sid: string; url: string; links: Record; + virtual_start_time: Date; } export class TaskInstance { @@ -454,6 +463,9 @@ export class TaskInstance { this.workspaceSid = payload.workspace_sid; this.url = payload.url; this.links = payload.links; + this.virtualStartTime = deserialize.iso8601DateTime( + payload.virtual_start_time + ); this._solution = { workspaceSid, sid: sid || this.sid }; } @@ -539,6 +551,10 @@ export class TaskInstance { * The URLs of related resources. */ links: Record; + /** + * 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; private get _proxy(): TaskContext { this._context = @@ -659,6 +675,7 @@ export class TaskInstance { workspaceSid: this.workspaceSid, url: this.url, links: this.links, + virtualStartTime: this.virtualStartTime, }; } @@ -819,6 +836,10 @@ export function TaskListInstance( data["WorkflowSid"] = params["workflowSid"]; if (params["attributes"] !== undefined) data["Attributes"] = params["attributes"]; + if (params["virtualStartTime"] !== undefined) + data["VirtualStartTime"] = serialize.iso8601DateTime( + params["virtualStartTime"] + ); const headers: any = {}; headers["Content-Type"] = "application/x-www-form-urlencoded"; From de635412136f0ea776fc0223a6235f249e2a5a0b Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 19 Oct 2023 12:07:14 +0000 Subject: [PATCH 03/10] Release 4.19.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d13668d52..292a207f8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "twilio", "description": "A Twilio helper library", - "version": "4.18.1", + "version": "4.19.0", "author": "API Team ", "contributors": [ { From 8ddbe9506c0dcad4fa09cd2beacf41b7d1599349 Mon Sep 17 00:00:00 2001 From: Shubham Date: Wed, 1 Nov 2023 17:22:58 +0530 Subject: [PATCH 04/10] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 4af9ef19d..780fe0a90 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ twilio-node changelog ===================== -[2023-10-17] Version 5.0.0-rc.0 +[2023-11-01] Version 5.0.0-rc.1 --------------------------- - Release Candidate preparation From 8663558da603ccb45a017ad4cecd7760efa17303 Mon Sep 17 00:00:00 2001 From: Shubham Date: Wed, 1 Nov 2023 17:23:30 +0530 Subject: [PATCH 05/10] Update UPGRADE.md --- UPGRADE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADE.md b/UPGRADE.md index 79bd6c88e..81080957d 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -2,7 +2,7 @@ _All `MAJOR` version bumps will have upgrade notes posted here._ -## [2023-01-25] 4.x.x to 5.x.x +## [2023-11-01] 4.x.x to 5.x.x --- ### Overview From b304de8d2e692bfbd63343cda141bd1f7d6fe368 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Wed, 1 Nov 2023 17:27:25 +0530 Subject: [PATCH 06/10] chore: updated changelog --- CHANGES.md | 2 +- UPGRADE.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 780fe0a90..4af9ef19d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ twilio-node changelog ===================== -[2023-11-01] Version 5.0.0-rc.1 +[2023-10-17] Version 5.0.0-rc.0 --------------------------- - Release Candidate preparation diff --git a/UPGRADE.md b/UPGRADE.md index 81080957d..2fbfd54cd 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -2,7 +2,7 @@ _All `MAJOR` version bumps will have upgrade notes posted here._ -## [2023-11-01] 4.x.x to 5.x.x +## [2023-10-17] 4.x.x to 5.x.x --- ### Overview From b20eda19797d5bf0afb703e84f015cd0838a421b Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Fri, 3 Nov 2023 13:16:02 +0530 Subject: [PATCH 07/10] chore: removed PreviewMessaging.ts --- src/rest/PreviewMessaging.ts | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 src/rest/PreviewMessaging.ts diff --git a/src/rest/PreviewMessaging.ts b/src/rest/PreviewMessaging.ts deleted file mode 100644 index 3569a2ae8..000000000 --- a/src/rest/PreviewMessaging.ts +++ /dev/null @@ -1,15 +0,0 @@ -import PreviewMessagingBase from "./PreviewMessagingBase"; -import {MessageListInstance} from "./previewMessaging/v1/message"; - -class PreviewMessaging extends PreviewMessagingBase { - /** - * @deprecated - Use v1.messages; instead - */ - get messages(): MessageListInstance { - console.warn( - "messages is deprecated. Use v1.messages; instead." - ); - return this.v1.messages; - } -} -export = PreviewMessaging From 31e018900d3a2c406fc8e2a0022360a70beadfab Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 6 Nov 2023 14:51:56 +0000 Subject: [PATCH 08/10] [Librarian] Regenerated @ 5eb406c4977c9f6976e6053cb5b581056f541a59 --- CHANGES.md | 18 + src/rest/flexApi/V1.ts | 10 + src/rest/flexApi/v1/provisioningStatus.ts | 196 ++++++++++ .../v2/transcript/operatorResult.ts | 7 + src/rest/messaging/v1/tollfreeVerification.ts | 41 +++ src/rest/serverless/v1/service/build.ts | 8 +- src/rest/trusthub/V1.ts | 11 + .../v1/complianceTollfreeInquiries.ts | 341 ++++++++++++++++++ 8 files changed, 631 insertions(+), 1 deletion(-) create mode 100644 src/rest/flexApi/v1/provisioningStatus.ts create mode 100644 src/rest/trusthub/v1/complianceTollfreeInquiries.ts diff --git a/CHANGES.md b/CHANGES.md index 9392e5acc..4c86cb6f1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,24 @@ twilio-node changelog ===================== +[2023-11-06] Version 4.19.1 +--------------------------- +**Flex** +- Adding `provisioning_status` for Email Manager + +**Intelligence** +- Add text-generation operator (for example conversation summary) results to existing OperatorResults collection. + +**Messaging** +- Add DELETE support to Tollfree Verification resource + +**Serverless** +- Add node18 as a valid Build runtime + +**Verify** +- Update Verify TOTP maturity to GA. + + [2023-10-19] Version 4.19.0 --------------------------- **Library - Chore** diff --git a/src/rest/flexApi/V1.ts b/src/rest/flexApi/V1.ts index fd203e280..153a8a2c3 100644 --- a/src/rest/flexApi/V1.ts +++ b/src/rest/flexApi/V1.ts @@ -29,6 +29,7 @@ import { InsightsSettingsAnswerSetsListInstance } from "./v1/insightsSettingsAns import { InsightsSettingsCommentListInstance } from "./v1/insightsSettingsComment"; import { InsightsUserRolesListInstance } from "./v1/insightsUserRoles"; import { InteractionListInstance } from "./v1/interaction"; +import { ProvisioningStatusListInstance } from "./v1/provisioningStatus"; import { WebChannelListInstance } from "./v1/webChannel"; export default class V1 extends Version { @@ -71,6 +72,8 @@ export default class V1 extends Version { protected _insightsUserRoles?: InsightsUserRolesListInstance; /** interaction - { Twilio.FlexApi.V1.InteractionListInstance } resource */ protected _interaction?: InteractionListInstance; + /** provisioningStatus - { Twilio.FlexApi.V1.ProvisioningStatusListInstance } resource */ + protected _provisioningStatus?: ProvisioningStatusListInstance; /** webChannel - { Twilio.FlexApi.V1.WebChannelListInstance } resource */ protected _webChannel?: WebChannelListInstance; @@ -180,6 +183,13 @@ export default class V1 extends Version { return this._interaction; } + /** Getter for provisioningStatus resource */ + get provisioningStatus(): ProvisioningStatusListInstance { + this._provisioningStatus = + this._provisioningStatus || ProvisioningStatusListInstance(this); + return this._provisioningStatus; + } + /** Getter for webChannel resource */ get webChannel(): WebChannelListInstance { this._webChannel = this._webChannel || WebChannelListInstance(this); diff --git a/src/rest/flexApi/v1/provisioningStatus.ts b/src/rest/flexApi/v1/provisioningStatus.ts new file mode 100644 index 000000000..24abfc729 --- /dev/null +++ b/src/rest/flexApi/v1/provisioningStatus.ts @@ -0,0 +1,196 @@ +/* + * 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. + */ + +import { inspect, InspectOptions } from "util"; +import V1 from "../V1"; +const deserialize = require("../../../base/deserialize"); +const serialize = require("../../../base/serialize"); +import { isValidPathParam } from "../../../base/utility"; + +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; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface ProvisioningStatusContextSolution {} + +export class ProvisioningStatusContextImpl + implements ProvisioningStatusContext +{ + protected _solution: ProvisioningStatusContextSolution; + protected _uri: string; + + constructor(protected _version: V1) { + this._solution = {}; + this._uri = `/account/provision/status`; + } + + fetch( + callback?: (error: Error | null, item?: ProvisioningStatusInstance) => any + ): Promise { + 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; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +interface ProvisioningStatusPayload extends ProvisioningStatusResource {} + +interface ProvisioningStatusResource { + status: ProvisioningStatusStatus; + url: string; +} + +export class ProvisioningStatusInstance { + protected _solution: ProvisioningStatusContextSolution; + protected _context?: ProvisioningStatusContext; + + constructor(protected _version: V1, payload: ProvisioningStatusResource) { + this.status = payload.status; + this.url = payload.url; + + this._solution = {}; + } + + status: ProvisioningStatusStatus; + /** + * The absolute URL of the resource. + */ + url: string; + + private get _proxy(): ProvisioningStatusContext { + 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?: (error: Error | null, item?: ProvisioningStatusInstance) => any + ): Promise { + return this._proxy.fetch(callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + status: this.status, + url: this.url, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +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 function ProvisioningStatusListInstance( + version: V1 +): ProvisioningStatusListInstance { + const instance = (() => instance.get()) as ProvisioningStatusListInstance; + + instance.get = function get(): ProvisioningStatusContext { + return new ProvisioningStatusContextImpl(version); + }; + + instance._version = version; + instance._solution = {}; + instance._uri = ``; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} diff --git a/src/rest/intelligence/v2/transcript/operatorResult.ts b/src/rest/intelligence/v2/transcript/operatorResult.ts index fc64bf2aa..e167dce11 100644 --- a/src/rest/intelligence/v2/transcript/operatorResult.ts +++ b/src/rest/intelligence/v2/transcript/operatorResult.ts @@ -213,6 +213,7 @@ interface OperatorResultResource { predicted_probability: number; label_probabilities: any; extract_results: any; + text_generation_results: any; transcript_sid: string; url: string; } @@ -239,6 +240,7 @@ export class OperatorResultInstance { 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; @@ -293,6 +295,10 @@ export class OperatorResultInstance { * 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. */ @@ -362,6 +368,7 @@ export class OperatorResultInstance { predictedProbability: this.predictedProbability, labelProbabilities: this.labelProbabilities, extractResults: this.extractResults, + textGenerationResults: this.textGenerationResults, transcriptSid: this.transcriptSid, url: this.url, }; diff --git a/src/rest/messaging/v1/tollfreeVerification.ts b/src/rest/messaging/v1/tollfreeVerification.ts index b5a6f4b1e..caddf98dc 100644 --- a/src/rest/messaging/v1/tollfreeVerification.ts +++ b/src/rest/messaging/v1/tollfreeVerification.ts @@ -182,6 +182,17 @@ export interface TollfreeVerificationListInstancePageOptions { } 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; + /** * Fetch a TollfreeVerificationInstance * @@ -242,6 +253,23 @@ export class TollfreeVerificationContextImpl this._uri = `/Tollfree/Verifications/${sid}`; } + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + 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?: (error: Error | null, item?: TollfreeVerificationInstance) => any ): Promise { @@ -605,6 +633,19 @@ export class TollfreeVerificationInstance { return this._context; } + /** + * Remove a TollfreeVerificationInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + return this._proxy.remove(callback); + } + /** * Fetch a TollfreeVerificationInstance * diff --git a/src/rest/serverless/v1/service/build.ts b/src/rest/serverless/v1/service/build.ts index 0efb47b65..548d93fb7 100644 --- a/src/rest/serverless/v1/service/build.ts +++ b/src/rest/serverless/v1/service/build.ts @@ -21,7 +21,13 @@ const serialize = require("../../../../base/serialize"); import { isValidPathParam } from "../../../../base/utility"; import { BuildStatusListInstance } from "./build/buildStatus"; -export type BuildRuntime = "node8" | "node10" | "node12" | "node14" | "node16"; +export type BuildRuntime = + | "node8" + | "node10" + | "node12" + | "node14" + | "node16" + | "node18"; export type BuildStatus = "building" | "completed" | "failed"; diff --git a/src/rest/trusthub/V1.ts b/src/rest/trusthub/V1.ts index 19fdb9379..a6abf9249 100644 --- a/src/rest/trusthub/V1.ts +++ b/src/rest/trusthub/V1.ts @@ -15,6 +15,7 @@ import TrusthubBase from "../TrusthubBase"; import Version from "../../base/Version"; import { ComplianceInquiriesListInstance } from "./v1/complianceInquiries"; +import { ComplianceTollfreeInquiriesListInstance } from "./v1/complianceTollfreeInquiries"; import { CustomerProfilesListInstance } from "./v1/customerProfiles"; import { EndUserListInstance } from "./v1/endUser"; import { EndUserTypeListInstance } from "./v1/endUserType"; @@ -35,6 +36,8 @@ export default class V1 extends Version { /** complianceInquiries - { Twilio.Trusthub.V1.ComplianceInquiriesListInstance } resource */ protected _complianceInquiries?: ComplianceInquiriesListInstance; + /** complianceTollfreeInquiries - { Twilio.Trusthub.V1.ComplianceTollfreeInquiriesListInstance } resource */ + protected _complianceTollfreeInquiries?: ComplianceTollfreeInquiriesListInstance; /** customerProfiles - { Twilio.Trusthub.V1.CustomerProfilesListInstance } resource */ protected _customerProfiles?: CustomerProfilesListInstance; /** endUsers - { Twilio.Trusthub.V1.EndUserListInstance } resource */ @@ -57,6 +60,14 @@ export default class V1 extends Version { return this._complianceInquiries; } + /** Getter for complianceTollfreeInquiries resource */ + get complianceTollfreeInquiries(): ComplianceTollfreeInquiriesListInstance { + this._complianceTollfreeInquiries = + this._complianceTollfreeInquiries || + ComplianceTollfreeInquiriesListInstance(this); + return this._complianceTollfreeInquiries; + } + /** Getter for customerProfiles resource */ get customerProfiles(): CustomerProfilesListInstance { this._customerProfiles = diff --git a/src/rest/trusthub/v1/complianceTollfreeInquiries.ts b/src/rest/trusthub/v1/complianceTollfreeInquiries.ts new file mode 100644 index 000000000..a373c5491 --- /dev/null +++ b/src/rest/trusthub/v1/complianceTollfreeInquiries.ts @@ -0,0 +1,341 @@ +/* + * 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. + */ + +import { inspect, InspectOptions } from "util"; +import V1 from "../V1"; +const deserialize = require("../../../base/deserialize"); +const serialize = require("../../../base/serialize"); +import { isValidPathParam } from "../../../base/utility"; + +/** + * Options to pass to update a ComplianceTollfreeInquiriesInstance + */ +export interface ComplianceTollfreeInquiriesContextUpdateOptions { + /** The Tollfree phone number to be verified */ + did: string; +} + +/** + * Options to pass to create a ComplianceTollfreeInquiriesInstance + */ +export interface ComplianceTollfreeInquiriesListInstanceCreateOptions { + /** The Tollfree phone number to be verified */ + did: string; +} + +export interface ComplianceTollfreeInquiriesContext { + /** + * Update a ComplianceTollfreeInquiriesInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ComplianceTollfreeInquiriesInstance + */ + update( + params: ComplianceTollfreeInquiriesContextUpdateOptions, + callback?: ( + error: Error | null, + item?: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface ComplianceTollfreeInquiriesContextSolution { + tollfreeId: string; +} + +export class ComplianceTollfreeInquiriesContextImpl + implements ComplianceTollfreeInquiriesContext +{ + protected _solution: ComplianceTollfreeInquiriesContextSolution; + protected _uri: string; + + constructor(protected _version: V1, tollfreeId: string) { + if (!isValidPathParam(tollfreeId)) { + throw new Error("Parameter 'tollfreeId' is not valid."); + } + + this._solution = { tollfreeId }; + this._uri = `/ComplianceInquiries/Tollfree/${tollfreeId}/Initialize`; + } + + update( + params: ComplianceTollfreeInquiriesContextUpdateOptions, + callback?: ( + error: Error | null, + item?: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + if (params["did"] === null || params["did"] === undefined) { + throw new Error("Required parameter \"params['did']\" missing."); + } + + let data: any = {}; + + data["Did"] = params["did"]; + + const headers: any = {}; + 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 ComplianceTollfreeInquiriesInstance( + operationVersion, + payload, + instance._solution.tollfreeId + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return this._solution; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +interface ComplianceTollfreeInquiriesPayload + extends ComplianceTollfreeInquiriesResource {} + +interface ComplianceTollfreeInquiriesResource { + inquiry_id: string; + inquiry_session_token: string; + tollfree_id: string; + url: string; +} + +export class ComplianceTollfreeInquiriesInstance { + protected _solution: ComplianceTollfreeInquiriesContextSolution; + protected _context?: ComplianceTollfreeInquiriesContext; + + constructor( + protected _version: V1, + payload: ComplianceTollfreeInquiriesResource, + tollfreeId?: string + ) { + this.inquiryId = payload.inquiry_id; + this.inquirySessionToken = payload.inquiry_session_token; + this.tollfreeId = payload.tollfree_id; + this.url = payload.url; + + this._solution = { tollfreeId: tollfreeId || this.tollfreeId }; + } + + /** + * 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. + */ + tollfreeId: string; + /** + * The URL of this resource. + */ + url: string; + + private get _proxy(): ComplianceTollfreeInquiriesContext { + this._context = + this._context || + new ComplianceTollfreeInquiriesContextImpl( + this._version, + this._solution.tollfreeId + ); + return this._context; + } + + /** + * Update a ComplianceTollfreeInquiriesInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ComplianceTollfreeInquiriesInstance + */ + update( + params: ComplianceTollfreeInquiriesContextUpdateOptions, + callback?: ( + error: Error | null, + item?: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise; + + update( + params?: any, + callback?: ( + error: Error | null, + item?: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise { + return this._proxy.update(params, callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + inquiryId: this.inquiryId, + inquirySessionToken: this.inquirySessionToken, + tollfreeId: this.tollfreeId, + url: this.url, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface ComplianceTollfreeInquiriesSolution {} + +export interface ComplianceTollfreeInquiriesListInstance { + _version: V1; + _solution: ComplianceTollfreeInquiriesSolution; + _uri: string; + + (tollfreeId: string): ComplianceTollfreeInquiriesContext; + get(tollfreeId: string): ComplianceTollfreeInquiriesContext; + + /** + * 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; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function ComplianceTollfreeInquiriesListInstance( + version: V1 +): ComplianceTollfreeInquiriesListInstance { + const instance = ((tollfreeId) => + instance.get(tollfreeId)) as ComplianceTollfreeInquiriesListInstance; + + instance.get = function get(tollfreeId): ComplianceTollfreeInquiriesContext { + return new ComplianceTollfreeInquiriesContextImpl(version, tollfreeId); + }; + + instance._version = version; + instance._solution = {}; + instance._uri = `/ComplianceInquiries/Tollfree/Initialize`; + + instance.create = function create( + params: ComplianceTollfreeInquiriesListInstanceCreateOptions, + callback?: ( + error: Error | null, + items: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + if (params["did"] === null || params["did"] === undefined) { + throw new Error("Required parameter \"params['did']\" missing."); + } + + let data: any = {}; + + data["Did"] = params["did"]; + + const headers: any = {}; + 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[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} From 1f6d8ebc2561bfa01b5d1accd24c9cdddda28806 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 6 Nov 2023 15:31:04 +0000 Subject: [PATCH 09/10] Release 4.19.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 292a207f8..87814fbf9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "twilio", "description": "A Twilio helper library", - "version": "4.19.0", + "version": "4.19.1", "author": "API Team ", "contributors": [ { From 47ac32f7b2d0ff8e881175a57513ee6e58d178b4 Mon Sep 17 00:00:00 2001 From: Shubham Date: Tue, 7 Nov 2023 15:52:59 +0530 Subject: [PATCH 10/10] chore: Added previewMessaging folder (#974) * chore: added PreviewMessaging directory * chore: added PreviewMessaging directory * [Librarian] Regenerated @ 5eb406c4977c9f6976e6053cb5b581056f541a59 * Release 4.19.1 * Update PreviewMessagingBase.ts * chore: removed LTS version * chore: executed prettier --------- Co-authored-by: Twilio --- .github/workflows/test-and-deploy.yml | 6 +- CHANGES.md | 20 +- src/base/RequestClient.ts | 7 +- src/rest/PreviewMessaging.ts | 13 + src/rest/PreviewMessagingBase.ts | 33 ++ src/rest/flexApi/V1.ts | 10 + src/rest/flexApi/v1/provisioningStatus.ts | 196 ++++++++++ .../v2/transcript/operatorResult.ts | 7 + src/rest/messaging/v1/tollfreeVerification.ts | 41 +++ src/rest/previewMessaging/V1.ts | 46 +++ src/rest/previewMessaging/v1/broadcast.ts | 208 +++++++++++ src/rest/previewMessaging/v1/message.ts | 272 ++++++++++++++ src/rest/serverless/v1/service/build.ts | 8 +- src/rest/trusthub/V1.ts | 11 + .../v1/complianceTollfreeInquiries.ts | 341 ++++++++++++++++++ 15 files changed, 1211 insertions(+), 8 deletions(-) create mode 100644 src/rest/PreviewMessaging.ts create mode 100644 src/rest/PreviewMessagingBase.ts create mode 100644 src/rest/flexApi/v1/provisioningStatus.ts create mode 100644 src/rest/previewMessaging/V1.ts create mode 100644 src/rest/previewMessaging/v1/broadcast.ts create mode 100644 src/rest/previewMessaging/v1/message.ts create mode 100644 src/rest/trusthub/v1/complianceTollfreeInquiries.ts diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 760cac0d8..ad07a0db9 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - node: [ 14, 16, 18, lts/* ] + node: [ 14, 16, 18 ] steps: - name: Checkout twilio-node uses: actions/checkout@v3 @@ -49,7 +49,7 @@ jobs: npm run test - name: SonarCloud Scan - if: ${{ (github.event_name == 'pull_request' || github.ref_type == 'branch') && matrix.node == 'lts/*' && !github.event.pull_request.head.repo.fork }} + if: ${{ (github.event_name == 'pull_request' || github.ref_type == 'branch') && matrix.node == '18' && !github.event.pull_request.head.repo.fork }} uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any @@ -69,7 +69,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v3 with: - node-version: lts/* + node-version: 18 - run: npm install diff --git a/CHANGES.md b/CHANGES.md index f86bda2a2..44504c27b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,10 +1,28 @@ twilio-node changelog ===================== -[2023-10-17] Version 5.0.0-rc.0 +[2023-11-07] Version 5.0.0-rc.0 --------------------------- - Release Candidate preparation +[2023-11-06] Version 4.19.1 +--------------------------- +**Flex** +- Adding `provisioning_status` for Email Manager + +**Intelligence** +- Add text-generation operator (for example conversation summary) results to existing OperatorResults collection. + +**Messaging** +- Add DELETE support to Tollfree Verification resource + +**Serverless** +- Add node18 as a valid Build runtime + +**Verify** +- Update Verify TOTP maturity to GA. + + [2023-10-19] Version 4.19.0 --------------------------- **Library - Chore** diff --git a/src/base/RequestClient.ts b/src/base/RequestClient.ts index f48b00b13..263c44324 100644 --- a/src/base/RequestClient.ts +++ b/src/base/RequestClient.ts @@ -191,10 +191,11 @@ class RequestClient { }; if (opts.data && options.headers) { - if(options.headers["Content-Type"] === "application/x-www-form-urlencoded") { + if ( + options.headers["Content-Type"] === "application/x-www-form-urlencoded" + ) { options.data = qs.stringify(opts.data, { arrayFormat: "repeat" }); - } - else if(options.headers["Content-Type"] === "application/json") { + } else if (options.headers["Content-Type"] === "application/json") { options.data = opts.data; } } diff --git a/src/rest/PreviewMessaging.ts b/src/rest/PreviewMessaging.ts new file mode 100644 index 000000000..dc598c3a7 --- /dev/null +++ b/src/rest/PreviewMessaging.ts @@ -0,0 +1,13 @@ +import PreviewMessagingBase from "./PreviewMessagingBase"; +import { MessageListInstance } from "./previewMessaging/v1/message"; + +class PreviewMessaging extends PreviewMessagingBase { + /** + * @deprecated - Use v1.messages; instead + */ + get messages(): MessageListInstance { + console.warn("messages is deprecated. Use v1.messages; instead."); + return this.v1.messages; + } +} +export = PreviewMessaging; diff --git a/src/rest/PreviewMessagingBase.ts b/src/rest/PreviewMessagingBase.ts new file mode 100644 index 000000000..44e88ea83 --- /dev/null +++ b/src/rest/PreviewMessagingBase.ts @@ -0,0 +1,33 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import Domain from "../base/Domain"; +import V1 from "./previewMessaging/V1"; + +class PreviewMessagingBase extends Domain { + _v1?: V1; + + /** + * Initialize accounts domain + * + * @param twilio - The twilio client + */ + constructor(twilio: any) { + super(twilio, "https://preview.messaging.twilio.com"); + } + + get v1(): V1 { + this._v1 = this._v1 || new V1(this); + return this._v1; + } +} + +export = PreviewMessagingBase; diff --git a/src/rest/flexApi/V1.ts b/src/rest/flexApi/V1.ts index fd203e280..153a8a2c3 100644 --- a/src/rest/flexApi/V1.ts +++ b/src/rest/flexApi/V1.ts @@ -29,6 +29,7 @@ import { InsightsSettingsAnswerSetsListInstance } from "./v1/insightsSettingsAns import { InsightsSettingsCommentListInstance } from "./v1/insightsSettingsComment"; import { InsightsUserRolesListInstance } from "./v1/insightsUserRoles"; import { InteractionListInstance } from "./v1/interaction"; +import { ProvisioningStatusListInstance } from "./v1/provisioningStatus"; import { WebChannelListInstance } from "./v1/webChannel"; export default class V1 extends Version { @@ -71,6 +72,8 @@ export default class V1 extends Version { protected _insightsUserRoles?: InsightsUserRolesListInstance; /** interaction - { Twilio.FlexApi.V1.InteractionListInstance } resource */ protected _interaction?: InteractionListInstance; + /** provisioningStatus - { Twilio.FlexApi.V1.ProvisioningStatusListInstance } resource */ + protected _provisioningStatus?: ProvisioningStatusListInstance; /** webChannel - { Twilio.FlexApi.V1.WebChannelListInstance } resource */ protected _webChannel?: WebChannelListInstance; @@ -180,6 +183,13 @@ export default class V1 extends Version { return this._interaction; } + /** Getter for provisioningStatus resource */ + get provisioningStatus(): ProvisioningStatusListInstance { + this._provisioningStatus = + this._provisioningStatus || ProvisioningStatusListInstance(this); + return this._provisioningStatus; + } + /** Getter for webChannel resource */ get webChannel(): WebChannelListInstance { this._webChannel = this._webChannel || WebChannelListInstance(this); diff --git a/src/rest/flexApi/v1/provisioningStatus.ts b/src/rest/flexApi/v1/provisioningStatus.ts new file mode 100644 index 000000000..24abfc729 --- /dev/null +++ b/src/rest/flexApi/v1/provisioningStatus.ts @@ -0,0 +1,196 @@ +/* + * 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. + */ + +import { inspect, InspectOptions } from "util"; +import V1 from "../V1"; +const deserialize = require("../../../base/deserialize"); +const serialize = require("../../../base/serialize"); +import { isValidPathParam } from "../../../base/utility"; + +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; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface ProvisioningStatusContextSolution {} + +export class ProvisioningStatusContextImpl + implements ProvisioningStatusContext +{ + protected _solution: ProvisioningStatusContextSolution; + protected _uri: string; + + constructor(protected _version: V1) { + this._solution = {}; + this._uri = `/account/provision/status`; + } + + fetch( + callback?: (error: Error | null, item?: ProvisioningStatusInstance) => any + ): Promise { + 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; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +interface ProvisioningStatusPayload extends ProvisioningStatusResource {} + +interface ProvisioningStatusResource { + status: ProvisioningStatusStatus; + url: string; +} + +export class ProvisioningStatusInstance { + protected _solution: ProvisioningStatusContextSolution; + protected _context?: ProvisioningStatusContext; + + constructor(protected _version: V1, payload: ProvisioningStatusResource) { + this.status = payload.status; + this.url = payload.url; + + this._solution = {}; + } + + status: ProvisioningStatusStatus; + /** + * The absolute URL of the resource. + */ + url: string; + + private get _proxy(): ProvisioningStatusContext { + 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?: (error: Error | null, item?: ProvisioningStatusInstance) => any + ): Promise { + return this._proxy.fetch(callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + status: this.status, + url: this.url, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +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 function ProvisioningStatusListInstance( + version: V1 +): ProvisioningStatusListInstance { + const instance = (() => instance.get()) as ProvisioningStatusListInstance; + + instance.get = function get(): ProvisioningStatusContext { + return new ProvisioningStatusContextImpl(version); + }; + + instance._version = version; + instance._solution = {}; + instance._uri = ``; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} diff --git a/src/rest/intelligence/v2/transcript/operatorResult.ts b/src/rest/intelligence/v2/transcript/operatorResult.ts index fc64bf2aa..e167dce11 100644 --- a/src/rest/intelligence/v2/transcript/operatorResult.ts +++ b/src/rest/intelligence/v2/transcript/operatorResult.ts @@ -213,6 +213,7 @@ interface OperatorResultResource { predicted_probability: number; label_probabilities: any; extract_results: any; + text_generation_results: any; transcript_sid: string; url: string; } @@ -239,6 +240,7 @@ export class OperatorResultInstance { 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; @@ -293,6 +295,10 @@ export class OperatorResultInstance { * 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. */ @@ -362,6 +368,7 @@ export class OperatorResultInstance { predictedProbability: this.predictedProbability, labelProbabilities: this.labelProbabilities, extractResults: this.extractResults, + textGenerationResults: this.textGenerationResults, transcriptSid: this.transcriptSid, url: this.url, }; diff --git a/src/rest/messaging/v1/tollfreeVerification.ts b/src/rest/messaging/v1/tollfreeVerification.ts index b5a6f4b1e..caddf98dc 100644 --- a/src/rest/messaging/v1/tollfreeVerification.ts +++ b/src/rest/messaging/v1/tollfreeVerification.ts @@ -182,6 +182,17 @@ export interface TollfreeVerificationListInstancePageOptions { } 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; + /** * Fetch a TollfreeVerificationInstance * @@ -242,6 +253,23 @@ export class TollfreeVerificationContextImpl this._uri = `/Tollfree/Verifications/${sid}`; } + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + 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?: (error: Error | null, item?: TollfreeVerificationInstance) => any ): Promise { @@ -605,6 +633,19 @@ export class TollfreeVerificationInstance { return this._context; } + /** + * Remove a TollfreeVerificationInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed boolean + */ + remove( + callback?: (error: Error | null, item?: boolean) => any + ): Promise { + return this._proxy.remove(callback); + } + /** * Fetch a TollfreeVerificationInstance * diff --git a/src/rest/previewMessaging/V1.ts b/src/rest/previewMessaging/V1.ts new file mode 100644 index 000000000..e30d2a40c --- /dev/null +++ b/src/rest/previewMessaging/V1.ts @@ -0,0 +1,46 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Bulk Messaging and Broadcast + * Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import PreviewMessagingBase from "../PreviewMessagingBase"; +import Version from "../../base/Version"; +import { BroadcastListInstance } from "./v1/broadcast"; +import { MessageListInstance } from "./v1/message"; + +export default class V1 extends Version { + /** + * Initialize the V1 version of PreviewMessaging + * + * @param domain - The Twilio (Twilio.PreviewMessaging) domain + */ + constructor(domain: PreviewMessagingBase) { + super(domain, "v1"); + } + + /** broadcasts - { Twilio.PreviewMessaging.V1.BroadcastListInstance } resource */ + protected _broadcasts?: BroadcastListInstance; + /** messages - { Twilio.PreviewMessaging.V1.MessageListInstance } resource */ + protected _messages?: MessageListInstance; + + /** Getter for broadcasts resource */ + get broadcasts(): BroadcastListInstance { + this._broadcasts = this._broadcasts || BroadcastListInstance(this); + return this._broadcasts; + } + + /** Getter for messages resource */ + get messages(): MessageListInstance { + this._messages = this._messages || MessageListInstance(this); + return this._messages; + } +} diff --git a/src/rest/previewMessaging/v1/broadcast.ts b/src/rest/previewMessaging/v1/broadcast.ts new file mode 100644 index 000000000..099f61389 --- /dev/null +++ b/src/rest/previewMessaging/v1/broadcast.ts @@ -0,0 +1,208 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Bulk Messaging and Broadcast + * Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { inspect, InspectOptions } from "util"; +import V1 from "../V1"; +const deserialize = require("../../../base/deserialize"); +const serialize = require("../../../base/serialize"); +import { isValidPathParam } from "../../../base/utility"; + +/** + * Details on the statuses of messages sent to recipients + */ +export class MessagingV1BroadcastExecutionDetails { + /** + * Number of recipients in the Broadcast request + */ + "totalRecords"?: number; + /** + * Number of recipients with messages successfully sent to them + */ + "totalCompleted"?: number; + /** + * Number of recipients with messages unsuccessfully sent to them, producing an error + */ + "totalErrors"?: number; +} + +/** + * Options to pass to create a BroadcastInstance + */ +export interface BroadcastListInstanceCreateOptions { + /** Idempotency key provided by the client */ + xTwilioRequestKey?: string; +} + +export interface BroadcastSolution {} + +export interface BroadcastListInstance { + _version: V1; + _solution: BroadcastSolution; + _uri: string; + + /** + * Create a BroadcastInstance + * + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed BroadcastInstance + */ + create( + callback?: (error: Error | null, item?: BroadcastInstance) => any + ): Promise; + /** + * Create a BroadcastInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed BroadcastInstance + */ + create( + params: BroadcastListInstanceCreateOptions, + callback?: (error: Error | null, item?: BroadcastInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function BroadcastListInstance(version: V1): BroadcastListInstance { + const instance = {} as BroadcastListInstance; + + instance._version = version; + instance._solution = {}; + instance._uri = `/Broadcasts`; + + instance.create = function create( + params?: + | BroadcastListInstanceCreateOptions + | ((error: Error | null, items: BroadcastInstance) => any), + callback?: (error: Error | null, items: BroadcastInstance) => any + ): Promise { + if (params instanceof Function) { + callback = params; + params = {}; + } else { + params = params || {}; + } + + let data: any = {}; + + const headers: any = {}; + if (params["xTwilioRequestKey"] !== undefined) + headers["X-Twilio-Request-Key"] = params["xTwilioRequestKey"]; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => new BroadcastInstance(operationVersion, payload) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + }; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} + +interface BroadcastPayload extends BroadcastResource {} + +interface BroadcastResource { + broadcast_sid: string; + created_date: Date; + updated_date: Date; + broadcast_status: string; + execution_details: MessagingV1BroadcastExecutionDetails; + errors_file: string; +} + +/** + * Details of a Broadcast + */ +export class BroadcastInstance { + constructor(protected _version: V1, payload: BroadcastResource) { + this.broadcastSid = payload.broadcast_sid; + this.createdDate = deserialize.iso8601DateTime(payload.created_date); + this.updatedDate = deserialize.iso8601DateTime(payload.updated_date); + this.broadcastStatus = payload.broadcast_status; + this.executionDetails = payload.execution_details; + this.errorsFile = payload.errors_file; + } + + /** + * Numeric ID indentifying individual Broadcast requests + */ + broadcastSid: string; + /** + * Timestamp of when the Broadcast was created + */ + createdDate: Date; + /** + * Timestamp of when the Broadcast was last updated + */ + updatedDate: Date; + /** + * Status of the Broadcast request. Valid values are None, Pending-Upload, Uploaded, Queued, Executing, Execution-Failure, Execution-Completed, Cancelation-Requested, and Canceled + */ + broadcastStatus: string; + executionDetails: MessagingV1BroadcastExecutionDetails; + /** + * Path to a file detailing errors from Broadcast execution + */ + errorsFile: string; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + broadcastSid: this.broadcastSid, + createdDate: this.createdDate, + updatedDate: this.updatedDate, + broadcastStatus: this.broadcastStatus, + executionDetails: this.executionDetails, + errorsFile: this.errorsFile, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/previewMessaging/v1/message.ts b/src/rest/previewMessaging/v1/message.ts new file mode 100644 index 000000000..8ba125715 --- /dev/null +++ b/src/rest/previewMessaging/v1/message.ts @@ -0,0 +1,272 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Bulk Messaging and Broadcast + * Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { inspect, InspectOptions } from "util"; +import V1 from "../V1"; +const deserialize = require("../../../base/deserialize"); +const serialize = require("../../../base/serialize"); +import { isValidPathParam } from "../../../base/utility"; + +export class CreateMessagesRequest { + "messages"?: Array; + /** + * A Twilio phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, an [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), or a [Channel Endpoint address](https://www.twilio.com/docs/sms/channels#channel-addresses) that is enabled for the type of message you want to send. Phone numbers or [short codes](https://www.twilio.com/docs/sms/api/short-code) purchased from Twilio also work here. You cannot, for example, spoof messages from a private cell phone number. If you are using `messaging_service_sid`, this parameter must be empty. + */ + "from"?: string; + /** + * The SID of the [Messaging Service](https://www.twilio.com/docs/sms/services#send-a-message-with-copilot) you want to associate with the Message. Set this parameter to use the [Messaging Service Settings and Copilot Features](https://www.twilio.com/console/sms/services) you have configured and leave the `from` parameter empty. When only this parameter is set, Twilio will use your enabled Copilot Features to select the `from` phone number for delivery. + */ + "messagingServiceSid"?: string; + /** + * The text of the message you want to send. Can be up to 1,600 characters in length. + */ + "body"?: string; + /** + * The SID of the preconfigured [Content Template](https://www.twilio.com/docs/content-api/create-and-send-your-first-content-api-template#create-a-template) you want to associate with the Message. Must be used in conjuction with a preconfigured [Messaging Service Settings and Copilot Features](https://www.twilio.com/console/sms/services) When this parameter is set, Twilio will use your configured content template and the provided `ContentVariables`. This Twilio product is currently in Private Beta. + */ + "contentSid"?: string; + /** + * The URL of the media to send with the message. The media can be of type `gif`, `png`, and `jpeg` and will be formatted correctly on the recipient\'s device. The media size limit is 5MB for supported file types (JPEG, PNG, GIF) and 500KB for [other types](https://www.twilio.com/docs/sms/accepted-mime-types) of accepted media. To send more than one image in the message body, provide multiple `media_url` parameters in the POST request. You can include up to 10 `media_url` parameters per message. You can send images in an SMS message in only the US and Canada. + */ + "mediaUrl"?: Array; + /** + * The URL we should call using the \"status_callback_method\" to send status information to your application. If specified, we POST these message status changes to the URL - queued, failed, sent, delivered, or undelivered. Twilio will POST its [standard request parameters](https://www.twilio.com/docs/messaging/twiml#request-parameters) as well as some additional parameters including \"MessageSid\", \"MessageStatus\", and \"ErrorCode\". If you include this parameter with the \"messaging_service_sid\", we use this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/services/api). URLs must contain a valid hostname and underscores are not allowed. + */ + "statusCallback"?: string; + /** + * How long in seconds the message can remain in our outgoing message queue. After this period elapses, the message fails and we call your status callback. Can be between 1 and the default value of 14,400 seconds. After a message has been accepted by a carrier, however, we cannot guarantee that the message will not be queued after this period. We recommend that this value be at least 5 seconds. + */ + "validityPeriod"?: number; + /** + * The time at which Twilio will send the message. This parameter can be used to schedule a message to be sent at a particular time. Must be in ISO 8601 format. + */ + "sendAt"?: string; + /** + * This parameter indicates your intent to schedule a message. Pass the value `fixed` to schedule a message at a fixed time. This parameter works in conjuction with the `SendAt` parameter. + */ + "scheduleType"?: string; + /** + * Determines the usage of Click Tracking. Setting it to `true` will instruct Twilio to replace all links in the Message with a shortened version based on the associated Domain Sid and track clicks on them. If this parameter is not set on an API call, we will use the value set on the Messaging Service. If this parameter is not set and the value is not configured on the Messaging Service used this will default to `false`. + */ + "shortenUrls"?: boolean; + /** + * If set to True, Twilio will deliver the message as a single MMS message, regardless of the presence of media. + */ + "sendAsMms"?: boolean; + /** + * The maximum total price in US dollars that you will pay for the message to be delivered. Can be a decimal value that has up to 4 decimal places. All messages are queued for delivery and the message cost is checked before the message is sent. If the cost exceeds max_price, the message will fail and a status of Failed is sent to the status callback. If MaxPrice is not set, the message cost is not checked. + */ + "maxPrice"?: number; + /** + * Total number of attempts made ( including this ) to send out the message regardless of the provider used + */ + "attempt"?: number; + /** + * This parameter indicates whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be true or false. + */ + "smartEncoded"?: boolean; + /** + * This parameter allows Twilio to send SMS traffic to carriers without checking/caring whether the destination number is a mobile or a landline. + */ + "forceDelivery"?: boolean; + /** + * The SID of the application that should receive message status. We POST a message_sid parameter and a message_status parameter with a value of sent or failed to the application\'s message_status_callback. If a status_callback parameter is also passed, it will be ignored and the application\'s message_status_callback parameter will be used. + */ + "applicationSid"?: string; +} + +export class MessagingV1FailedMessageReceipt { + /** + * The recipient phone number + */ + "to"?: string; + /** + * The description of the error_code + */ + "errorMessage"?: string; + /** + * The error code associated with the message creation attempt + */ + "errorCode"?: number; +} + +export class MessagingV1Message { + /** + * The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format for SMS/MMS or [Channel user address](https://www.twilio.com/docs/sms/channels#channel-addresses) for other 3rd-party channels. + */ + "to"?: string; + /** + * The text of the message you want to send. Can be up to 1,600 characters in length. Overrides the request-level body and content template if provided. + */ + "body"?: string; + /** + * Key-value pairs of variable names to substitution values. Refer to the [Twilio Content API Resources](https://www.twilio.com/docs/content-api/content-api-resources#send-a-message-with-preconfigured-content) for more details. + */ + "contentVariables"?: { [key: string]: string }; +} + +export class MessagingV1MessageReceipt { + /** + * The recipient phone number + */ + "to"?: string | null; + /** + * The unique string that identifies the resource + */ + "sid"?: string | null; +} + +/** + * Options to pass to create a MessageInstance + */ +export interface MessageListInstanceCreateOptions { + /** */ + createMessagesRequest: CreateMessagesRequest; +} + +export interface MessageSolution {} + +export interface MessageListInstance { + _version: V1; + _solution: MessageSolution; + _uri: string; + + /** + * Create a MessageInstance + * + * @param params - Body for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed MessageInstance + */ + create( + params: CreateMessagesRequest, + callback?: (error: Error | null, item?: MessageInstance) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function MessageListInstance(version: V1): MessageListInstance { + const instance = {} as MessageListInstance; + + instance._version = version; + instance._solution = {}; + instance._uri = `/Messages`; + + instance.create = function create( + params: CreateMessagesRequest, + callback?: (error: Error | null, items: MessageInstance) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + let data: any = {}; + + data = params; + + const headers: any = {}; + headers["Content-Type"] = "application/json"; + + let operationVersion = version, + operationPromise = operationVersion.create({ + uri: instance._uri, + method: "post", + data, + headers, + }); + + operationPromise = operationPromise.then( + (payload) => new MessageInstance(operationVersion, payload) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + }; + + instance.toJSON = function toJSON() { + return instance._solution; + }; + + instance[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +} + +interface MessagePayload extends MessageResource {} + +interface MessageResource { + total_message_count: number; + success_count: number; + error_count: number; + message_receipts: Array; + failed_message_receipts: Array; +} + +export class MessageInstance { + constructor(protected _version: V1, payload: MessageResource) { + this.totalMessageCount = deserialize.integer(payload.total_message_count); + this.successCount = deserialize.integer(payload.success_count); + this.errorCount = deserialize.integer(payload.error_count); + this.messageReceipts = payload.message_receipts; + this.failedMessageReceipts = payload.failed_message_receipts; + } + + /** + * The number of Messages processed in the request, equal to the sum of success_count and error_count. + */ + totalMessageCount: number; + /** + * The number of Messages successfully created. + */ + successCount: number; + /** + * The number of Messages unsuccessfully processed in the request. + */ + errorCount: number; + messageReceipts: Array; + failedMessageReceipts: Array; + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + totalMessageCount: this.totalMessageCount, + successCount: this.successCount, + errorCount: this.errorCount, + messageReceipts: this.messageReceipts, + failedMessageReceipts: this.failedMessageReceipts, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} diff --git a/src/rest/serverless/v1/service/build.ts b/src/rest/serverless/v1/service/build.ts index 0efb47b65..548d93fb7 100644 --- a/src/rest/serverless/v1/service/build.ts +++ b/src/rest/serverless/v1/service/build.ts @@ -21,7 +21,13 @@ const serialize = require("../../../../base/serialize"); import { isValidPathParam } from "../../../../base/utility"; import { BuildStatusListInstance } from "./build/buildStatus"; -export type BuildRuntime = "node8" | "node10" | "node12" | "node14" | "node16"; +export type BuildRuntime = + | "node8" + | "node10" + | "node12" + | "node14" + | "node16" + | "node18"; export type BuildStatus = "building" | "completed" | "failed"; diff --git a/src/rest/trusthub/V1.ts b/src/rest/trusthub/V1.ts index 19fdb9379..a6abf9249 100644 --- a/src/rest/trusthub/V1.ts +++ b/src/rest/trusthub/V1.ts @@ -15,6 +15,7 @@ import TrusthubBase from "../TrusthubBase"; import Version from "../../base/Version"; import { ComplianceInquiriesListInstance } from "./v1/complianceInquiries"; +import { ComplianceTollfreeInquiriesListInstance } from "./v1/complianceTollfreeInquiries"; import { CustomerProfilesListInstance } from "./v1/customerProfiles"; import { EndUserListInstance } from "./v1/endUser"; import { EndUserTypeListInstance } from "./v1/endUserType"; @@ -35,6 +36,8 @@ export default class V1 extends Version { /** complianceInquiries - { Twilio.Trusthub.V1.ComplianceInquiriesListInstance } resource */ protected _complianceInquiries?: ComplianceInquiriesListInstance; + /** complianceTollfreeInquiries - { Twilio.Trusthub.V1.ComplianceTollfreeInquiriesListInstance } resource */ + protected _complianceTollfreeInquiries?: ComplianceTollfreeInquiriesListInstance; /** customerProfiles - { Twilio.Trusthub.V1.CustomerProfilesListInstance } resource */ protected _customerProfiles?: CustomerProfilesListInstance; /** endUsers - { Twilio.Trusthub.V1.EndUserListInstance } resource */ @@ -57,6 +60,14 @@ export default class V1 extends Version { return this._complianceInquiries; } + /** Getter for complianceTollfreeInquiries resource */ + get complianceTollfreeInquiries(): ComplianceTollfreeInquiriesListInstance { + this._complianceTollfreeInquiries = + this._complianceTollfreeInquiries || + ComplianceTollfreeInquiriesListInstance(this); + return this._complianceTollfreeInquiries; + } + /** Getter for customerProfiles resource */ get customerProfiles(): CustomerProfilesListInstance { this._customerProfiles = diff --git a/src/rest/trusthub/v1/complianceTollfreeInquiries.ts b/src/rest/trusthub/v1/complianceTollfreeInquiries.ts new file mode 100644 index 000000000..a373c5491 --- /dev/null +++ b/src/rest/trusthub/v1/complianceTollfreeInquiries.ts @@ -0,0 +1,341 @@ +/* + * 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. + */ + +import { inspect, InspectOptions } from "util"; +import V1 from "../V1"; +const deserialize = require("../../../base/deserialize"); +const serialize = require("../../../base/serialize"); +import { isValidPathParam } from "../../../base/utility"; + +/** + * Options to pass to update a ComplianceTollfreeInquiriesInstance + */ +export interface ComplianceTollfreeInquiriesContextUpdateOptions { + /** The Tollfree phone number to be verified */ + did: string; +} + +/** + * Options to pass to create a ComplianceTollfreeInquiriesInstance + */ +export interface ComplianceTollfreeInquiriesListInstanceCreateOptions { + /** The Tollfree phone number to be verified */ + did: string; +} + +export interface ComplianceTollfreeInquiriesContext { + /** + * Update a ComplianceTollfreeInquiriesInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ComplianceTollfreeInquiriesInstance + */ + update( + params: ComplianceTollfreeInquiriesContextUpdateOptions, + callback?: ( + error: Error | null, + item?: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export interface ComplianceTollfreeInquiriesContextSolution { + tollfreeId: string; +} + +export class ComplianceTollfreeInquiriesContextImpl + implements ComplianceTollfreeInquiriesContext +{ + protected _solution: ComplianceTollfreeInquiriesContextSolution; + protected _uri: string; + + constructor(protected _version: V1, tollfreeId: string) { + if (!isValidPathParam(tollfreeId)) { + throw new Error("Parameter 'tollfreeId' is not valid."); + } + + this._solution = { tollfreeId }; + this._uri = `/ComplianceInquiries/Tollfree/${tollfreeId}/Initialize`; + } + + update( + params: ComplianceTollfreeInquiriesContextUpdateOptions, + callback?: ( + error: Error | null, + item?: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + if (params["did"] === null || params["did"] === undefined) { + throw new Error("Required parameter \"params['did']\" missing."); + } + + let data: any = {}; + + data["Did"] = params["did"]; + + const headers: any = {}; + 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 ComplianceTollfreeInquiriesInstance( + operationVersion, + payload, + instance._solution.tollfreeId + ) + ); + + operationPromise = instance._version.setPromiseCallback( + operationPromise, + callback + ); + return operationPromise; + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return this._solution; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +interface ComplianceTollfreeInquiriesPayload + extends ComplianceTollfreeInquiriesResource {} + +interface ComplianceTollfreeInquiriesResource { + inquiry_id: string; + inquiry_session_token: string; + tollfree_id: string; + url: string; +} + +export class ComplianceTollfreeInquiriesInstance { + protected _solution: ComplianceTollfreeInquiriesContextSolution; + protected _context?: ComplianceTollfreeInquiriesContext; + + constructor( + protected _version: V1, + payload: ComplianceTollfreeInquiriesResource, + tollfreeId?: string + ) { + this.inquiryId = payload.inquiry_id; + this.inquirySessionToken = payload.inquiry_session_token; + this.tollfreeId = payload.tollfree_id; + this.url = payload.url; + + this._solution = { tollfreeId: tollfreeId || this.tollfreeId }; + } + + /** + * 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. + */ + tollfreeId: string; + /** + * The URL of this resource. + */ + url: string; + + private get _proxy(): ComplianceTollfreeInquiriesContext { + this._context = + this._context || + new ComplianceTollfreeInquiriesContextImpl( + this._version, + this._solution.tollfreeId + ); + return this._context; + } + + /** + * Update a ComplianceTollfreeInquiriesInstance + * + * @param params - Parameter for request + * @param callback - Callback to handle processed record + * + * @returns Resolves to processed ComplianceTollfreeInquiriesInstance + */ + update( + params: ComplianceTollfreeInquiriesContextUpdateOptions, + callback?: ( + error: Error | null, + item?: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise; + + update( + params?: any, + callback?: ( + error: Error | null, + item?: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise { + return this._proxy.update(params, callback); + } + + /** + * Provide a user-friendly representation + * + * @returns Object + */ + toJSON() { + return { + inquiryId: this.inquiryId, + inquirySessionToken: this.inquirySessionToken, + tollfreeId: this.tollfreeId, + url: this.url, + }; + } + + [inspect.custom](_depth: any, options: InspectOptions) { + return inspect(this.toJSON(), options); + } +} + +export interface ComplianceTollfreeInquiriesSolution {} + +export interface ComplianceTollfreeInquiriesListInstance { + _version: V1; + _solution: ComplianceTollfreeInquiriesSolution; + _uri: string; + + (tollfreeId: string): ComplianceTollfreeInquiriesContext; + get(tollfreeId: string): ComplianceTollfreeInquiriesContext; + + /** + * 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; + + /** + * Provide a user-friendly representation + */ + toJSON(): any; + [inspect.custom](_depth: any, options: InspectOptions): any; +} + +export function ComplianceTollfreeInquiriesListInstance( + version: V1 +): ComplianceTollfreeInquiriesListInstance { + const instance = ((tollfreeId) => + instance.get(tollfreeId)) as ComplianceTollfreeInquiriesListInstance; + + instance.get = function get(tollfreeId): ComplianceTollfreeInquiriesContext { + return new ComplianceTollfreeInquiriesContextImpl(version, tollfreeId); + }; + + instance._version = version; + instance._solution = {}; + instance._uri = `/ComplianceInquiries/Tollfree/Initialize`; + + instance.create = function create( + params: ComplianceTollfreeInquiriesListInstanceCreateOptions, + callback?: ( + error: Error | null, + items: ComplianceTollfreeInquiriesInstance + ) => any + ): Promise { + if (params === null || params === undefined) { + throw new Error('Required parameter "params" missing.'); + } + + if (params["did"] === null || params["did"] === undefined) { + throw new Error("Required parameter \"params['did']\" missing."); + } + + let data: any = {}; + + data["Did"] = params["did"]; + + const headers: any = {}; + 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[inspect.custom] = function inspectImpl( + _depth: any, + options: InspectOptions + ) { + return inspect(instance.toJSON(), options); + }; + + return instance; +}