From b0c38d793b7baf1316a043cdc2ea6198c003a640 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 13 Oct 2023 15:43:17 +0530 Subject: [PATCH 01/14] fix: added support for application/json body (#968) --- src/base/RequestClient.ts | 9 +++++++-- src/rest/PreviewMessaging.ts | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/rest/PreviewMessaging.ts diff --git a/src/base/RequestClient.ts b/src/base/RequestClient.ts index 002f2866e4..f48b00b13f 100644 --- a/src/base/RequestClient.ts +++ b/src/base/RequestClient.ts @@ -190,8 +190,13 @@ class RequestClient { validateStatus: (status) => status >= 100 && status < 600, }; - if (opts.data) { - options.data = qs.stringify(opts.data, { arrayFormat: "repeat" }); + if (opts.data && options.headers) { + 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") { + options.data = opts.data; + } } if (opts.params) { diff --git a/src/rest/PreviewMessaging.ts b/src/rest/PreviewMessaging.ts new file mode 100644 index 0000000000..3569a2ae8d --- /dev/null +++ b/src/rest/PreviewMessaging.ts @@ -0,0 +1,15 @@ +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 38a8afe6c93e76f88f309ca8532c82d7d733c3a7 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 17 Oct 2023 12:32:31 +0530 Subject: [PATCH 02/14] chore: Updated change logs for RC release --- CHANGES.md | 4 ++++ UPGRADE.md | 10 ++++++++++ package.json | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index e9169a632d..4af9ef19d2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,10 @@ twilio-node changelog ===================== +[2023-10-17] Version 5.0.0-rc.0 +--------------------------- +- Release Candidate preparation + [2023-10-05] Version 4.18.1 --------------------------- **Library - Fix** diff --git a/UPGRADE.md b/UPGRADE.md index 7c8df9ba90..79bd6c88e4 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -2,6 +2,16 @@ _All `MAJOR` version bumps will have upgrade notes posted here._ +## [2023-01-25] 4.x.x to 5.x.x + +--- +### Overview + +#### Twilio Node Helper Library’s major version 5.0.0-rc.x is now available. We ensured that you can upgrade to Node helper Library 5.0.0-rc.x version without any breaking changes + +Support for JSON payloads has been added in the request body + + ## [2023-01-25] 3.x.x to 4.x.x --- diff --git a/package.json b/package.json index 19b350f4ae..8547a345e6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "twilio", "description": "A Twilio helper library", - "version": "4.18.1", + "version": "5.0.0-rc.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 03/14] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 4af9ef19d2..780fe0a90c 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 04/14] Update UPGRADE.md --- UPGRADE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADE.md b/UPGRADE.md index 79bd6c88e4..81080957d6 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 05/14] 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 780fe0a90c..4af9ef19d2 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 81080957d6..2fbfd54cd3 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 06/14] 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 3569a2ae8d..0000000000 --- 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 47ac32f7b2d0ff8e881175a57513ee6e58d178b4 Mon Sep 17 00:00:00 2001 From: Shubham Date: Tue, 7 Nov 2023 15:52:59 +0530 Subject: [PATCH 07/14] 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 760cac0d8f..ad07a0db9a 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 f86bda2a27..44504c27b8 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 f48b00b13f..263c443248 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 0000000000..dc598c3a77 --- /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 0000000000..44e88ea83a --- /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 fd203e280f..153a8a2c35 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 0000000000..24abfc729b --- /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 fc64bf2aac..e167dce110 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 b5a6f4b1eb..caddf98dc1 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 0000000000..e30d2a40ca --- /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 0000000000..099f613895 --- /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 0000000000..8ba125715c --- /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 0efb47b657..548d93fb70 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 19fdb93795..a6abf92499 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 0000000000..a373c5491a --- /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 e7bbeb18ddcec8b0874326266b6c73d4e2a073f3 Mon Sep 17 00:00:00 2001 From: Shubham Date: Thu, 9 Nov 2023 13:37:50 +0530 Subject: [PATCH 08/14] chore: Removed LTS version (#978) * chore: removed LTS version * chore: removing lts from cloudscan * chore: completely removed LTS --- .github/workflows/test-and-deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 760cac0d8f..ad07a0db9a 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 From a981eb0266674ecc165e9fa460e2b81c8c6daa1b Mon Sep 17 00:00:00 2001 From: Andrew Pietila <149612764+kitu-apietila@users.noreply.github.com> Date: Thu, 9 Nov 2023 02:23:34 -0600 Subject: [PATCH 09/14] chore: Update axios to 1.6 to pull in fix for CVE 2023 45857 (#971) * Update axios to 1.6.0 Fixes CVE-2023-45857 * Explicit type return on Promise TypeScript's automatic type resolution for the promise returned by the function in getExponentialBackoffResponseHandler determines that it returns a Promise. This commit forces TypeScript to recognize that the resolved object is of type Promise. --------- Co-authored-by: Shubham --- package.json | 2 +- src/base/RequestClient.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 87814fbf9a..c9cd632fd5 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "url": "https://github.com/twilio/twilio-node.git" }, "dependencies": { - "axios": "^0.26.1", + "axios": "^1.6.0", "dayjs": "^1.11.9", "https-proxy-agent": "^5.0.0", "jsonwebtoken": "^9.0.0", diff --git a/src/base/RequestClient.ts b/src/base/RequestClient.ts index 002f2866e4..3d573e26b1 100644 --- a/src/base/RequestClient.ts +++ b/src/base/RequestClient.ts @@ -57,7 +57,7 @@ function getExponentialBackoffResponseHandler( ); const delay = Math.floor(baseDelay * Math.random()); // Full jitter backoff - return new Promise((resolve) => { + return new Promise((resolve: (value: Promise) => void) => { setTimeout(() => resolve(axios(config)), delay); }); } From 67c54fdbca95d28fa58c94e82780cf0fd53f458c Mon Sep 17 00:00:00 2001 From: Shubham Date: Thu, 9 Nov 2023 14:04:45 +0530 Subject: [PATCH 10/14] chore: Updated change logs for RC release (#969) * chore: Updated change logs for RC release * chore: upgrade to rc --- UPGRADE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADE.md b/UPGRADE.md index 2fbfd54cd3..446d529338 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -2,7 +2,7 @@ _All `MAJOR` version bumps will have upgrade notes posted here._ -## [2023-10-17] 4.x.x to 5.x.x +## [2023-10-17] 4.x.x to 5.x.x-rc.x --- ### Overview From 23eca5645571da1c293095eca511f4361ab1fb37 Mon Sep 17 00:00:00 2001 From: kridai Date: Thu, 9 Nov 2023 14:15:16 +0530 Subject: [PATCH 11/14] chore: twilio help changes (#958) Co-authored-by: Shubham --- CONTRIBUTING.md | 2 +- LICENSE | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 171e93b925..b008f1fe57 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ it can be. If you have questions about how to use `twilio-node`, please see our [docs](./README.md), and if you don't find the answer there, please contact -[help@twilio.com](mailto:help@twilio.com) with any issues you have. +[Twilio Support](https://www.twilio.com/help/contact) with any issues you have. ## Found an Issue? diff --git a/LICENSE b/LICENSE index ca16167a61..6485c1f845 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (C) 2023, Twilio, Inc. +Copyright (C) 2023, Twilio, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From ce0804c5e1fb8f6d21026aba3858b3e1ac319521 Mon Sep 17 00:00:00 2001 From: KobeBrooks <55289738+KobeBrooks@users.noreply.github.com> Date: Thu, 9 Nov 2023 07:16:49 -0500 Subject: [PATCH 12/14] chore: Removing Test Related To Deprecated Endpoint - OAuth (#963) * removing test in relation to deprecated endpoint * removingn more oauth refrences --------- Co-authored-by: sbansla <104902068+sbansla@users.noreply.github.com> --- src/rest/Oauth.ts | 52 ------ src/rest/OauthBase.ts | 33 ---- src/rest/Twilio.ts | 8 - src/rest/oauth/V1.ts | 74 -------- src/rest/oauth/v1/deviceCode.ts | 192 ------------------- src/rest/oauth/v1/oauth.ts | 185 ------------------- src/rest/oauth/v1/openidDiscovery.ts | 266 --------------------------- src/rest/oauth/v1/token.ts | 204 -------------------- src/rest/oauth/v1/userInfo.ts | 213 --------------------- 9 files changed, 1227 deletions(-) delete mode 100644 src/rest/Oauth.ts delete mode 100644 src/rest/OauthBase.ts delete mode 100644 src/rest/oauth/V1.ts delete mode 100644 src/rest/oauth/v1/deviceCode.ts delete mode 100644 src/rest/oauth/v1/oauth.ts delete mode 100644 src/rest/oauth/v1/openidDiscovery.ts delete mode 100644 src/rest/oauth/v1/token.ts delete mode 100644 src/rest/oauth/v1/userInfo.ts diff --git a/src/rest/Oauth.ts b/src/rest/Oauth.ts deleted file mode 100644 index 5e0708b239..0000000000 --- a/src/rest/Oauth.ts +++ /dev/null @@ -1,52 +0,0 @@ -import OauthBase from "./OauthBase"; -import { OauthListInstance } from "./oauth/v1/oauth"; -import { DeviceCodeListInstance } from "./oauth/v1/deviceCode"; -import { OpenidDiscoveryListInstance } from "./oauth/v1/openidDiscovery"; -import { TokenListInstance } from "./oauth/v1/token"; -import { UserInfoListInstance } from "./oauth/v1/userInfo"; - -class Oauth extends OauthBase { - /** - * @deprecated - Use v1.deviceCode instead - */ - get deviceCode(): DeviceCodeListInstance { - console.warn("deviceCode is deprecated. Use v1.deviceCode instead."); - return this.v1.deviceCode; - } - - /** - * @deprecated - Use v1.oauth instead - */ - get oauth(): OauthListInstance { - console.warn("oauth is deprecated. Use v1.oauth instead."); - return this.v1.oauth; - } - - /** - * @deprecated - Use v1.openidDiscovery instead - */ - get openidDiscovery(): OpenidDiscoveryListInstance { - console.warn( - "openidDiscovery is deprecated. Use v1.openidDiscovery instead." - ); - return this.v1.openidDiscovery; - } - - /** - * @deprecated - Use v1.token instead - */ - get token(): TokenListInstance { - console.warn("token is deprecated. Use v1.token instead."); - return this.v1.token; - } - - /** - * @deprecated - Use v1.userInfo instead - */ - get userInfo(): UserInfoListInstance { - console.warn("userInfo is deprecated. Use v1.userInfo instead."); - return this.v1.userInfo; - } -} - -export = Oauth; diff --git a/src/rest/OauthBase.ts b/src/rest/OauthBase.ts deleted file mode 100644 index 513dd037f3..0000000000 --- a/src/rest/OauthBase.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 "./oauth/V1"; - -class OauthBase extends Domain { - _v1?: V1; - - /** - * Initialize oauth domain - * - * @param twilio - The twilio client - */ - constructor(twilio: any) { - super(twilio, "https://oauth.twilio.com"); - } - - get v1(): V1 { - this._v1 = this._v1 || new V1(this); - return this._v1; - } -} - -export = OauthBase; diff --git a/src/rest/Twilio.ts b/src/rest/Twilio.ts index 1a21d3a500..3543d11e94 100644 --- a/src/rest/Twilio.ts +++ b/src/rest/Twilio.ts @@ -30,7 +30,6 @@ import Microvisor from "./Microvisor"; import Monitor from "./Monitor"; import Notify from "./Notify"; import Numbers from "./Numbers"; -import Oauth from "./Oauth"; import Preview from "./Preview"; import Pricing from "./Pricing"; import Proxy from "./Proxy"; @@ -118,8 +117,6 @@ class Twilio extends Client { _notify?: Notify; /** (Twilio.Numbers) - numbers domain */ _numbers?: Numbers; - /** (Twilio.Oauth) - oauth domain */ - _oauth?: Oauth; /** (Twilio.Preview) - preview domain */ _preview?: Preview; /** (Twilio.Pricing) - pricing domain */ @@ -188,7 +185,6 @@ class Twilio extends Client { this.monitor; this.notify; this.numbers; - this.oauth; this.preview; this.pricing; this.proxy; @@ -314,10 +310,6 @@ class Twilio extends Client { get numbers(): Numbers { return this._numbers ?? (this._numbers = new (require("./Numbers"))(this)); } - /** Getter for (Twilio.Oauth) domain */ - get oauth(): Oauth { - return this._oauth ?? (this._oauth = new (require("./Oauth"))(this)); - } /** Getter for (Twilio.Preview) domain */ get preview(): Preview { return this._preview ?? (this._preview = new (require("./Preview"))(this)); diff --git a/src/rest/oauth/V1.ts b/src/rest/oauth/V1.ts deleted file mode 100644 index ab2759f368..0000000000 --- a/src/rest/oauth/V1.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import OauthBase from "../OauthBase"; -import Version from "../../base/Version"; -import { DeviceCodeListInstance } from "./v1/deviceCode"; -import { OauthListInstance } from "./v1/oauth"; -import { OpenidDiscoveryListInstance } from "./v1/openidDiscovery"; -import { TokenListInstance } from "./v1/token"; -import { UserInfoListInstance } from "./v1/userInfo"; - -export default class V1 extends Version { - /** - * Initialize the V1 version of Oauth - * - * @param domain - The Twilio (Twilio.Oauth) domain - */ - constructor(domain: OauthBase) { - super(domain, "v1"); - } - - /** deviceCode - { Twilio.Oauth.V1.DeviceCodeListInstance } resource */ - protected _deviceCode?: DeviceCodeListInstance; - /** oauth - { Twilio.Oauth.V1.OauthListInstance } resource */ - protected _oauth?: OauthListInstance; - /** openidDiscovery - { Twilio.Oauth.V1.OpenidDiscoveryListInstance } resource */ - protected _openidDiscovery?: OpenidDiscoveryListInstance; - /** token - { Twilio.Oauth.V1.TokenListInstance } resource */ - protected _token?: TokenListInstance; - /** userInfo - { Twilio.Oauth.V1.UserInfoListInstance } resource */ - protected _userInfo?: UserInfoListInstance; - - /** Getter for deviceCode resource */ - get deviceCode(): DeviceCodeListInstance { - this._deviceCode = this._deviceCode || DeviceCodeListInstance(this); - return this._deviceCode; - } - - /** Getter for oauth resource */ - get oauth(): OauthListInstance { - this._oauth = this._oauth || OauthListInstance(this); - return this._oauth; - } - - /** Getter for openidDiscovery resource */ - get openidDiscovery(): OpenidDiscoveryListInstance { - this._openidDiscovery = - this._openidDiscovery || OpenidDiscoveryListInstance(this); - return this._openidDiscovery; - } - - /** Getter for token resource */ - get token(): TokenListInstance { - this._token = this._token || TokenListInstance(this); - return this._token; - } - - /** Getter for userInfo resource */ - get userInfo(): UserInfoListInstance { - this._userInfo = this._userInfo || UserInfoListInstance(this); - return this._userInfo; - } -} diff --git a/src/rest/oauth/v1/deviceCode.ts b/src/rest/oauth/v1/deviceCode.ts deleted file mode 100644 index da60047a46..0000000000 --- a/src/rest/oauth/v1/deviceCode.ts +++ /dev/null @@ -1,192 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 create a DeviceCodeInstance - */ -export interface DeviceCodeListInstanceCreateOptions { - /** A 34 character string that uniquely identifies this OAuth App. */ - clientSid: string; - /** An Array of scopes for authorization request */ - scopes: Array; - /** An array of intended audiences for token requests */ - audiences?: Array; -} - -export interface DeviceCodeSolution {} - -export interface DeviceCodeListInstance { - _version: V1; - _solution: DeviceCodeSolution; - _uri: string; - - /** - * Create a DeviceCodeInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceCodeInstance - */ - create( - params: DeviceCodeListInstanceCreateOptions, - callback?: (error: Error | null, item?: DeviceCodeInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function DeviceCodeListInstance(version: V1): DeviceCodeListInstance { - const instance = {} as DeviceCodeListInstance; - - instance._version = version; - instance._solution = {}; - instance._uri = `/device/code`; - - instance.create = function create( - params: DeviceCodeListInstanceCreateOptions, - callback?: (error: Error | null, items: DeviceCodeInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["clientSid"] === null || params["clientSid"] === undefined) { - throw new Error("Required parameter \"params['clientSid']\" missing."); - } - - if (params["scopes"] === null || params["scopes"] === undefined) { - throw new Error("Required parameter \"params['scopes']\" missing."); - } - - let data: any = {}; - - data["ClientSid"] = params["clientSid"]; - - data["Scopes"] = serialize.map(params["scopes"], (e: string) => e); - if (params["audiences"] !== undefined) - data["Audiences"] = serialize.map(params["audiences"], (e: string) => e); - - 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 DeviceCodeInstance(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 DeviceCodePayload extends DeviceCodeResource {} - -interface DeviceCodeResource { - device_code: string; - user_code: string; - verification_uri: string; - verification_uri_complete: string; - expires_in: number; - interval: number; -} - -export class DeviceCodeInstance { - constructor(protected _version: V1, payload: DeviceCodeResource) { - this.deviceCode = payload.device_code; - this.userCode = payload.user_code; - this.verificationUri = payload.verification_uri; - this.verificationUriComplete = payload.verification_uri_complete; - this.expiresIn = payload.expires_in; - this.interval = deserialize.integer(payload.interval); - } - - /** - * The device verification code. - */ - deviceCode: string; - /** - * The verification code which end user uses to verify authorization request. - */ - userCode: string; - /** - * The URI that the end user visits to verify authorization request. - */ - verificationUri: string; - /** - * The URI with user_code that the end-user alternatively visits to verify authorization request. - */ - verificationUriComplete: string; - /** - * The expiration time of the device_code and user_code in seconds. - */ - expiresIn: number; - /** - * The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint. - */ - interval: number; - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - deviceCode: this.deviceCode, - userCode: this.userCode, - verificationUri: this.verificationUri, - verificationUriComplete: this.verificationUriComplete, - expiresIn: this.expiresIn, - interval: this.interval, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/oauth/v1/oauth.ts b/src/rest/oauth/v1/oauth.ts deleted file mode 100644 index 7752f30008..0000000000 --- a/src/rest/oauth/v1/oauth.ts +++ /dev/null @@ -1,185 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 interface OauthContext { - /** - * Fetch a OauthInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OauthInstance - */ - fetch( - callback?: (error: Error | null, item?: OauthInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface OauthContextSolution {} - -export class OauthContextImpl implements OauthContext { - protected _solution: OauthContextSolution; - protected _uri: string; - - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/certs`; - } - - fetch( - callback?: (error: Error | null, item?: OauthInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => new OauthInstance(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 OauthPayload extends OauthResource {} - -interface OauthResource { - keys: any; - url: string; -} - -export class OauthInstance { - protected _solution: OauthContextSolution; - protected _context?: OauthContext; - - constructor(protected _version: V1, payload: OauthResource) { - this.keys = payload.keys; - this.url = payload.url; - - this._solution = {}; - } - - /** - * A collection of certificates where are signed Twilio-issued tokens. - */ - keys: any; - url: string; - - private get _proxy(): OauthContext { - this._context = this._context || new OauthContextImpl(this._version); - return this._context; - } - - /** - * Fetch a OauthInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OauthInstance - */ - fetch( - callback?: (error: Error | null, item?: OauthInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - keys: this.keys, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface OauthSolution {} - -export interface OauthListInstance { - _version: V1; - _solution: OauthSolution; - _uri: string; - - (): OauthContext; - get(): OauthContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function OauthListInstance(version: V1): OauthListInstance { - const instance = (() => instance.get()) as OauthListInstance; - - instance.get = function get(): OauthContext { - return new OauthContextImpl(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/oauth/v1/openidDiscovery.ts b/src/rest/oauth/v1/openidDiscovery.ts deleted file mode 100644 index 24b8aa9a9f..0000000000 --- a/src/rest/oauth/v1/openidDiscovery.ts +++ /dev/null @@ -1,266 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 interface OpenidDiscoveryContext { - /** - * Fetch a OpenidDiscoveryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OpenidDiscoveryInstance - */ - fetch( - callback?: (error: Error | null, item?: OpenidDiscoveryInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface OpenidDiscoveryContextSolution {} - -export class OpenidDiscoveryContextImpl implements OpenidDiscoveryContext { - protected _solution: OpenidDiscoveryContextSolution; - protected _uri: string; - - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/.well-known/openid-configuration`; - } - - fetch( - callback?: (error: Error | null, item?: OpenidDiscoveryInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => new OpenidDiscoveryInstance(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 OpenidDiscoveryPayload extends OpenidDiscoveryResource {} - -interface OpenidDiscoveryResource { - issuer: string; - authorization_endpoint: string; - device_authorization_endpoint: string; - token_endpoint: string; - userinfo_endpoint: string; - revocation_endpoint: string; - jwk_uri: string; - response_type_supported: Array; - subject_type_supported: Array; - id_token_signing_alg_values_supported: Array; - scopes_supported: Array; - claims_supported: Array; - url: string; -} - -export class OpenidDiscoveryInstance { - protected _solution: OpenidDiscoveryContextSolution; - protected _context?: OpenidDiscoveryContext; - - constructor(protected _version: V1, payload: OpenidDiscoveryResource) { - this.issuer = payload.issuer; - this.authorizationEndpoint = payload.authorization_endpoint; - this.deviceAuthorizationEndpoint = payload.device_authorization_endpoint; - this.tokenEndpoint = payload.token_endpoint; - this.userinfoEndpoint = payload.userinfo_endpoint; - this.revocationEndpoint = payload.revocation_endpoint; - this.jwkUri = payload.jwk_uri; - this.responseTypeSupported = payload.response_type_supported; - this.subjectTypeSupported = payload.subject_type_supported; - this.idTokenSigningAlgValuesSupported = - payload.id_token_signing_alg_values_supported; - this.scopesSupported = payload.scopes_supported; - this.claimsSupported = payload.claims_supported; - this.url = payload.url; - - this._solution = {}; - } - - /** - * The URL of the party that will create the token and sign it with its private key. - */ - issuer: string; - /** - * The endpoint that validates all authorization requests. - */ - authorizationEndpoint: string; - /** - * The endpoint that validates all device code related authorization requests. - */ - deviceAuthorizationEndpoint: string; - /** - * The URL of the token endpoint. After a client has received an authorization code, that code is presented to the token endpoint and exchanged for an identity token, an access token, and a refresh token. - */ - tokenEndpoint: string; - /** - * The URL of the user info endpoint, which returns user profile information to a client. Keep in mind that the user info endpoint returns only the information that has been requested. - */ - userinfoEndpoint: string; - /** - * The endpoint used to revoke access or refresh tokens issued by the authorization server. - */ - revocationEndpoint: string; - /** - * The URL of your JSON Web Key Set. This set is a collection of JSON Web Keys, a standard method for representing cryptographic keys in a JSON structure. - */ - jwkUri: string; - /** - * A collection of response type supported by authorization server. - */ - responseTypeSupported: Array; - /** - * A collection of subject by authorization server. - */ - subjectTypeSupported: Array; - /** - * A collection of JWS signing algorithms supported by authorization server to sign identity token. - */ - idTokenSigningAlgValuesSupported: Array; - /** - * A collection of scopes supported by authorization server for identity token - */ - scopesSupported: Array; - /** - * A collection of claims supported by authorization server for identity token - */ - claimsSupported: Array; - url: string; - - private get _proxy(): OpenidDiscoveryContext { - this._context = - this._context || new OpenidDiscoveryContextImpl(this._version); - return this._context; - } - - /** - * Fetch a OpenidDiscoveryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OpenidDiscoveryInstance - */ - fetch( - callback?: (error: Error | null, item?: OpenidDiscoveryInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - issuer: this.issuer, - authorizationEndpoint: this.authorizationEndpoint, - deviceAuthorizationEndpoint: this.deviceAuthorizationEndpoint, - tokenEndpoint: this.tokenEndpoint, - userinfoEndpoint: this.userinfoEndpoint, - revocationEndpoint: this.revocationEndpoint, - jwkUri: this.jwkUri, - responseTypeSupported: this.responseTypeSupported, - subjectTypeSupported: this.subjectTypeSupported, - idTokenSigningAlgValuesSupported: this.idTokenSigningAlgValuesSupported, - scopesSupported: this.scopesSupported, - claimsSupported: this.claimsSupported, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface OpenidDiscoverySolution {} - -export interface OpenidDiscoveryListInstance { - _version: V1; - _solution: OpenidDiscoverySolution; - _uri: string; - - (): OpenidDiscoveryContext; - get(): OpenidDiscoveryContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function OpenidDiscoveryListInstance( - version: V1 -): OpenidDiscoveryListInstance { - const instance = (() => instance.get()) as OpenidDiscoveryListInstance; - - instance.get = function get(): OpenidDiscoveryContext { - return new OpenidDiscoveryContextImpl(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/oauth/v1/token.ts b/src/rest/oauth/v1/token.ts deleted file mode 100644 index 918bb2576b..0000000000 --- a/src/rest/oauth/v1/token.ts +++ /dev/null @@ -1,204 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 create a TokenInstance - */ -export interface TokenListInstanceCreateOptions { - /** Grant type is a credential representing resource owner\\\'s authorization which can be used by client to obtain access token. */ - grantType: string; - /** A 34 character string that uniquely identifies this OAuth App. */ - clientSid: string; - /** The credential for confidential OAuth App. */ - clientSecret?: string; - /** JWT token related to the authorization code grant type. */ - code?: string; - /** A code which is generation cryptographically. */ - codeVerifier?: string; - /** JWT token related to the device code grant type. */ - deviceCode?: string; - /** JWT token related to the refresh token grant type. */ - refreshToken?: string; - /** The Id of the device associated with the token (refresh token). */ - deviceId?: string; -} - -export interface TokenSolution {} - -export interface TokenListInstance { - _version: V1; - _solution: TokenSolution; - _uri: string; - - /** - * Create a TokenInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TokenInstance - */ - create( - params: TokenListInstanceCreateOptions, - callback?: (error: Error | null, item?: TokenInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function TokenListInstance(version: V1): TokenListInstance { - const instance = {} as TokenListInstance; - - instance._version = version; - instance._solution = {}; - instance._uri = `/token`; - - instance.create = function create( - params: TokenListInstanceCreateOptions, - callback?: (error: Error | null, items: TokenInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["grantType"] === null || params["grantType"] === undefined) { - throw new Error("Required parameter \"params['grantType']\" missing."); - } - - if (params["clientSid"] === null || params["clientSid"] === undefined) { - throw new Error("Required parameter \"params['clientSid']\" missing."); - } - - let data: any = {}; - - data["GrantType"] = params["grantType"]; - - data["ClientSid"] = params["clientSid"]; - if (params["clientSecret"] !== undefined) - data["ClientSecret"] = params["clientSecret"]; - if (params["code"] !== undefined) data["Code"] = params["code"]; - if (params["codeVerifier"] !== undefined) - data["CodeVerifier"] = params["codeVerifier"]; - if (params["deviceCode"] !== undefined) - data["DeviceCode"] = params["deviceCode"]; - if (params["refreshToken"] !== undefined) - data["RefreshToken"] = params["refreshToken"]; - if (params["deviceId"] !== undefined) data["DeviceId"] = params["deviceId"]; - - 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 TokenInstance(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 TokenPayload extends TokenResource {} - -interface TokenResource { - access_token: string; - refresh_token: string; - id_token: string; - refresh_token_expires_at: Date; - access_token_expires_at: Date; -} - -export class TokenInstance { - constructor(protected _version: V1, payload: TokenResource) { - this.accessToken = payload.access_token; - this.refreshToken = payload.refresh_token; - this.idToken = payload.id_token; - this.refreshTokenExpiresAt = deserialize.iso8601DateTime( - payload.refresh_token_expires_at - ); - this.accessTokenExpiresAt = deserialize.iso8601DateTime( - payload.access_token_expires_at - ); - } - - /** - * Token which carries the necessary information to access a Twilio resource directly. - */ - accessToken: string; - /** - * Token which carries the information necessary to get a new access token. - */ - refreshToken: string; - idToken: string; - /** - * The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - refreshTokenExpiresAt: Date; - /** - * The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - accessTokenExpiresAt: Date; - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accessToken: this.accessToken, - refreshToken: this.refreshToken, - idToken: this.idToken, - refreshTokenExpiresAt: this.refreshTokenExpiresAt, - accessTokenExpiresAt: this.accessTokenExpiresAt, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/oauth/v1/userInfo.ts b/src/rest/oauth/v1/userInfo.ts deleted file mode 100644 index 5b974309b8..0000000000 --- a/src/rest/oauth/v1/userInfo.ts +++ /dev/null @@ -1,213 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 interface UserInfoContext { - /** - * Fetch a UserInfoInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed UserInfoInstance - */ - fetch( - callback?: (error: Error | null, item?: UserInfoInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface UserInfoContextSolution {} - -export class UserInfoContextImpl implements UserInfoContext { - protected _solution: UserInfoContextSolution; - protected _uri: string; - - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/userinfo`; - } - - fetch( - callback?: (error: Error | null, item?: UserInfoInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => new UserInfoInstance(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 UserInfoPayload extends UserInfoResource {} - -interface UserInfoResource { - user_sid: string; - first_name: string; - last_name: string; - friendly_name: string; - email: string; - url: string; -} - -export class UserInfoInstance { - protected _solution: UserInfoContextSolution; - protected _context?: UserInfoContext; - - constructor(protected _version: V1, payload: UserInfoResource) { - this.userSid = payload.user_sid; - this.firstName = payload.first_name; - this.lastName = payload.last_name; - this.friendlyName = payload.friendly_name; - this.email = payload.email; - this.url = payload.url; - - this._solution = {}; - } - - /** - * The URL of the party that will create the token and sign it with its private key. - */ - userSid: string; - /** - * The first name of the end-user. - */ - firstName: string; - /** - * The last name of the end-user. - */ - lastName: string; - /** - * The friendly name of the end-user. - */ - friendlyName: string; - /** - * The end-user\'s preferred email address. - */ - email: string; - url: string; - - private get _proxy(): UserInfoContext { - this._context = this._context || new UserInfoContextImpl(this._version); - return this._context; - } - - /** - * Fetch a UserInfoInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed UserInfoInstance - */ - fetch( - callback?: (error: Error | null, item?: UserInfoInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - userSid: this.userSid, - firstName: this.firstName, - lastName: this.lastName, - friendlyName: this.friendlyName, - email: this.email, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface UserInfoSolution {} - -export interface UserInfoListInstance { - _version: V1; - _solution: UserInfoSolution; - _uri: string; - - (): UserInfoContext; - get(): UserInfoContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function UserInfoListInstance(version: V1): UserInfoListInstance { - const instance = (() => instance.get()) as UserInfoListInstance; - - instance.get = function get(): UserInfoContext { - return new UserInfoContextImpl(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; -} From c61ed8f876e72870d62f172eeec194649b0124ff Mon Sep 17 00:00:00 2001 From: Shubham Date: Thu, 9 Nov 2023 17:53:43 +0530 Subject: [PATCH 13/14] chore: sync with main (#979) * chore: Removed LTS version (#978) * chore: removed LTS version * chore: removing lts from cloudscan * chore: completely removed LTS * chore: Update axios to 1.6 to pull in fix for CVE 2023 45857 (#971) * Update axios to 1.6.0 Fixes CVE-2023-45857 * Explicit type return on Promise TypeScript's automatic type resolution for the promise returned by the function in getExponentialBackoffResponseHandler determines that it returns a Promise. This commit forces TypeScript to recognize that the resolved object is of type Promise. --------- Co-authored-by: Shubham * chore: twilio help changes (#958) Co-authored-by: Shubham * chore: Removing Test Related To Deprecated Endpoint - OAuth (#963) * removing test in relation to deprecated endpoint * removingn more oauth refrences --------- Co-authored-by: sbansla <104902068+sbansla@users.noreply.github.com> --------- Co-authored-by: Andrew Pietila <149612764+kitu-apietila@users.noreply.github.com> Co-authored-by: kridai Co-authored-by: KobeBrooks <55289738+KobeBrooks@users.noreply.github.com> Co-authored-by: sbansla <104902068+sbansla@users.noreply.github.com> --- CONTRIBUTING.md | 2 +- LICENSE | 2 +- package.json | 2 +- src/base/RequestClient.ts | 2 +- src/rest/Oauth.ts | 52 ------ src/rest/OauthBase.ts | 33 ---- src/rest/Twilio.ts | 8 - src/rest/oauth/V1.ts | 74 -------- src/rest/oauth/v1/deviceCode.ts | 192 ------------------- src/rest/oauth/v1/oauth.ts | 185 ------------------- src/rest/oauth/v1/openidDiscovery.ts | 266 --------------------------- src/rest/oauth/v1/token.ts | 204 -------------------- src/rest/oauth/v1/userInfo.ts | 213 --------------------- 13 files changed, 4 insertions(+), 1231 deletions(-) delete mode 100644 src/rest/Oauth.ts delete mode 100644 src/rest/OauthBase.ts delete mode 100644 src/rest/oauth/V1.ts delete mode 100644 src/rest/oauth/v1/deviceCode.ts delete mode 100644 src/rest/oauth/v1/oauth.ts delete mode 100644 src/rest/oauth/v1/openidDiscovery.ts delete mode 100644 src/rest/oauth/v1/token.ts delete mode 100644 src/rest/oauth/v1/userInfo.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 171e93b925..b008f1fe57 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ it can be. If you have questions about how to use `twilio-node`, please see our [docs](./README.md), and if you don't find the answer there, please contact -[help@twilio.com](mailto:help@twilio.com) with any issues you have. +[Twilio Support](https://www.twilio.com/help/contact) with any issues you have. ## Found an Issue? diff --git a/LICENSE b/LICENSE index ca16167a61..6485c1f845 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (C) 2023, Twilio, Inc. +Copyright (C) 2023, Twilio, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/package.json b/package.json index a6b7cb1253..d18359e632 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "url": "https://github.com/twilio/twilio-node.git" }, "dependencies": { - "axios": "^0.26.1", + "axios": "^1.6.0", "dayjs": "^1.11.9", "https-proxy-agent": "^5.0.0", "jsonwebtoken": "^9.0.0", diff --git a/src/base/RequestClient.ts b/src/base/RequestClient.ts index 263c443248..a7d1c5531b 100644 --- a/src/base/RequestClient.ts +++ b/src/base/RequestClient.ts @@ -57,7 +57,7 @@ function getExponentialBackoffResponseHandler( ); const delay = Math.floor(baseDelay * Math.random()); // Full jitter backoff - return new Promise((resolve) => { + return new Promise((resolve: (value: Promise) => void) => { setTimeout(() => resolve(axios(config)), delay); }); } diff --git a/src/rest/Oauth.ts b/src/rest/Oauth.ts deleted file mode 100644 index 5e0708b239..0000000000 --- a/src/rest/Oauth.ts +++ /dev/null @@ -1,52 +0,0 @@ -import OauthBase from "./OauthBase"; -import { OauthListInstance } from "./oauth/v1/oauth"; -import { DeviceCodeListInstance } from "./oauth/v1/deviceCode"; -import { OpenidDiscoveryListInstance } from "./oauth/v1/openidDiscovery"; -import { TokenListInstance } from "./oauth/v1/token"; -import { UserInfoListInstance } from "./oauth/v1/userInfo"; - -class Oauth extends OauthBase { - /** - * @deprecated - Use v1.deviceCode instead - */ - get deviceCode(): DeviceCodeListInstance { - console.warn("deviceCode is deprecated. Use v1.deviceCode instead."); - return this.v1.deviceCode; - } - - /** - * @deprecated - Use v1.oauth instead - */ - get oauth(): OauthListInstance { - console.warn("oauth is deprecated. Use v1.oauth instead."); - return this.v1.oauth; - } - - /** - * @deprecated - Use v1.openidDiscovery instead - */ - get openidDiscovery(): OpenidDiscoveryListInstance { - console.warn( - "openidDiscovery is deprecated. Use v1.openidDiscovery instead." - ); - return this.v1.openidDiscovery; - } - - /** - * @deprecated - Use v1.token instead - */ - get token(): TokenListInstance { - console.warn("token is deprecated. Use v1.token instead."); - return this.v1.token; - } - - /** - * @deprecated - Use v1.userInfo instead - */ - get userInfo(): UserInfoListInstance { - console.warn("userInfo is deprecated. Use v1.userInfo instead."); - return this.v1.userInfo; - } -} - -export = Oauth; diff --git a/src/rest/OauthBase.ts b/src/rest/OauthBase.ts deleted file mode 100644 index 513dd037f3..0000000000 --- a/src/rest/OauthBase.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 "./oauth/V1"; - -class OauthBase extends Domain { - _v1?: V1; - - /** - * Initialize oauth domain - * - * @param twilio - The twilio client - */ - constructor(twilio: any) { - super(twilio, "https://oauth.twilio.com"); - } - - get v1(): V1 { - this._v1 = this._v1 || new V1(this); - return this._v1; - } -} - -export = OauthBase; diff --git a/src/rest/Twilio.ts b/src/rest/Twilio.ts index 1a21d3a500..3543d11e94 100644 --- a/src/rest/Twilio.ts +++ b/src/rest/Twilio.ts @@ -30,7 +30,6 @@ import Microvisor from "./Microvisor"; import Monitor from "./Monitor"; import Notify from "./Notify"; import Numbers from "./Numbers"; -import Oauth from "./Oauth"; import Preview from "./Preview"; import Pricing from "./Pricing"; import Proxy from "./Proxy"; @@ -118,8 +117,6 @@ class Twilio extends Client { _notify?: Notify; /** (Twilio.Numbers) - numbers domain */ _numbers?: Numbers; - /** (Twilio.Oauth) - oauth domain */ - _oauth?: Oauth; /** (Twilio.Preview) - preview domain */ _preview?: Preview; /** (Twilio.Pricing) - pricing domain */ @@ -188,7 +185,6 @@ class Twilio extends Client { this.monitor; this.notify; this.numbers; - this.oauth; this.preview; this.pricing; this.proxy; @@ -314,10 +310,6 @@ class Twilio extends Client { get numbers(): Numbers { return this._numbers ?? (this._numbers = new (require("./Numbers"))(this)); } - /** Getter for (Twilio.Oauth) domain */ - get oauth(): Oauth { - return this._oauth ?? (this._oauth = new (require("./Oauth"))(this)); - } /** Getter for (Twilio.Preview) domain */ get preview(): Preview { return this._preview ?? (this._preview = new (require("./Preview"))(this)); diff --git a/src/rest/oauth/V1.ts b/src/rest/oauth/V1.ts deleted file mode 100644 index ab2759f368..0000000000 --- a/src/rest/oauth/V1.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -import OauthBase from "../OauthBase"; -import Version from "../../base/Version"; -import { DeviceCodeListInstance } from "./v1/deviceCode"; -import { OauthListInstance } from "./v1/oauth"; -import { OpenidDiscoveryListInstance } from "./v1/openidDiscovery"; -import { TokenListInstance } from "./v1/token"; -import { UserInfoListInstance } from "./v1/userInfo"; - -export default class V1 extends Version { - /** - * Initialize the V1 version of Oauth - * - * @param domain - The Twilio (Twilio.Oauth) domain - */ - constructor(domain: OauthBase) { - super(domain, "v1"); - } - - /** deviceCode - { Twilio.Oauth.V1.DeviceCodeListInstance } resource */ - protected _deviceCode?: DeviceCodeListInstance; - /** oauth - { Twilio.Oauth.V1.OauthListInstance } resource */ - protected _oauth?: OauthListInstance; - /** openidDiscovery - { Twilio.Oauth.V1.OpenidDiscoveryListInstance } resource */ - protected _openidDiscovery?: OpenidDiscoveryListInstance; - /** token - { Twilio.Oauth.V1.TokenListInstance } resource */ - protected _token?: TokenListInstance; - /** userInfo - { Twilio.Oauth.V1.UserInfoListInstance } resource */ - protected _userInfo?: UserInfoListInstance; - - /** Getter for deviceCode resource */ - get deviceCode(): DeviceCodeListInstance { - this._deviceCode = this._deviceCode || DeviceCodeListInstance(this); - return this._deviceCode; - } - - /** Getter for oauth resource */ - get oauth(): OauthListInstance { - this._oauth = this._oauth || OauthListInstance(this); - return this._oauth; - } - - /** Getter for openidDiscovery resource */ - get openidDiscovery(): OpenidDiscoveryListInstance { - this._openidDiscovery = - this._openidDiscovery || OpenidDiscoveryListInstance(this); - return this._openidDiscovery; - } - - /** Getter for token resource */ - get token(): TokenListInstance { - this._token = this._token || TokenListInstance(this); - return this._token; - } - - /** Getter for userInfo resource */ - get userInfo(): UserInfoListInstance { - this._userInfo = this._userInfo || UserInfoListInstance(this); - return this._userInfo; - } -} diff --git a/src/rest/oauth/v1/deviceCode.ts b/src/rest/oauth/v1/deviceCode.ts deleted file mode 100644 index da60047a46..0000000000 --- a/src/rest/oauth/v1/deviceCode.ts +++ /dev/null @@ -1,192 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 create a DeviceCodeInstance - */ -export interface DeviceCodeListInstanceCreateOptions { - /** A 34 character string that uniquely identifies this OAuth App. */ - clientSid: string; - /** An Array of scopes for authorization request */ - scopes: Array; - /** An array of intended audiences for token requests */ - audiences?: Array; -} - -export interface DeviceCodeSolution {} - -export interface DeviceCodeListInstance { - _version: V1; - _solution: DeviceCodeSolution; - _uri: string; - - /** - * Create a DeviceCodeInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed DeviceCodeInstance - */ - create( - params: DeviceCodeListInstanceCreateOptions, - callback?: (error: Error | null, item?: DeviceCodeInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function DeviceCodeListInstance(version: V1): DeviceCodeListInstance { - const instance = {} as DeviceCodeListInstance; - - instance._version = version; - instance._solution = {}; - instance._uri = `/device/code`; - - instance.create = function create( - params: DeviceCodeListInstanceCreateOptions, - callback?: (error: Error | null, items: DeviceCodeInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["clientSid"] === null || params["clientSid"] === undefined) { - throw new Error("Required parameter \"params['clientSid']\" missing."); - } - - if (params["scopes"] === null || params["scopes"] === undefined) { - throw new Error("Required parameter \"params['scopes']\" missing."); - } - - let data: any = {}; - - data["ClientSid"] = params["clientSid"]; - - data["Scopes"] = serialize.map(params["scopes"], (e: string) => e); - if (params["audiences"] !== undefined) - data["Audiences"] = serialize.map(params["audiences"], (e: string) => e); - - 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 DeviceCodeInstance(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 DeviceCodePayload extends DeviceCodeResource {} - -interface DeviceCodeResource { - device_code: string; - user_code: string; - verification_uri: string; - verification_uri_complete: string; - expires_in: number; - interval: number; -} - -export class DeviceCodeInstance { - constructor(protected _version: V1, payload: DeviceCodeResource) { - this.deviceCode = payload.device_code; - this.userCode = payload.user_code; - this.verificationUri = payload.verification_uri; - this.verificationUriComplete = payload.verification_uri_complete; - this.expiresIn = payload.expires_in; - this.interval = deserialize.integer(payload.interval); - } - - /** - * The device verification code. - */ - deviceCode: string; - /** - * The verification code which end user uses to verify authorization request. - */ - userCode: string; - /** - * The URI that the end user visits to verify authorization request. - */ - verificationUri: string; - /** - * The URI with user_code that the end-user alternatively visits to verify authorization request. - */ - verificationUriComplete: string; - /** - * The expiration time of the device_code and user_code in seconds. - */ - expiresIn: number; - /** - * The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint. - */ - interval: number; - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - deviceCode: this.deviceCode, - userCode: this.userCode, - verificationUri: this.verificationUri, - verificationUriComplete: this.verificationUriComplete, - expiresIn: this.expiresIn, - interval: this.interval, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/oauth/v1/oauth.ts b/src/rest/oauth/v1/oauth.ts deleted file mode 100644 index 7752f30008..0000000000 --- a/src/rest/oauth/v1/oauth.ts +++ /dev/null @@ -1,185 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 interface OauthContext { - /** - * Fetch a OauthInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OauthInstance - */ - fetch( - callback?: (error: Error | null, item?: OauthInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface OauthContextSolution {} - -export class OauthContextImpl implements OauthContext { - protected _solution: OauthContextSolution; - protected _uri: string; - - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/certs`; - } - - fetch( - callback?: (error: Error | null, item?: OauthInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => new OauthInstance(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 OauthPayload extends OauthResource {} - -interface OauthResource { - keys: any; - url: string; -} - -export class OauthInstance { - protected _solution: OauthContextSolution; - protected _context?: OauthContext; - - constructor(protected _version: V1, payload: OauthResource) { - this.keys = payload.keys; - this.url = payload.url; - - this._solution = {}; - } - - /** - * A collection of certificates where are signed Twilio-issued tokens. - */ - keys: any; - url: string; - - private get _proxy(): OauthContext { - this._context = this._context || new OauthContextImpl(this._version); - return this._context; - } - - /** - * Fetch a OauthInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OauthInstance - */ - fetch( - callback?: (error: Error | null, item?: OauthInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - keys: this.keys, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface OauthSolution {} - -export interface OauthListInstance { - _version: V1; - _solution: OauthSolution; - _uri: string; - - (): OauthContext; - get(): OauthContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function OauthListInstance(version: V1): OauthListInstance { - const instance = (() => instance.get()) as OauthListInstance; - - instance.get = function get(): OauthContext { - return new OauthContextImpl(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/oauth/v1/openidDiscovery.ts b/src/rest/oauth/v1/openidDiscovery.ts deleted file mode 100644 index 24b8aa9a9f..0000000000 --- a/src/rest/oauth/v1/openidDiscovery.ts +++ /dev/null @@ -1,266 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 interface OpenidDiscoveryContext { - /** - * Fetch a OpenidDiscoveryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OpenidDiscoveryInstance - */ - fetch( - callback?: (error: Error | null, item?: OpenidDiscoveryInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface OpenidDiscoveryContextSolution {} - -export class OpenidDiscoveryContextImpl implements OpenidDiscoveryContext { - protected _solution: OpenidDiscoveryContextSolution; - protected _uri: string; - - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/.well-known/openid-configuration`; - } - - fetch( - callback?: (error: Error | null, item?: OpenidDiscoveryInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => new OpenidDiscoveryInstance(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 OpenidDiscoveryPayload extends OpenidDiscoveryResource {} - -interface OpenidDiscoveryResource { - issuer: string; - authorization_endpoint: string; - device_authorization_endpoint: string; - token_endpoint: string; - userinfo_endpoint: string; - revocation_endpoint: string; - jwk_uri: string; - response_type_supported: Array; - subject_type_supported: Array; - id_token_signing_alg_values_supported: Array; - scopes_supported: Array; - claims_supported: Array; - url: string; -} - -export class OpenidDiscoveryInstance { - protected _solution: OpenidDiscoveryContextSolution; - protected _context?: OpenidDiscoveryContext; - - constructor(protected _version: V1, payload: OpenidDiscoveryResource) { - this.issuer = payload.issuer; - this.authorizationEndpoint = payload.authorization_endpoint; - this.deviceAuthorizationEndpoint = payload.device_authorization_endpoint; - this.tokenEndpoint = payload.token_endpoint; - this.userinfoEndpoint = payload.userinfo_endpoint; - this.revocationEndpoint = payload.revocation_endpoint; - this.jwkUri = payload.jwk_uri; - this.responseTypeSupported = payload.response_type_supported; - this.subjectTypeSupported = payload.subject_type_supported; - this.idTokenSigningAlgValuesSupported = - payload.id_token_signing_alg_values_supported; - this.scopesSupported = payload.scopes_supported; - this.claimsSupported = payload.claims_supported; - this.url = payload.url; - - this._solution = {}; - } - - /** - * The URL of the party that will create the token and sign it with its private key. - */ - issuer: string; - /** - * The endpoint that validates all authorization requests. - */ - authorizationEndpoint: string; - /** - * The endpoint that validates all device code related authorization requests. - */ - deviceAuthorizationEndpoint: string; - /** - * The URL of the token endpoint. After a client has received an authorization code, that code is presented to the token endpoint and exchanged for an identity token, an access token, and a refresh token. - */ - tokenEndpoint: string; - /** - * The URL of the user info endpoint, which returns user profile information to a client. Keep in mind that the user info endpoint returns only the information that has been requested. - */ - userinfoEndpoint: string; - /** - * The endpoint used to revoke access or refresh tokens issued by the authorization server. - */ - revocationEndpoint: string; - /** - * The URL of your JSON Web Key Set. This set is a collection of JSON Web Keys, a standard method for representing cryptographic keys in a JSON structure. - */ - jwkUri: string; - /** - * A collection of response type supported by authorization server. - */ - responseTypeSupported: Array; - /** - * A collection of subject by authorization server. - */ - subjectTypeSupported: Array; - /** - * A collection of JWS signing algorithms supported by authorization server to sign identity token. - */ - idTokenSigningAlgValuesSupported: Array; - /** - * A collection of scopes supported by authorization server for identity token - */ - scopesSupported: Array; - /** - * A collection of claims supported by authorization server for identity token - */ - claimsSupported: Array; - url: string; - - private get _proxy(): OpenidDiscoveryContext { - this._context = - this._context || new OpenidDiscoveryContextImpl(this._version); - return this._context; - } - - /** - * Fetch a OpenidDiscoveryInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed OpenidDiscoveryInstance - */ - fetch( - callback?: (error: Error | null, item?: OpenidDiscoveryInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - issuer: this.issuer, - authorizationEndpoint: this.authorizationEndpoint, - deviceAuthorizationEndpoint: this.deviceAuthorizationEndpoint, - tokenEndpoint: this.tokenEndpoint, - userinfoEndpoint: this.userinfoEndpoint, - revocationEndpoint: this.revocationEndpoint, - jwkUri: this.jwkUri, - responseTypeSupported: this.responseTypeSupported, - subjectTypeSupported: this.subjectTypeSupported, - idTokenSigningAlgValuesSupported: this.idTokenSigningAlgValuesSupported, - scopesSupported: this.scopesSupported, - claimsSupported: this.claimsSupported, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface OpenidDiscoverySolution {} - -export interface OpenidDiscoveryListInstance { - _version: V1; - _solution: OpenidDiscoverySolution; - _uri: string; - - (): OpenidDiscoveryContext; - get(): OpenidDiscoveryContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function OpenidDiscoveryListInstance( - version: V1 -): OpenidDiscoveryListInstance { - const instance = (() => instance.get()) as OpenidDiscoveryListInstance; - - instance.get = function get(): OpenidDiscoveryContext { - return new OpenidDiscoveryContextImpl(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/oauth/v1/token.ts b/src/rest/oauth/v1/token.ts deleted file mode 100644 index 918bb2576b..0000000000 --- a/src/rest/oauth/v1/token.ts +++ /dev/null @@ -1,204 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 create a TokenInstance - */ -export interface TokenListInstanceCreateOptions { - /** Grant type is a credential representing resource owner\\\'s authorization which can be used by client to obtain access token. */ - grantType: string; - /** A 34 character string that uniquely identifies this OAuth App. */ - clientSid: string; - /** The credential for confidential OAuth App. */ - clientSecret?: string; - /** JWT token related to the authorization code grant type. */ - code?: string; - /** A code which is generation cryptographically. */ - codeVerifier?: string; - /** JWT token related to the device code grant type. */ - deviceCode?: string; - /** JWT token related to the refresh token grant type. */ - refreshToken?: string; - /** The Id of the device associated with the token (refresh token). */ - deviceId?: string; -} - -export interface TokenSolution {} - -export interface TokenListInstance { - _version: V1; - _solution: TokenSolution; - _uri: string; - - /** - * Create a TokenInstance - * - * @param params - Parameter for request - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed TokenInstance - */ - create( - params: TokenListInstanceCreateOptions, - callback?: (error: Error | null, item?: TokenInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function TokenListInstance(version: V1): TokenListInstance { - const instance = {} as TokenListInstance; - - instance._version = version; - instance._solution = {}; - instance._uri = `/token`; - - instance.create = function create( - params: TokenListInstanceCreateOptions, - callback?: (error: Error | null, items: TokenInstance) => any - ): Promise { - if (params === null || params === undefined) { - throw new Error('Required parameter "params" missing.'); - } - - if (params["grantType"] === null || params["grantType"] === undefined) { - throw new Error("Required parameter \"params['grantType']\" missing."); - } - - if (params["clientSid"] === null || params["clientSid"] === undefined) { - throw new Error("Required parameter \"params['clientSid']\" missing."); - } - - let data: any = {}; - - data["GrantType"] = params["grantType"]; - - data["ClientSid"] = params["clientSid"]; - if (params["clientSecret"] !== undefined) - data["ClientSecret"] = params["clientSecret"]; - if (params["code"] !== undefined) data["Code"] = params["code"]; - if (params["codeVerifier"] !== undefined) - data["CodeVerifier"] = params["codeVerifier"]; - if (params["deviceCode"] !== undefined) - data["DeviceCode"] = params["deviceCode"]; - if (params["refreshToken"] !== undefined) - data["RefreshToken"] = params["refreshToken"]; - if (params["deviceId"] !== undefined) data["DeviceId"] = params["deviceId"]; - - 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 TokenInstance(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 TokenPayload extends TokenResource {} - -interface TokenResource { - access_token: string; - refresh_token: string; - id_token: string; - refresh_token_expires_at: Date; - access_token_expires_at: Date; -} - -export class TokenInstance { - constructor(protected _version: V1, payload: TokenResource) { - this.accessToken = payload.access_token; - this.refreshToken = payload.refresh_token; - this.idToken = payload.id_token; - this.refreshTokenExpiresAt = deserialize.iso8601DateTime( - payload.refresh_token_expires_at - ); - this.accessTokenExpiresAt = deserialize.iso8601DateTime( - payload.access_token_expires_at - ); - } - - /** - * Token which carries the necessary information to access a Twilio resource directly. - */ - accessToken: string; - /** - * Token which carries the information necessary to get a new access token. - */ - refreshToken: string; - idToken: string; - /** - * The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - refreshTokenExpiresAt: Date; - /** - * The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - */ - accessTokenExpiresAt: Date; - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - accessToken: this.accessToken, - refreshToken: this.refreshToken, - idToken: this.idToken, - refreshTokenExpiresAt: this.refreshTokenExpiresAt, - accessTokenExpiresAt: this.accessTokenExpiresAt, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} diff --git a/src/rest/oauth/v1/userInfo.ts b/src/rest/oauth/v1/userInfo.ts deleted file mode 100644 index 5b974309b8..0000000000 --- a/src/rest/oauth/v1/userInfo.ts +++ /dev/null @@ -1,213 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Oauth - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -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 interface UserInfoContext { - /** - * Fetch a UserInfoInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed UserInfoInstance - */ - fetch( - callback?: (error: Error | null, item?: UserInfoInstance) => any - ): Promise; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export interface UserInfoContextSolution {} - -export class UserInfoContextImpl implements UserInfoContext { - protected _solution: UserInfoContextSolution; - protected _uri: string; - - constructor(protected _version: V1) { - this._solution = {}; - this._uri = `/userinfo`; - } - - fetch( - callback?: (error: Error | null, item?: UserInfoInstance) => any - ): Promise { - const instance = this; - let operationVersion = instance._version, - operationPromise = operationVersion.fetch({ - uri: instance._uri, - method: "get", - }); - - operationPromise = operationPromise.then( - (payload) => new UserInfoInstance(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 UserInfoPayload extends UserInfoResource {} - -interface UserInfoResource { - user_sid: string; - first_name: string; - last_name: string; - friendly_name: string; - email: string; - url: string; -} - -export class UserInfoInstance { - protected _solution: UserInfoContextSolution; - protected _context?: UserInfoContext; - - constructor(protected _version: V1, payload: UserInfoResource) { - this.userSid = payload.user_sid; - this.firstName = payload.first_name; - this.lastName = payload.last_name; - this.friendlyName = payload.friendly_name; - this.email = payload.email; - this.url = payload.url; - - this._solution = {}; - } - - /** - * The URL of the party that will create the token and sign it with its private key. - */ - userSid: string; - /** - * The first name of the end-user. - */ - firstName: string; - /** - * The last name of the end-user. - */ - lastName: string; - /** - * The friendly name of the end-user. - */ - friendlyName: string; - /** - * The end-user\'s preferred email address. - */ - email: string; - url: string; - - private get _proxy(): UserInfoContext { - this._context = this._context || new UserInfoContextImpl(this._version); - return this._context; - } - - /** - * Fetch a UserInfoInstance - * - * @param callback - Callback to handle processed record - * - * @returns Resolves to processed UserInfoInstance - */ - fetch( - callback?: (error: Error | null, item?: UserInfoInstance) => any - ): Promise { - return this._proxy.fetch(callback); - } - - /** - * Provide a user-friendly representation - * - * @returns Object - */ - toJSON() { - return { - userSid: this.userSid, - firstName: this.firstName, - lastName: this.lastName, - friendlyName: this.friendlyName, - email: this.email, - url: this.url, - }; - } - - [inspect.custom](_depth: any, options: InspectOptions) { - return inspect(this.toJSON(), options); - } -} - -export interface UserInfoSolution {} - -export interface UserInfoListInstance { - _version: V1; - _solution: UserInfoSolution; - _uri: string; - - (): UserInfoContext; - get(): UserInfoContext; - - /** - * Provide a user-friendly representation - */ - toJSON(): any; - [inspect.custom](_depth: any, options: InspectOptions): any; -} - -export function UserInfoListInstance(version: V1): UserInfoListInstance { - const instance = (() => instance.get()) as UserInfoListInstance; - - instance.get = function get(): UserInfoContext { - return new UserInfoContextImpl(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; -} From 54861cd866f2d47caced5175a676d3902cd70fc4 Mon Sep 17 00:00:00 2001 From: Shubham Date: Mon, 13 Nov 2023 21:58:19 +0530 Subject: [PATCH 14/14] chore: sync with main (#981) * chore: Removed LTS version (#978) * chore: removed LTS version * chore: removing lts from cloudscan * chore: completely removed LTS * chore: Update axios to 1.6 to pull in fix for CVE 2023 45857 (#971) * Update axios to 1.6.0 Fixes CVE-2023-45857 * Explicit type return on Promise TypeScript's automatic type resolution for the promise returned by the function in getExponentialBackoffResponseHandler determines that it returns a Promise. This commit forces TypeScript to recognize that the resolved object is of type Promise. --------- Co-authored-by: Shubham * chore: twilio help changes (#958) Co-authored-by: Shubham * chore: Removing Test Related To Deprecated Endpoint - OAuth (#963) * removing test in relation to deprecated endpoint * removingn more oauth refrences --------- Co-authored-by: sbansla <104902068+sbansla@users.noreply.github.com> --------- Co-authored-by: Andrew Pietila <149612764+kitu-apietila@users.noreply.github.com> Co-authored-by: kridai Co-authored-by: KobeBrooks <55289738+KobeBrooks@users.noreply.github.com> Co-authored-by: sbansla <104902068+sbansla@users.noreply.github.com>