From 1344a565c2b0c34dac4b5ef516a4cde679d75067 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Wed, 12 Feb 2025 19:55:23 +0000 Subject: [PATCH 1/6] Generate SDK with OpenAPI Generator Version --- .openapi-generator/FILES | 25 + README.md | 6 +- api.ts | 1 + api/toll-free-verification-api.ts | 715 +++++++++++ bandwidth.yml | 1102 +++++++++++++++++ base.ts | 48 + configuration.ts | 2 +- models/additional-denial-reason.ts | 42 + models/address.ts | 66 + models/contact.ts | 48 + models/failure-webhook.ts | 60 + models/index.ts | 24 + models/links-object.ts | 48 + models/model-error.ts | 45 + models/opt-in-workflow.ts | 36 + models/telephone-number.ts | 30 + models/tfv-basic-authentication.ts | 36 + models/tfv-callback-status-enum.ts | 31 + models/tfv-error.ts | 42 + models/tfv-status-enum.ts | 34 + models/tfv-status.ts | 80 ++ models/tfv-submission-info.ts | 87 ++ models/tfv-submission-wrapper.ts | 33 + models/verification-denial-webhook.ts | 75 ++ models/verification-request.ts | 93 ++ models/verification-update-request.ts | 87 ++ models/verification-webhook.ts | 53 + ...bhook-subscription-basic-authentication.ts | 36 + models/webhook-subscription-request-schema.ts | 45 + models/webhook-subscription-type-enum.ts | 31 + models/webhook-subscription.ts | 74 ++ models/webhook-subscriptions-list-body.ts | 51 + package.json | 2 +- 33 files changed, 3183 insertions(+), 5 deletions(-) create mode 100644 api/toll-free-verification-api.ts create mode 100644 models/additional-denial-reason.ts create mode 100644 models/address.ts create mode 100644 models/contact.ts create mode 100644 models/failure-webhook.ts create mode 100644 models/links-object.ts create mode 100644 models/model-error.ts create mode 100644 models/opt-in-workflow.ts create mode 100644 models/telephone-number.ts create mode 100644 models/tfv-basic-authentication.ts create mode 100644 models/tfv-callback-status-enum.ts create mode 100644 models/tfv-error.ts create mode 100644 models/tfv-status-enum.ts create mode 100644 models/tfv-status.ts create mode 100644 models/tfv-submission-info.ts create mode 100644 models/tfv-submission-wrapper.ts create mode 100644 models/verification-denial-webhook.ts create mode 100644 models/verification-request.ts create mode 100644 models/verification-update-request.ts create mode 100644 models/verification-webhook.ts create mode 100644 models/webhook-subscription-basic-authentication.ts create mode 100644 models/webhook-subscription-request-schema.ts create mode 100644 models/webhook-subscription-type-enum.ts create mode 100644 models/webhook-subscription.ts create mode 100644 models/webhook-subscriptions-list-body.ts diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 83a391a..3c2f0eb 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -9,6 +9,7 @@ api/mfaapi.ts api/phone-number-lookup-api.ts api/recordings-api.ts api/statistics-api.ts +api/toll-free-verification-api.ts api/transcriptions-api.ts base.ts common.ts @@ -16,6 +17,8 @@ configuration.ts git_push.sh index.ts models/account-statistics.ts +models/additional-denial-reason.ts +models/address.ts models/answer-callback.ts models/bridge-complete-callback.ts models/bridge-target-complete-callback.ts @@ -41,6 +44,7 @@ models/conference-recording-metadata.ts models/conference-redirect-callback.ts models/conference-state-enum.ts models/conference.ts +models/contact.ts models/create-call-response.ts models/create-call.ts models/create-lookup-response.ts @@ -49,11 +53,13 @@ models/deferred-result.ts models/disconnect-callback.ts models/diversion.ts models/dtmf-callback.ts +models/failure-webhook.ts models/field-error.ts models/file-format-enum.ts models/gather-callback.ts models/index.ts models/initiate-callback.ts +models/links-object.ts models/list-message-direction-enum.ts models/list-message-item.ts models/lookup-request.ts @@ -78,6 +84,8 @@ models/messaging-request-error.ts models/mfa-forbidden-request-error.ts models/mfa-request-error.ts models/mfa-unauthorized-request-error.ts +models/model-error.ts +models/opt-in-workflow.ts models/page-info.ts models/priority-enum.ts models/recording-available-callback.ts @@ -89,6 +97,14 @@ models/redirect-callback.ts models/redirect-method-enum.ts models/stir-shaken.ts models/tag.ts +models/telephone-number.ts +models/tfv-basic-authentication.ts +models/tfv-callback-status-enum.ts +models/tfv-error.ts +models/tfv-status-enum.ts +models/tfv-status.ts +models/tfv-submission-info.ts +models/tfv-submission-wrapper.ts models/tn-lookup-request-error.ts models/transcribe-recording.ts models/transcription-available-callback.ts @@ -100,9 +116,18 @@ models/update-call-recording.ts models/update-call.ts models/update-conference-member.ts models/update-conference.ts +models/verification-denial-webhook.ts +models/verification-request.ts +models/verification-update-request.ts +models/verification-webhook.ts models/verify-code-request.ts models/verify-code-response.ts models/voice-api-error.ts models/voice-code-response.ts +models/webhook-subscription-basic-authentication.ts +models/webhook-subscription-request-schema.ts +models/webhook-subscription-type-enum.ts +models/webhook-subscription.ts +models/webhook-subscriptions-list-body.ts package.json tsconfig.json diff --git a/README.md b/README.md index b1568b9..cd0a453 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,12 @@ [![Deploy](https://github.com/Bandwidth/node-sdk/actions/workflows/deploy.yml/badge.svg)](https://github.com/Bandwidth/node-sdk/actions/workflows/deploy.yml) ### Test Matrix -| **OS** | **Node** | -|:------------:|:---:| +| **OS** | **Node** | +|:---:|:---:| | Windows 2019 | 18, 20, 22 | | Windows 2022 | 18, 20, 22 | +| Ubuntu 20.04 | 18, 20, 22 | | Ubuntu 22.04 | 18, 20, 22 | -| Ubuntu 24.04 | 18, 20, 22 | #### Available on NPM ``` diff --git a/api.ts b/api.ts index 5e98c2b..3c42f05 100644 --- a/api.ts +++ b/api.ts @@ -22,5 +22,6 @@ export * from './api/messages-api'; export * from './api/phone-number-lookup-api'; export * from './api/recordings-api'; export * from './api/statistics-api'; +export * from './api/toll-free-verification-api'; export * from './api/transcriptions-api'; diff --git a/api/toll-free-verification-api.ts b/api/toll-free-verification-api.ts new file mode 100644 index 0000000..3d9e645 --- /dev/null +++ b/api/toll-free-verification-api.ts @@ -0,0 +1,715 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from '../configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; +// @ts-ignore +import type { TfvError } from '../models'; +// @ts-ignore +import type { TfvStatus } from '../models'; +// @ts-ignore +import type { TfvSubmissionWrapper } from '../models'; +// @ts-ignore +import type { VerificationRequest } from '../models'; +// @ts-ignore +import type { WebhookSubscription } from '../models'; +// @ts-ignore +import type { WebhookSubscriptionRequestSchema } from '../models'; +// @ts-ignore +import type { WebhookSubscriptionsListBody } from '../models'; +/** + * TollFreeVerificationApi - axios parameter creator + * @export + */ +export const TollFreeVerificationApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. + * @summary Create Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {WebhookSubscriptionRequestSchema} webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createWebhookSubscription: async (accountId: string, webhookSubscriptionRequestSchema: WebhookSubscriptionRequestSchema, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('createWebhookSubscription', 'accountId', accountId) + // verify required parameter 'webhookSubscriptionRequestSchema' is not null or undefined + assertParamExists('createWebhookSubscription', 'webhookSubscriptionRequestSchema', webhookSubscriptionRequestSchema) + const localVarPath = `/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(webhookSubscriptionRequestSchema, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Delete a webhook subscription by ID. + * @summary Delete Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} id Webhook subscription ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWebhookSubscription: async (accountId: string, id: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('deleteWebhookSubscription', 'accountId', accountId) + // verify required parameter 'id' is not null or undefined + assertParamExists('deleteWebhookSubscription', 'id', id) + const localVarPath = `/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available. + * @summary Get Toll-Free Verification Status + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} phoneNumber Valid Toll-Free telephone number in E.164 format. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTollFreeVerificationStatus: async (accountId: string, phoneNumber: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('getTollFreeVerificationStatus', 'accountId', accountId) + // verify required parameter 'phoneNumber' is not null or undefined + assertParamExists('getTollFreeVerificationStatus', 'phoneNumber', phoneNumber) + const localVarPath = `/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) + .replace(`{${"phoneNumber"}}`, encodeURIComponent(String(phoneNumber))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Lists valid toll-free use cases. + * @summary List Toll-Free Use Cases + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listTollFreeUseCases: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/tollFreeVerification/useCases`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null). + * @summary List Webhook Subscriptions + * @param {string} accountId Your Bandwidth Account ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listWebhookSubscriptions: async (accountId: string, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('listWebhookSubscriptions', 'accountId', accountId) + const localVarPath = `/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Submit a request for verification of a toll-free phone number. + * @summary Request Toll-Free Verification + * @param {string} accountId Your Bandwidth Account ID. + * @param {VerificationRequest} verificationRequest Request for verification of a toll-free phone number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + requestTollFreeVerification: async (accountId: string, verificationRequest: VerificationRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('requestTollFreeVerification', 'accountId', accountId) + // verify required parameter 'verificationRequest' is not null or undefined + assertParamExists('requestTollFreeVerification', 'verificationRequest', verificationRequest) + const localVarPath = `/accounts/{accountId}/tollFreeVerification` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(verificationRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). + * @summary Update Toll-Free Verification Request + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} phoneNumber Valid Toll-Free telephone number in E.164 format. + * @param {TfvSubmissionWrapper} tfvSubmissionWrapper Update a request for verification of a toll-free phone number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateTollFreeVerificationRequest: async (accountId: string, phoneNumber: string, tfvSubmissionWrapper: TfvSubmissionWrapper, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('updateTollFreeVerificationRequest', 'accountId', accountId) + // verify required parameter 'phoneNumber' is not null or undefined + assertParamExists('updateTollFreeVerificationRequest', 'phoneNumber', phoneNumber) + // verify required parameter 'tfvSubmissionWrapper' is not null or undefined + assertParamExists('updateTollFreeVerificationRequest', 'tfvSubmissionWrapper', tfvSubmissionWrapper) + const localVarPath = `/accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) + .replace(`{${"phoneNumber"}}`, encodeURIComponent(String(phoneNumber))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(tfvSubmissionWrapper, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + * @summary Update Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} id Webhook subscription ID + * @param {WebhookSubscriptionRequestSchema} webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateWebhookSubscription: async (accountId: string, id: string, webhookSubscriptionRequestSchema: WebhookSubscriptionRequestSchema, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'accountId' is not null or undefined + assertParamExists('updateWebhookSubscription', 'accountId', accountId) + // verify required parameter 'id' is not null or undefined + assertParamExists('updateWebhookSubscription', 'id', id) + // verify required parameter 'webhookSubscriptionRequestSchema' is not null or undefined + assertParamExists('updateWebhookSubscription', 'webhookSubscriptionRequestSchema', webhookSubscriptionRequestSchema) + const localVarPath = `/accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}` + .replace(`{${"accountId"}}`, encodeURIComponent(String(accountId))) + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Basic required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(webhookSubscriptionRequestSchema, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * TollFreeVerificationApi - functional programming interface + * @export + */ +export const TollFreeVerificationApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = TollFreeVerificationApiAxiosParamCreator(configuration) + return { + /** + * Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. + * @summary Create Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {WebhookSubscriptionRequestSchema} webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createWebhookSubscription(accountId: string, webhookSubscriptionRequestSchema: WebhookSubscriptionRequestSchema, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createWebhookSubscription(accountId, webhookSubscriptionRequestSchema, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TollFreeVerificationApi.createWebhookSubscription']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Delete a webhook subscription by ID. + * @summary Delete Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} id Webhook subscription ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteWebhookSubscription(accountId: string, id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteWebhookSubscription(accountId, id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TollFreeVerificationApi.deleteWebhookSubscription']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available. + * @summary Get Toll-Free Verification Status + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} phoneNumber Valid Toll-Free telephone number in E.164 format. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getTollFreeVerificationStatus(accountId: string, phoneNumber: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getTollFreeVerificationStatus(accountId, phoneNumber, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TollFreeVerificationApi.getTollFreeVerificationStatus']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Lists valid toll-free use cases. + * @summary List Toll-Free Use Cases + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listTollFreeUseCases(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listTollFreeUseCases(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TollFreeVerificationApi.listTollFreeUseCases']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null). + * @summary List Webhook Subscriptions + * @param {string} accountId Your Bandwidth Account ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listWebhookSubscriptions(accountId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listWebhookSubscriptions(accountId, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TollFreeVerificationApi.listWebhookSubscriptions']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Submit a request for verification of a toll-free phone number. + * @summary Request Toll-Free Verification + * @param {string} accountId Your Bandwidth Account ID. + * @param {VerificationRequest} verificationRequest Request for verification of a toll-free phone number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async requestTollFreeVerification(accountId: string, verificationRequest: VerificationRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.requestTollFreeVerification(accountId, verificationRequest, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TollFreeVerificationApi.requestTollFreeVerification']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). + * @summary Update Toll-Free Verification Request + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} phoneNumber Valid Toll-Free telephone number in E.164 format. + * @param {TfvSubmissionWrapper} tfvSubmissionWrapper Update a request for verification of a toll-free phone number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateTollFreeVerificationRequest(accountId: string, phoneNumber: string, tfvSubmissionWrapper: TfvSubmissionWrapper, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateTollFreeVerificationRequest(accountId, phoneNumber, tfvSubmissionWrapper, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TollFreeVerificationApi.updateTollFreeVerificationRequest']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + * @summary Update Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} id Webhook subscription ID + * @param {WebhookSubscriptionRequestSchema} webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateWebhookSubscription(accountId: string, id: string, webhookSubscriptionRequestSchema: WebhookSubscriptionRequestSchema, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateWebhookSubscription(accountId, id, webhookSubscriptionRequestSchema, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['TollFreeVerificationApi.updateWebhookSubscription']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * TollFreeVerificationApi - factory interface + * @export + */ +export const TollFreeVerificationApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = TollFreeVerificationApiFp(configuration) + return { + /** + * Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. + * @summary Create Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {WebhookSubscriptionRequestSchema} webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createWebhookSubscription(accountId: string, webhookSubscriptionRequestSchema: WebhookSubscriptionRequestSchema, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.createWebhookSubscription(accountId, webhookSubscriptionRequestSchema, options).then((request) => request(axios, basePath)); + }, + /** + * Delete a webhook subscription by ID. + * @summary Delete Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} id Webhook subscription ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWebhookSubscription(accountId: string, id: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.deleteWebhookSubscription(accountId, id, options).then((request) => request(axios, basePath)); + }, + /** + * Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available. + * @summary Get Toll-Free Verification Status + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} phoneNumber Valid Toll-Free telephone number in E.164 format. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTollFreeVerificationStatus(accountId: string, phoneNumber: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.getTollFreeVerificationStatus(accountId, phoneNumber, options).then((request) => request(axios, basePath)); + }, + /** + * Lists valid toll-free use cases. + * @summary List Toll-Free Use Cases + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listTollFreeUseCases(options?: RawAxiosRequestConfig): AxiosPromise> { + return localVarFp.listTollFreeUseCases(options).then((request) => request(axios, basePath)); + }, + /** + * Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null). + * @summary List Webhook Subscriptions + * @param {string} accountId Your Bandwidth Account ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listWebhookSubscriptions(accountId: string, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.listWebhookSubscriptions(accountId, options).then((request) => request(axios, basePath)); + }, + /** + * Submit a request for verification of a toll-free phone number. + * @summary Request Toll-Free Verification + * @param {string} accountId Your Bandwidth Account ID. + * @param {VerificationRequest} verificationRequest Request for verification of a toll-free phone number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + requestTollFreeVerification(accountId: string, verificationRequest: VerificationRequest, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.requestTollFreeVerification(accountId, verificationRequest, options).then((request) => request(axios, basePath)); + }, + /** + * Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). + * @summary Update Toll-Free Verification Request + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} phoneNumber Valid Toll-Free telephone number in E.164 format. + * @param {TfvSubmissionWrapper} tfvSubmissionWrapper Update a request for verification of a toll-free phone number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateTollFreeVerificationRequest(accountId: string, phoneNumber: string, tfvSubmissionWrapper: TfvSubmissionWrapper, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.updateTollFreeVerificationRequest(accountId, phoneNumber, tfvSubmissionWrapper, options).then((request) => request(axios, basePath)); + }, + /** + * Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + * @summary Update Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} id Webhook subscription ID + * @param {WebhookSubscriptionRequestSchema} webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateWebhookSubscription(accountId: string, id: string, webhookSubscriptionRequestSchema: WebhookSubscriptionRequestSchema, options?: RawAxiosRequestConfig): AxiosPromise { + return localVarFp.updateWebhookSubscription(accountId, id, webhookSubscriptionRequestSchema, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * TollFreeVerificationApi - object-oriented interface + * @export + * @class TollFreeVerificationApi + * @extends {BaseAPI} + */ +export class TollFreeVerificationApi extends BaseAPI { + /** + * Create a new webhook subscription (this webhook will be called for every update on every submission). In addition to a `callbackUrl`, this subscription can provide optional HTTP basic authentication credentials (a username and a password). The returned subscription object will contain an ID that can be used to modify or delete the subscription at a later time. + * @summary Create Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {WebhookSubscriptionRequestSchema} webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TollFreeVerificationApi + */ + public createWebhookSubscription(accountId: string, webhookSubscriptionRequestSchema: WebhookSubscriptionRequestSchema, options?: RawAxiosRequestConfig) { + return TollFreeVerificationApiFp(this.configuration).createWebhookSubscription(accountId, webhookSubscriptionRequestSchema, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Delete a webhook subscription by ID. + * @summary Delete Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} id Webhook subscription ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TollFreeVerificationApi + */ + public deleteWebhookSubscription(accountId: string, id: string, options?: RawAxiosRequestConfig) { + return TollFreeVerificationApiFp(this.configuration).deleteWebhookSubscription(accountId, id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Gets the verification status for a phone number that is provisioned to your account. Submission information will be appended to the response if it is available. + * @summary Get Toll-Free Verification Status + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} phoneNumber Valid Toll-Free telephone number in E.164 format. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TollFreeVerificationApi + */ + public getTollFreeVerificationStatus(accountId: string, phoneNumber: string, options?: RawAxiosRequestConfig) { + return TollFreeVerificationApiFp(this.configuration).getTollFreeVerificationStatus(accountId, phoneNumber, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Lists valid toll-free use cases. + * @summary List Toll-Free Use Cases + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TollFreeVerificationApi + */ + public listTollFreeUseCases(options?: RawAxiosRequestConfig) { + return TollFreeVerificationApiFp(this.configuration).listTollFreeUseCases(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Lists all webhook subscriptions that are registered to receive status updates for the toll-free verification requests submitted under this account (password will not be returned through this API If `basicAuthentication` is defined, the `password` property of that object will be null). + * @summary List Webhook Subscriptions + * @param {string} accountId Your Bandwidth Account ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TollFreeVerificationApi + */ + public listWebhookSubscriptions(accountId: string, options?: RawAxiosRequestConfig) { + return TollFreeVerificationApiFp(this.configuration).listWebhookSubscriptions(accountId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Submit a request for verification of a toll-free phone number. + * @summary Request Toll-Free Verification + * @param {string} accountId Your Bandwidth Account ID. + * @param {VerificationRequest} verificationRequest Request for verification of a toll-free phone number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TollFreeVerificationApi + */ + public requestTollFreeVerification(accountId: string, verificationRequest: VerificationRequest, options?: RawAxiosRequestConfig) { + return TollFreeVerificationApiFp(this.configuration).requestTollFreeVerification(accountId, verificationRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Updates a toll-free verification request. Submissions are only eligible for resubmission for 7 days within being processed and if resubmission is allowed (resubmitAllowed field is true). + * @summary Update Toll-Free Verification Request + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} phoneNumber Valid Toll-Free telephone number in E.164 format. + * @param {TfvSubmissionWrapper} tfvSubmissionWrapper Update a request for verification of a toll-free phone number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TollFreeVerificationApi + */ + public updateTollFreeVerificationRequest(accountId: string, phoneNumber: string, tfvSubmissionWrapper: TfvSubmissionWrapper, options?: RawAxiosRequestConfig) { + return TollFreeVerificationApiFp(this.configuration).updateTollFreeVerificationRequest(accountId, phoneNumber, tfvSubmissionWrapper, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Update an existing webhook subscription (`callbackUrl` and `basicAuthentication` can be updated). + * @summary Update Webhook Subscription + * @param {string} accountId Your Bandwidth Account ID. + * @param {string} id Webhook subscription ID + * @param {WebhookSubscriptionRequestSchema} webhookSubscriptionRequestSchema Information about a webhook that Bandwidth should send upon the completion of event customer is trying to subscribe to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TollFreeVerificationApi + */ + public updateWebhookSubscription(accountId: string, id: string, webhookSubscriptionRequestSchema: WebhookSubscriptionRequestSchema, options?: RawAxiosRequestConfig) { + return TollFreeVerificationApiFp(this.configuration).updateWebhookSubscription(accountId, id, webhookSubscriptionRequestSchema, options).then((request) => request(this.axios, this.basePath)); + } +} + diff --git a/bandwidth.yml b/bandwidth.yml index 87921df..70ca20d 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -19,6 +19,7 @@ tags: - name: Transcriptions - name: MFA - name: Phone Number Lookup + - name: Toll-Free Verification paths: /users/{accountId}/media: get: @@ -1328,6 +1329,270 @@ paths: '500': $ref: '#/components/responses/tnLookupInternalServerError' servers: *ref_3 + /accounts/{accountId}/tollFreeVerification: + post: + tags: + - Toll-Free Verification + summary: Request Toll-Free Verification + description: Submit a request for verification of a toll-free phone number. + operationId: requestTollFreeVerification + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/requestTollFreeVerificationRequest' + responses: + '202': + description: Accepted + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + servers: &ref_4 + - url: https://api.bandwidth.com/api/v2 + description: Production + /accounts/{accountId}/phoneNumbers/{phoneNumber}/tollFreeVerification: + get: + tags: + - Toll-Free Verification + summary: Get Toll-Free Verification Status + description: >- + Gets the verification status for a phone number that is provisioned to + your account. + + Submission information will be appended to the response if it is + available. + operationId: getTollFreeVerificationStatus + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + responses: + '200': + $ref: '#/components/responses/getTollFreeVerificationStatusResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + put: + tags: + - Toll-Free Verification + summary: Update Toll-Free Verification Request + description: >- + Updates a toll-free verification request. + + Submissions are only eligible for resubmission for 7 days within being + processed and if resubmission is allowed (resubmitAllowed field is + true). + operationId: updateTollFreeVerificationRequest + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/tfPhoneNumberPathParam' + requestBody: + $ref: '#/components/requestBodies/updateTollFreeVerificationRequestRequest' + responses: + '202': + description: Accepted + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + callbacks: + tfVerificationStatus: + $ref: '#/components/callbacks/tfVerificationStatus' + servers: *ref_4 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions: + get: + tags: + - Toll-Free Verification + summary: List Webhook Subscriptions + description: >- + Lists all webhook subscriptions that are registered to receive status + updates for the toll-free verification requests submitted under this + account (password will not be returned through this API + + If `basicAuthentication` is defined, the `password` property of that + object will be null). + operationId: listWebhookSubscriptions + parameters: + - $ref: '#/components/parameters/accountId' + responses: + '200': + $ref: '#/components/responses/listWebhookSubscriptionsResponse' + '400': + $ref: '#/components/responses/tfvPostBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + post: + tags: + - Toll-Free Verification + summary: Create Webhook Subscription + description: >- + Create a new webhook subscription (this webhook will be called for every + update on every submission). + + In addition to a `callbackUrl`, this subscription can provide optional + HTTP basic authentication credentials (a username and a password). + + The returned subscription object will contain an ID that can be used to + modify or delete the subscription at a later time. + operationId: createWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + '201': + $ref: '#/components/responses/createWebhookSubscriptionResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 + /accounts/{accountId}/tollFreeVerification/webhooks/subscriptions/{id}: + delete: + tags: + - Toll-Free Verification + summary: Delete Webhook Subscription + description: Delete a webhook subscription by ID. + operationId: deleteWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + put: + tags: + - Toll-Free Verification + summary: Update Webhook Subscription + description: >- + Update an existing webhook subscription (`callbackUrl` and + `basicAuthentication` can be updated). + operationId: updateWebhookSubscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/webhookSubscriptionIdPathParam' + requestBody: + $ref: '#/components/requestBodies/webhookSubscriptionRequest' + responses: + '200': + $ref: '#/components/responses/updateWebhookSubscriptionResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 + /tollFreeVerification/useCases: + get: + tags: + - Toll-Free Verification + summary: List Toll-Free Use Cases + description: Lists valid toll-free use cases. + operationId: listTollFreeUseCases + responses: + '200': + $ref: '#/components/responses/listTollFreeUseCasesResponse' + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' + servers: *ref_4 components: schemas: callbackTypeEnum: @@ -4410,6 +4675,640 @@ components: type: string description: A description of what validation error occurred. example: example error message + accountId1: + type: string + description: User's account ID. + example: '1234567' + tfPhoneNumber: + type: string + description: Toll-free telephone number in E.164 format. + minLength: 12 + maxLength: 12 + nullable: false + pattern: ^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$ + example: '+18005555555' + tfvWebhookErrors: + type: array + description: Details of the errors that were encountered when processing the request. + items: + type: string + example: 'optInWorkflowImageURLs: Entries must be a valid array of objects.' + tfvCallbackStatusEnum: + type: string + enum: + - VERIFIED + - UNVERIFIED + example: VERIFIED + tfvUnverifiedStatus: + type: string + default: UNVERIFIED + example: UNVERIFIED + declineReasonDescription: + type: string + description: Explanation for why a verification request was declined. + nullable: false + example: >- + Invalid Information - Can't Validate URL - Website is not accessible / + not available + denialStatusCode: + description: Reason code for denial. + type: integer + example: 511 + resubmitAllowed: + description: >- + Whether a Toll-Free Verification request qualifies for resubmission via + PUT. + example: true + type: boolean + additionalDenialReason: + properties: + statusCode: + $ref: '#/components/schemas/denialStatusCode' + reason: + $ref: '#/components/schemas/declineReasonDescription' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + required: + - statusCode + - reason + - resubmitAllowed + type: object + internalTicketNumber: + type: string + format: uuid + description: >- + Unique identifier (UUID) generated by Bandwidth to assist in tracking + the verification status of a toll-free number - included in all webhook + payloads. + example: acde070d-8c4c-4f0d-9d8a-162843c10333 + internalTicketNumberForWebhook: + type: string + format: uuid + description: >- + Unique identifier (UUID) generated by Bandwidth to assist in tracking + the verification status of a toll-free number. + example: acde070d-8c4c-4f0d-9d8a-162843c10333 + businessContactPhoneNumber: + description: Contact telephone number + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: '+19192654500' + verificationRequest: + type: object + required: + - businessAddress + - businessContact + - messageVolume + - phoneNumbers + - useCase + - useCaseSummary + - productionMessageContent + - optInWorkflow + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + phoneNumbers: + type: array + minItems: 1 + maxItems: 10 + items: + $ref: '#/components/schemas/tfPhoneNumber' + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 1 + maxLength: 500 + nullable: false + productionMessageContent: + type: string + description: Example of message content. + minLength: 1 + maxLength: 500 + nullable: false + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + isvReseller: + $ref: '#/components/schemas/isvReseller' + verificationUpdateRequest: + type: object + required: + - businessAddress + - businessContact + - messageVolume + - useCase + - useCaseSummary + - productionMessageContent + - optInWorkflow + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 0 + maxLength: 500 + nullable: false + productionMessageContent: + type: string + description: Example of message content. + minLength: 0 + maxLength: 500 + nullable: false + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + isvReseller: + $ref: '#/components/schemas/isvReseller' + tfvBasicAuthentication: + type: object + properties: + username: + type: string + maxLength: 100 + password: + type: string + maxLength: 200 + required: + - username + - password + webhookSubscriptionRequestSchema: + type: object + properties: + basicAuthentication: + $ref: '#/components/schemas/tfvBasicAuthentication' + callbackUrl: + $ref: '#/components/schemas/webhookUrl' + sharedSecretKey: + $ref: '#/components/schemas/sharedSecretKey' + required: + - callbackUrl + failureWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + errorCode: + type: string + description: >- + An error code indicating what error was encountered. This code can + be interpreted as an HTTP status code in regards to the error that + was encountered. + example: '400' + errorDescription: + type: string + description: A description of the error that was encountered. + example: cannot process request. + errors: + $ref: '#/components/schemas/tfvWebhookErrors' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + verificationDenialWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + additionalDenialReasons: + description: >- + An optional list of denial reasons in addition to + declineReasonDescription when multiple reasons apply. + items: + $ref: '#/components/schemas/additionalDenialReason' + example: + - statusCode: 512 + reason: Reason A + resubmitAllowed: true + - statusCode: 513 + reason: Reason B + resubmitAllowed: true + type: array + declineReasonDescription: + $ref: '#/components/schemas/declineReasonDescription' + denialStatusCode: + $ref: '#/components/schemas/denialStatusCode' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + status: + $ref: '#/components/schemas/tfvUnverifiedStatus' + verificationWebhook: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId1' + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + status: + $ref: '#/components/schemas/tfvCallbackStatusEnum' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumberForWebhook' + tfvSubmissionWrapper: + type: object + properties: + submission: + $ref: '#/components/schemas/verificationUpdateRequest' + address: + type: object + nullable: false + required: + - name + - addr1 + - city + - state + - zip + - url + properties: + name: + type: string + description: The name of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Bandwidth Inc. + addr1: + type: string + description: The address of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: 2230 Bandmate Way + addr2: + type: string + description: The address of the business using the toll-free number. + minLength: 0 + maxLength: 500 + nullable: true + city: + type: string + description: The city of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Raleigh + state: + type: string + description: The state of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: NC + zip: + type: string + description: The zip of the business using the toll-free number. + nullable: false + example: '27606' + pattern: '[- A-Za-z0-9]{0,500}' + url: + type: string + format: url + description: The website of the business using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: https://www.example.com/path/to/resource + optInWorkflow: + type: object + nullable: false + required: + - description + - imageUrls + properties: + description: + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: Opt In Flow + imageUrls: + type: array + items: + type: string + minLength: 1 + maxLength: 500 + nullable: false + example: https://www.example.com/path/to/resource + pattern: >- + ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*) + isvReseller: + type: string + description: ISV name. + minLength: 0 + maxLength: 500 + nullable: true + example: Test ISV + contact: + type: object + nullable: false + required: + - firstName + - lastName + - email + - phoneNumber + properties: + firstName: + type: string + description: The first name of the business contact using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: John + lastName: + type: string + description: The last name of the business contact using the toll-free number. + minLength: 1 + maxLength: 500 + nullable: false + example: Doe + email: + $ref: '#/components/schemas/email' + phoneNumber: + $ref: '#/components/schemas/businessContactPhoneNumber' + email: + type: string + format: email + minLength: 0 + maxLength: 500 + nullable: false + pattern: >- + ^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$ + example: foo@bar.com + useCases: + type: array + items: + type: string + example: + - 2FA + - App Notifications + - Appointments + - Auctions + - Auto Repair Services + - Bank Transfers + - Billing + - Booking Confirmations + - Business Updates + - COVID-19 Alerts + useCase: + type: string + description: The category of the use case. + minLength: 0 + maxLength: 500 + example: 2FA + webhookSubscriptionsListBody: + description: >- + A list of all webhook subscriptions registered for this account ID for + this particular feature (unpaginated). + type: object + required: + - data + properties: + links: + $ref: '#/components/schemas/linksObject' + errors: + type: array + items: + $ref: '#/components/schemas/error' + data: + items: + $ref: '#/components/schemas/webhookSubscription' + type: array + linksObject: + type: object + properties: + first: + description: The first (or only) page of results matching the query. + type: string + next: + description: >- + If more results exist than specified by 'size', this link returns + the next page of 'size' results. + type: string + previous: + description: >- + If the results are more than one page, this link returns the + previous page of 'size' results. + type: string + last: + description: >- + If more results exist than specified by 'size', this link return the + last page of result. + type: string + error: + type: object + properties: + code: + type: integer + description: + type: string + telephoneNumbers: + type: array + items: + $ref: '#/components/schemas/telephoneNumber' + telephoneNumber: + type: object + properties: + telephoneNumber: + description: Simple Telephone Number. + type: string + webhookSubscriptionTypeEnum: + type: string + enum: + - TOLLFREE_VERIFICATION_STATUS + - MESSAGING_PORTOUT_APPROVAL_STATUS + example: TOLLFREE_VERIFICATION_STATUS + webhookSubscription: + description: >- + Information about a webhook that Bandwidth should send upon the + completion of event customer has subscribed to. + type: object + required: + - callbackUrl + properties: + id: + type: string + example: 7hICGStfAfeGxEq3N0lQwO + accountId: + type: string + example: '1234567' + callbackUrl: + $ref: '#/components/schemas/webhookUrl' + type: + $ref: '#/components/schemas/webhookSubscriptionTypeEnum' + basicAuthentication: + description: >- + Basic authentication credentials are not required, but if present, + both username and password must be provided. + type: object + required: + - username + - password + properties: + username: + type: string + maxLength: 100 + password: + type: string + maxLength: 200 + createdDate: + type: string + format: date-time + example: '2023-05-15T13:56:39.965Z' + modifiedDate: + type: string + format: date-time + example: '2023-05-15T13:56:39.965Z' + webhookUrl: + description: >- + Callback URL to receive status updates from Bandwidth. When a webhook + subscription is registered with Bandwidth under a given account ID, it + will be used to send status updates for all requests submitted under + that account ID. + type: string + format: url + minLength: 0 + maxLength: 2000 + nullable: true + example: https://www.example.com/path/to/resource + pattern: >- + ^$|(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,253}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#()?&//=]*) + tfvError: + description: A generic error object. + properties: + type: + type: string + example: Error Type + description: + type: string + example: Error Message + errors: + type: object + description: >- + Each key of this errors object refers to a field of the submitted + object (using dot notation for nested objects), with the field being + a key to an array of one or more errors for that field. + example: + field: error message + type: object + tfvStatus: + type: object + properties: + phoneNumber: + $ref: '#/components/schemas/tfPhoneNumber' + status: + $ref: '#/components/schemas/tfvStatusEnum' + internalTicketNumber: + $ref: '#/components/schemas/internalTicketNumber' + declineReasonDescription: + $ref: '#/components/schemas/declineReasonDescription' + resubmitAllowed: + $ref: '#/components/schemas/resubmitAllowed' + createdDateTime: + type: string + description: Date and time the verification request was created. + format: date-time + example: '2021-06-08T06:45:13.0Z' + modifiedDateTime: + type: string + description: Date and time the verification request was last modified. + format: date-time + example: '2021-06-08T06:45:13.0Z' + submission: + $ref: '#/components/schemas/tfvSubmissionInfo' + tfvSubmissionInfo: + type: object + properties: + businessAddress: + $ref: '#/components/schemas/address' + businessContact: + $ref: '#/components/schemas/contact' + messageVolume: + type: integer + description: Estimated monthly volume of messages from the toll-free number. + minimum: 10 + maximum: 10000000 + example: 10000 + useCase: + $ref: '#/components/schemas/useCase' + useCaseSummary: + type: string + description: A general idea of the use case and customer. + minLength: 0 + maxLength: 500 + nullable: false + example: Text summarizing the use case for the toll-free number + productionMessageContent: + type: string + description: Example of message content. + minLength: 0 + maxLength: 500 + nullable: false + example: Production message content + optInWorkflow: + $ref: '#/components/schemas/optInWorkflow' + additionalInformation: + type: string + description: Any additional information. + minLength: 0 + maxLength: 500 + nullable: true + example: Any additional information + isvReseller: + $ref: '#/components/schemas/isvReseller' + tfvStatusEnum: + type: string + enum: + - VERIFIED + - UNVERIFIED + - PENDING + - PARTIALLY_VERIFIED + - INVALID_STATUS + example: VERIFIED + sharedSecretKey: + description: >- + An ASCII string submitted by the user as a shared secret key for + generating an HMAC header for callbacks. + example: This is my $3cret + maxLength: 64 + minLength: 16 + nullable: true + pattern: ^[ -~]{16,64}$ + type: string responses: createMessageResponse: description: Accepted @@ -4860,6 +5759,120 @@ components: summary: Example Internal Server Error Error value: message: Request has not been passed further. + getTollFreeVerificationStatusResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/tfvStatus' + listWebhookSubscriptionsResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionsListBody' + createWebhookSubscriptionResponse: + description: Created + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + updateWebhookSubscriptionResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscription' + listTollFreeUseCasesResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/useCases' + tfvBadRequestResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Cannot process request. + type: bad request + tfvPostBadRequestResponse: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: cannot process request. + errors: + businessName: Business name is required. + businessContactEmail: Business contact email is not a valid email address. + optInWorkflowImageURLs: Entries must be a valid array of objects. + tfvUnauthorizedResponse: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Client is providing incorrect or invalid credentials. + type: unauthorized + tfvForbiddenResponse: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Client is not authorized for the action. + type: forbidden + tfvNotFoundResponse: + description: Cannot find the requested resource. + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Cannot find the requested resource. + type: Not Found + tfvNotAllowedResponse: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Method is not allowed. + type: Method Not Allowed + tfvTooManyRequestsResponse: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Throttling error. Too many requests. + type: Too Many Requests + tfvServerErrorResponse: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Internal Server Error. + type: Internal Server Error + tfvServiceUnavailableResponse: + description: Service Unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/tfvError' + example: + description: Service Unavailable Error. + type: Service Unavailable parameters: accountId: in: path @@ -5227,6 +6240,22 @@ components: type: string description: The phone number lookup request ID from Bandwidth. example: 004223a0-8b17-41b1-bf81-20732adf5590 + tfPhoneNumberPathParam: + in: path + name: phoneNumber + required: true + schema: + $ref: '#/components/schemas/tfPhoneNumber' + description: Valid Toll-Free telephone number in E.164 format. + example: '+18885555555' + webhookSubscriptionIdPathParam: + in: path + name: id + required: true + schema: + type: string + description: Webhook subscription ID + example: 7bt57JcsVYJrN9K1OcV1Nu examples: smsMessageReceivedCallbackExample: summary: An example of a sms message-received callback body. @@ -5843,6 +6872,39 @@ components: $ref: '#/components/examples/singleNumberRequestExample' multipleNumberRequestExample: $ref: '#/components/examples/multipleNumberRequestExample' + requestTollFreeVerificationRequest: + description: Request for verification of a toll-free phone number. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/verificationRequest' + updateTollFreeVerificationRequestRequest: + description: Update a request for verification of a toll-free phone number. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/tfvSubmissionWrapper' + verificationWebhookRequest: + description: Verification callback status of a toll-free phone number. + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/verificationWebhook' + - $ref: '#/components/schemas/verificationDenialWebhook' + - $ref: '#/components/schemas/failureWebhook' + webhookSubscriptionRequest: + description: >- + Information about a webhook that Bandwidth should send upon the + completion of event customer is trying to subscribe to. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/webhookSubscriptionRequestSchema' securitySchemes: Basic: type: http @@ -5913,3 +6975,43 @@ components: responses: '200': description: OK + tfVerificationStatus: + your_url.com/webhookService: + post: + summary: TFV status updates sent to customer's webhook URL. + description: >- + Unique webhook URL provided by customers to which Bandwidth sends a + POST request to notify customer regarding TFV status updates. + operationId: tfvRequest + parameters: + - description: >- + 64-character lowercase hexidecimal HMAC calculated with a shared + secret key, the canonicalized request body, and SHA256. It is + only included when a shared secret key is set through webhook + subscription. + example: ca7b9e9816c90d336f5dca529e733354b81535c7af027b81878ac98afb2dbaa2 + in: header + name: x-bandwidth-signature-hmac-sha256 + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/verificationWebhookRequest' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/tfvBadRequestResponse' + '401': + $ref: '#/components/responses/tfvUnauthorizedResponse' + '403': + $ref: '#/components/responses/tfvForbiddenResponse' + '404': + $ref: '#/components/responses/tfvNotFoundResponse' + '405': + $ref: '#/components/responses/tfvNotAllowedResponse' + '429': + $ref: '#/components/responses/tfvTooManyRequestsResponse' + '500': + $ref: '#/components/responses/tfvServerErrorResponse' + '503': + $ref: '#/components/responses/tfvServiceUnavailableResponse' diff --git a/base.ts b/base.ts index 248eb2c..a70eaa4 100644 --- a/base.ts +++ b/base.ts @@ -299,6 +299,54 @@ export const operationServerMap: ServerMap = { description: "Production", } ], + "TollFreeVerificationApi.createWebhookSubscription": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.deleteWebhookSubscription": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.getTollFreeVerificationStatus": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.listTollFreeUseCases": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.listWebhookSubscriptions": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.requestTollFreeVerification": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.updateTollFreeVerificationRequest": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], + "TollFreeVerificationApi.updateWebhookSubscription": [ + { + url: "https://api.bandwidth.com/api/v2", + description: "Production", + } + ], "TranscriptionsApi.deleteRealTimeTranscription": [ { url: "https://voice.bandwidth.com/api/v2", diff --git a/configuration.ts b/configuration.ts index f2c6aa7..93c8cf0 100644 --- a/configuration.ts +++ b/configuration.ts @@ -93,7 +93,7 @@ export class Configuration { ...param.baseOptions, headers: { ...param.baseOptions?.headers, - 'User-Agent': "OpenAPI-Generator/1.0.0/typescript-axios" + 'User-Agent': "OpenAPI-Generator/1.0.0-dev/typescript-axios" } }; this.formDataCtor = param.formDataCtor; diff --git a/models/additional-denial-reason.ts b/models/additional-denial-reason.ts new file mode 100644 index 0000000..5836adc --- /dev/null +++ b/models/additional-denial-reason.ts @@ -0,0 +1,42 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface AdditionalDenialReason + */ +export interface AdditionalDenialReason { + /** + * Reason code for denial. + * @type {number} + * @memberof AdditionalDenialReason + */ + 'statusCode': number; + /** + * Explanation for why a verification request was declined. + * @type {string} + * @memberof AdditionalDenialReason + */ + 'reason': string; + /** + * Whether a Toll-Free Verification request qualifies for resubmission via PUT. + * @type {boolean} + * @memberof AdditionalDenialReason + */ + 'resubmitAllowed': boolean; +} + diff --git a/models/address.ts b/models/address.ts new file mode 100644 index 0000000..369d3a4 --- /dev/null +++ b/models/address.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface Address + */ +export interface Address { + /** + * The name of the business using the toll-free number. + * @type {string} + * @memberof Address + */ + 'name': string; + /** + * The address of the business using the toll-free number. + * @type {string} + * @memberof Address + */ + 'addr1': string; + /** + * The address of the business using the toll-free number. + * @type {string} + * @memberof Address + */ + 'addr2'?: string | null; + /** + * The city of the business using the toll-free number. + * @type {string} + * @memberof Address + */ + 'city': string; + /** + * The state of the business using the toll-free number. + * @type {string} + * @memberof Address + */ + 'state': string; + /** + * The zip of the business using the toll-free number. + * @type {string} + * @memberof Address + */ + 'zip': string; + /** + * The website of the business using the toll-free number. + * @type {string} + * @memberof Address + */ + 'url': string; +} + diff --git a/models/contact.ts b/models/contact.ts new file mode 100644 index 0000000..e98dbad --- /dev/null +++ b/models/contact.ts @@ -0,0 +1,48 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface Contact + */ +export interface Contact { + /** + * The first name of the business contact using the toll-free number. + * @type {string} + * @memberof Contact + */ + 'firstName': string; + /** + * The last name of the business contact using the toll-free number. + * @type {string} + * @memberof Contact + */ + 'lastName': string; + /** + * + * @type {string} + * @memberof Contact + */ + 'email': string; + /** + * Contact telephone number + * @type {string} + * @memberof Contact + */ + 'phoneNumber': string; +} + diff --git a/models/failure-webhook.ts b/models/failure-webhook.ts new file mode 100644 index 0000000..de0eaf7 --- /dev/null +++ b/models/failure-webhook.ts @@ -0,0 +1,60 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface FailureWebhook + */ +export interface FailureWebhook { + /** + * User\'s account ID. + * @type {string} + * @memberof FailureWebhook + */ + 'accountId'?: string; + /** + * Toll-free telephone number in E.164 format. + * @type {string} + * @memberof FailureWebhook + */ + 'phoneNumber'?: string; + /** + * An error code indicating what error was encountered. This code can be interpreted as an HTTP status code in regards to the error that was encountered. + * @type {string} + * @memberof FailureWebhook + */ + 'errorCode'?: string; + /** + * A description of the error that was encountered. + * @type {string} + * @memberof FailureWebhook + */ + 'errorDescription'?: string; + /** + * Details of the errors that were encountered when processing the request. + * @type {Array} + * @memberof FailureWebhook + */ + 'errors'?: Array; + /** + * Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * @type {string} + * @memberof FailureWebhook + */ + 'internalTicketNumber'?: string; +} + diff --git a/models/index.ts b/models/index.ts index 052f58a..3656aa0 100644 --- a/models/index.ts +++ b/models/index.ts @@ -1,4 +1,6 @@ export * from './account-statistics'; +export * from './additional-denial-reason'; +export * from './address'; export * from './answer-callback'; export * from './bridge-complete-callback'; export * from './bridge-target-complete-callback'; @@ -24,6 +26,7 @@ export * from './conference-recording-available-callback'; export * from './conference-recording-metadata'; export * from './conference-redirect-callback'; export * from './conference-state-enum'; +export * from './contact'; export * from './create-call'; export * from './create-call-response'; export * from './create-lookup-response'; @@ -32,10 +35,12 @@ export * from './deferred-result'; export * from './disconnect-callback'; export * from './diversion'; export * from './dtmf-callback'; +export * from './failure-webhook'; export * from './field-error'; export * from './file-format-enum'; export * from './gather-callback'; export * from './initiate-callback'; +export * from './links-object'; export * from './list-message-direction-enum'; export * from './list-message-item'; export * from './lookup-request'; @@ -60,6 +65,8 @@ export * from './messaging-request-error'; export * from './mfa-forbidden-request-error'; export * from './mfa-request-error'; export * from './mfa-unauthorized-request-error'; +export * from './model-error'; +export * from './opt-in-workflow'; export * from './page-info'; export * from './priority-enum'; export * from './recording-available-callback'; @@ -71,6 +78,14 @@ export * from './redirect-callback'; export * from './redirect-method-enum'; export * from './stir-shaken'; export * from './tag'; +export * from './telephone-number'; +export * from './tfv-basic-authentication'; +export * from './tfv-callback-status-enum'; +export * from './tfv-error'; +export * from './tfv-status'; +export * from './tfv-status-enum'; +export * from './tfv-submission-info'; +export * from './tfv-submission-wrapper'; export * from './tn-lookup-request-error'; export * from './transcribe-recording'; export * from './transcription'; @@ -82,8 +97,17 @@ export * from './update-call'; export * from './update-call-recording'; export * from './update-conference'; export * from './update-conference-member'; +export * from './verification-denial-webhook'; +export * from './verification-request'; +export * from './verification-update-request'; +export * from './verification-webhook'; export * from './verify-code-request'; export * from './verify-code-response'; export * from './voice-api-error'; export * from './voice-code-response'; +export * from './webhook-subscription'; +export * from './webhook-subscription-basic-authentication'; +export * from './webhook-subscription-request-schema'; +export * from './webhook-subscription-type-enum'; +export * from './webhook-subscriptions-list-body'; export * from './bxml'; diff --git a/models/links-object.ts b/models/links-object.ts new file mode 100644 index 0000000..52a5fb3 --- /dev/null +++ b/models/links-object.ts @@ -0,0 +1,48 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface LinksObject + */ +export interface LinksObject { + /** + * The first (or only) page of results matching the query. + * @type {string} + * @memberof LinksObject + */ + 'first'?: string; + /** + * If more results exist than specified by \'size\', this link returns the next page of \'size\' results. + * @type {string} + * @memberof LinksObject + */ + 'next'?: string; + /** + * If the results are more than one page, this link returns the previous page of \'size\' results. + * @type {string} + * @memberof LinksObject + */ + 'previous'?: string; + /** + * If more results exist than specified by \'size\', this link return the last page of result. + * @type {string} + * @memberof LinksObject + */ + 'last'?: string; +} + diff --git a/models/model-error.ts b/models/model-error.ts new file mode 100644 index 0000000..ec1211f --- /dev/null +++ b/models/model-error.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { TelephoneNumber } from './telephone-number'; + +/** + * + * @export + * @interface ModelError + */ +export interface ModelError { + /** + * + * @type {number} + * @memberof ModelError + */ + 'code'?: number; + /** + * + * @type {string} + * @memberof ModelError + */ + 'description'?: string; + /** + * + * @type {Array} + * @memberof ModelError + */ + 'telephoneNumbers'?: Array; +} + diff --git a/models/opt-in-workflow.ts b/models/opt-in-workflow.ts new file mode 100644 index 0000000..33523fa --- /dev/null +++ b/models/opt-in-workflow.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface OptInWorkflow + */ +export interface OptInWorkflow { + /** + * + * @type {string} + * @memberof OptInWorkflow + */ + 'description': string; + /** + * + * @type {Array} + * @memberof OptInWorkflow + */ + 'imageUrls': Array; +} + diff --git a/models/telephone-number.ts b/models/telephone-number.ts new file mode 100644 index 0000000..d6a8124 --- /dev/null +++ b/models/telephone-number.ts @@ -0,0 +1,30 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface TelephoneNumber + */ +export interface TelephoneNumber { + /** + * Simple Telephone Number. + * @type {string} + * @memberof TelephoneNumber + */ + 'telephoneNumber'?: string; +} + diff --git a/models/tfv-basic-authentication.ts b/models/tfv-basic-authentication.ts new file mode 100644 index 0000000..006320e --- /dev/null +++ b/models/tfv-basic-authentication.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @interface TfvBasicAuthentication + */ +export interface TfvBasicAuthentication { + /** + * + * @type {string} + * @memberof TfvBasicAuthentication + */ + 'username': string; + /** + * + * @type {string} + * @memberof TfvBasicAuthentication + */ + 'password': string; +} + diff --git a/models/tfv-callback-status-enum.ts b/models/tfv-callback-status-enum.ts new file mode 100644 index 0000000..ecb2f03 --- /dev/null +++ b/models/tfv-callback-status-enum.ts @@ -0,0 +1,31 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @enum {string} + */ + +export const TfvCallbackStatusEnum = { + Verified: 'VERIFIED', + Unverified: 'UNVERIFIED' +} as const; + +export type TfvCallbackStatusEnum = typeof TfvCallbackStatusEnum[keyof typeof TfvCallbackStatusEnum]; + + + diff --git a/models/tfv-error.ts b/models/tfv-error.ts new file mode 100644 index 0000000..667f672 --- /dev/null +++ b/models/tfv-error.ts @@ -0,0 +1,42 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * A generic error object. + * @export + * @interface TfvError + */ +export interface TfvError { + /** + * + * @type {string} + * @memberof TfvError + */ + 'type'?: string; + /** + * + * @type {string} + * @memberof TfvError + */ + 'description'?: string; + /** + * Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field. + * @type {object} + * @memberof TfvError + */ + 'errors'?: object; +} + diff --git a/models/tfv-status-enum.ts b/models/tfv-status-enum.ts new file mode 100644 index 0000000..653ae35 --- /dev/null +++ b/models/tfv-status-enum.ts @@ -0,0 +1,34 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @enum {string} + */ + +export const TfvStatusEnum = { + Verified: 'VERIFIED', + Unverified: 'UNVERIFIED', + Pending: 'PENDING', + PartiallyVerified: 'PARTIALLY_VERIFIED', + InvalidStatus: 'INVALID_STATUS' +} as const; + +export type TfvStatusEnum = typeof TfvStatusEnum[keyof typeof TfvStatusEnum]; + + + diff --git a/models/tfv-status.ts b/models/tfv-status.ts new file mode 100644 index 0000000..28f0a44 --- /dev/null +++ b/models/tfv-status.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { TfvStatusEnum } from './tfv-status-enum'; +// May contain unused imports in some cases +// @ts-ignore +import type { TfvSubmissionInfo } from './tfv-submission-info'; + +/** + * + * @export + * @interface TfvStatus + */ +export interface TfvStatus { + /** + * Toll-free telephone number in E.164 format. + * @type {string} + * @memberof TfvStatus + */ + 'phoneNumber'?: string; + /** + * + * @type {TfvStatusEnum} + * @memberof TfvStatus + */ + 'status'?: TfvStatusEnum; + /** + * Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number - included in all webhook payloads. + * @type {string} + * @memberof TfvStatus + */ + 'internalTicketNumber'?: string; + /** + * Explanation for why a verification request was declined. + * @type {string} + * @memberof TfvStatus + */ + 'declineReasonDescription'?: string; + /** + * Whether a Toll-Free Verification request qualifies for resubmission via PUT. + * @type {boolean} + * @memberof TfvStatus + */ + 'resubmitAllowed'?: boolean; + /** + * Date and time the verification request was created. + * @type {string} + * @memberof TfvStatus + */ + 'createdDateTime'?: string; + /** + * Date and time the verification request was last modified. + * @type {string} + * @memberof TfvStatus + */ + 'modifiedDateTime'?: string; + /** + * + * @type {TfvSubmissionInfo} + * @memberof TfvStatus + */ + 'submission'?: TfvSubmissionInfo; +} + + + diff --git a/models/tfv-submission-info.ts b/models/tfv-submission-info.ts new file mode 100644 index 0000000..46182ba --- /dev/null +++ b/models/tfv-submission-info.ts @@ -0,0 +1,87 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { Address } from './address'; +// May contain unused imports in some cases +// @ts-ignore +import type { Contact } from './contact'; +// May contain unused imports in some cases +// @ts-ignore +import type { OptInWorkflow } from './opt-in-workflow'; + +/** + * + * @export + * @interface TfvSubmissionInfo + */ +export interface TfvSubmissionInfo { + /** + * + * @type {Address} + * @memberof TfvSubmissionInfo + */ + 'businessAddress'?: Address; + /** + * + * @type {Contact} + * @memberof TfvSubmissionInfo + */ + 'businessContact'?: Contact; + /** + * Estimated monthly volume of messages from the toll-free number. + * @type {number} + * @memberof TfvSubmissionInfo + */ + 'messageVolume'?: number; + /** + * The category of the use case. + * @type {string} + * @memberof TfvSubmissionInfo + */ + 'useCase'?: string; + /** + * A general idea of the use case and customer. + * @type {string} + * @memberof TfvSubmissionInfo + */ + 'useCaseSummary'?: string; + /** + * Example of message content. + * @type {string} + * @memberof TfvSubmissionInfo + */ + 'productionMessageContent'?: string; + /** + * + * @type {OptInWorkflow} + * @memberof TfvSubmissionInfo + */ + 'optInWorkflow'?: OptInWorkflow; + /** + * Any additional information. + * @type {string} + * @memberof TfvSubmissionInfo + */ + 'additionalInformation'?: string | null; + /** + * ISV name. + * @type {string} + * @memberof TfvSubmissionInfo + */ + 'isvReseller'?: string | null; +} + diff --git a/models/tfv-submission-wrapper.ts b/models/tfv-submission-wrapper.ts new file mode 100644 index 0000000..1692cb2 --- /dev/null +++ b/models/tfv-submission-wrapper.ts @@ -0,0 +1,33 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { VerificationUpdateRequest } from './verification-update-request'; + +/** + * + * @export + * @interface TfvSubmissionWrapper + */ +export interface TfvSubmissionWrapper { + /** + * + * @type {VerificationUpdateRequest} + * @memberof TfvSubmissionWrapper + */ + 'submission'?: VerificationUpdateRequest; +} + diff --git a/models/verification-denial-webhook.ts b/models/verification-denial-webhook.ts new file mode 100644 index 0000000..f8fb6a3 --- /dev/null +++ b/models/verification-denial-webhook.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { AdditionalDenialReason } from './additional-denial-reason'; + +/** + * + * @export + * @interface VerificationDenialWebhook + */ +export interface VerificationDenialWebhook { + /** + * User\'s account ID. + * @type {string} + * @memberof VerificationDenialWebhook + */ + 'accountId'?: string; + /** + * An optional list of denial reasons in addition to declineReasonDescription when multiple reasons apply. + * @type {Array} + * @memberof VerificationDenialWebhook + */ + 'additionalDenialReasons'?: Array; + /** + * Explanation for why a verification request was declined. + * @type {string} + * @memberof VerificationDenialWebhook + */ + 'declineReasonDescription'?: string; + /** + * Reason code for denial. + * @type {number} + * @memberof VerificationDenialWebhook + */ + 'denialStatusCode'?: number; + /** + * Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * @type {string} + * @memberof VerificationDenialWebhook + */ + 'internalTicketNumber'?: string; + /** + * Toll-free telephone number in E.164 format. + * @type {string} + * @memberof VerificationDenialWebhook + */ + 'phoneNumber'?: string; + /** + * Whether a Toll-Free Verification request qualifies for resubmission via PUT. + * @type {boolean} + * @memberof VerificationDenialWebhook + */ + 'resubmitAllowed'?: boolean; + /** + * + * @type {string} + * @memberof VerificationDenialWebhook + */ + 'status'?: string; +} + diff --git a/models/verification-request.ts b/models/verification-request.ts new file mode 100644 index 0000000..be367c3 --- /dev/null +++ b/models/verification-request.ts @@ -0,0 +1,93 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { Address } from './address'; +// May contain unused imports in some cases +// @ts-ignore +import type { Contact } from './contact'; +// May contain unused imports in some cases +// @ts-ignore +import type { OptInWorkflow } from './opt-in-workflow'; + +/** + * + * @export + * @interface VerificationRequest + */ +export interface VerificationRequest { + /** + * + * @type {Address} + * @memberof VerificationRequest + */ + 'businessAddress': Address; + /** + * + * @type {Contact} + * @memberof VerificationRequest + */ + 'businessContact': Contact; + /** + * Estimated monthly volume of messages from the toll-free number. + * @type {number} + * @memberof VerificationRequest + */ + 'messageVolume': number; + /** + * + * @type {Array} + * @memberof VerificationRequest + */ + 'phoneNumbers': Array; + /** + * The category of the use case. + * @type {string} + * @memberof VerificationRequest + */ + 'useCase': string; + /** + * A general idea of the use case and customer. + * @type {string} + * @memberof VerificationRequest + */ + 'useCaseSummary': string; + /** + * Example of message content. + * @type {string} + * @memberof VerificationRequest + */ + 'productionMessageContent': string; + /** + * + * @type {OptInWorkflow} + * @memberof VerificationRequest + */ + 'optInWorkflow': OptInWorkflow; + /** + * Any additional information. + * @type {string} + * @memberof VerificationRequest + */ + 'additionalInformation'?: string | null; + /** + * ISV name. + * @type {string} + * @memberof VerificationRequest + */ + 'isvReseller'?: string | null; +} + diff --git a/models/verification-update-request.ts b/models/verification-update-request.ts new file mode 100644 index 0000000..7e23314 --- /dev/null +++ b/models/verification-update-request.ts @@ -0,0 +1,87 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { Address } from './address'; +// May contain unused imports in some cases +// @ts-ignore +import type { Contact } from './contact'; +// May contain unused imports in some cases +// @ts-ignore +import type { OptInWorkflow } from './opt-in-workflow'; + +/** + * + * @export + * @interface VerificationUpdateRequest + */ +export interface VerificationUpdateRequest { + /** + * + * @type {Address} + * @memberof VerificationUpdateRequest + */ + 'businessAddress': Address; + /** + * + * @type {Contact} + * @memberof VerificationUpdateRequest + */ + 'businessContact': Contact; + /** + * Estimated monthly volume of messages from the toll-free number. + * @type {number} + * @memberof VerificationUpdateRequest + */ + 'messageVolume': number; + /** + * The category of the use case. + * @type {string} + * @memberof VerificationUpdateRequest + */ + 'useCase': string; + /** + * A general idea of the use case and customer. + * @type {string} + * @memberof VerificationUpdateRequest + */ + 'useCaseSummary': string; + /** + * Example of message content. + * @type {string} + * @memberof VerificationUpdateRequest + */ + 'productionMessageContent': string; + /** + * + * @type {OptInWorkflow} + * @memberof VerificationUpdateRequest + */ + 'optInWorkflow': OptInWorkflow; + /** + * Any additional information. + * @type {string} + * @memberof VerificationUpdateRequest + */ + 'additionalInformation'?: string | null; + /** + * ISV name. + * @type {string} + * @memberof VerificationUpdateRequest + */ + 'isvReseller'?: string | null; +} + diff --git a/models/verification-webhook.ts b/models/verification-webhook.ts new file mode 100644 index 0000000..4d25d8e --- /dev/null +++ b/models/verification-webhook.ts @@ -0,0 +1,53 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { TfvCallbackStatusEnum } from './tfv-callback-status-enum'; + +/** + * + * @export + * @interface VerificationWebhook + */ +export interface VerificationWebhook { + /** + * User\'s account ID. + * @type {string} + * @memberof VerificationWebhook + */ + 'accountId'?: string; + /** + * Toll-free telephone number in E.164 format. + * @type {string} + * @memberof VerificationWebhook + */ + 'phoneNumber'?: string; + /** + * + * @type {TfvCallbackStatusEnum} + * @memberof VerificationWebhook + */ + 'status'?: TfvCallbackStatusEnum; + /** + * Unique identifier (UUID) generated by Bandwidth to assist in tracking the verification status of a toll-free number. + * @type {string} + * @memberof VerificationWebhook + */ + 'internalTicketNumber'?: string; +} + + + diff --git a/models/webhook-subscription-basic-authentication.ts b/models/webhook-subscription-basic-authentication.ts new file mode 100644 index 0000000..c706292 --- /dev/null +++ b/models/webhook-subscription-basic-authentication.ts @@ -0,0 +1,36 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * Basic authentication credentials are not required, but if present, both username and password must be provided. + * @export + * @interface WebhookSubscriptionBasicAuthentication + */ +export interface WebhookSubscriptionBasicAuthentication { + /** + * + * @type {string} + * @memberof WebhookSubscriptionBasicAuthentication + */ + 'username': string; + /** + * + * @type {string} + * @memberof WebhookSubscriptionBasicAuthentication + */ + 'password': string; +} + diff --git a/models/webhook-subscription-request-schema.ts b/models/webhook-subscription-request-schema.ts new file mode 100644 index 0000000..4581526 --- /dev/null +++ b/models/webhook-subscription-request-schema.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { TfvBasicAuthentication } from './tfv-basic-authentication'; + +/** + * + * @export + * @interface WebhookSubscriptionRequestSchema + */ +export interface WebhookSubscriptionRequestSchema { + /** + * + * @type {TfvBasicAuthentication} + * @memberof WebhookSubscriptionRequestSchema + */ + 'basicAuthentication'?: TfvBasicAuthentication; + /** + * Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. + * @type {string} + * @memberof WebhookSubscriptionRequestSchema + */ + 'callbackUrl': string | null; + /** + * An ASCII string submitted by the user as a shared secret key for generating an HMAC header for callbacks. + * @type {string} + * @memberof WebhookSubscriptionRequestSchema + */ + 'sharedSecretKey'?: string | null; +} + diff --git a/models/webhook-subscription-type-enum.ts b/models/webhook-subscription-type-enum.ts new file mode 100644 index 0000000..5dfbfa4 --- /dev/null +++ b/models/webhook-subscription-type-enum.ts @@ -0,0 +1,31 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +/** + * + * @export + * @enum {string} + */ + +export const WebhookSubscriptionTypeEnum = { + TollfreeVerificationStatus: 'TOLLFREE_VERIFICATION_STATUS', + MessagingPortoutApprovalStatus: 'MESSAGING_PORTOUT_APPROVAL_STATUS' +} as const; + +export type WebhookSubscriptionTypeEnum = typeof WebhookSubscriptionTypeEnum[keyof typeof WebhookSubscriptionTypeEnum]; + + + diff --git a/models/webhook-subscription.ts b/models/webhook-subscription.ts new file mode 100644 index 0000000..23d2377 --- /dev/null +++ b/models/webhook-subscription.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { WebhookSubscriptionBasicAuthentication } from './webhook-subscription-basic-authentication'; +// May contain unused imports in some cases +// @ts-ignore +import type { WebhookSubscriptionTypeEnum } from './webhook-subscription-type-enum'; + +/** + * Information about a webhook that Bandwidth should send upon the completion of event customer has subscribed to. + * @export + * @interface WebhookSubscription + */ +export interface WebhookSubscription { + /** + * + * @type {string} + * @memberof WebhookSubscription + */ + 'id'?: string; + /** + * + * @type {string} + * @memberof WebhookSubscription + */ + 'accountId'?: string; + /** + * Callback URL to receive status updates from Bandwidth. When a webhook subscription is registered with Bandwidth under a given account ID, it will be used to send status updates for all requests submitted under that account ID. + * @type {string} + * @memberof WebhookSubscription + */ + 'callbackUrl': string | null; + /** + * + * @type {WebhookSubscriptionTypeEnum} + * @memberof WebhookSubscription + */ + 'type'?: WebhookSubscriptionTypeEnum; + /** + * + * @type {WebhookSubscriptionBasicAuthentication} + * @memberof WebhookSubscription + */ + 'basicAuthentication'?: WebhookSubscriptionBasicAuthentication; + /** + * + * @type {string} + * @memberof WebhookSubscription + */ + 'createdDate'?: string; + /** + * + * @type {string} + * @memberof WebhookSubscription + */ + 'modifiedDate'?: string; +} + + + diff --git a/models/webhook-subscriptions-list-body.ts b/models/webhook-subscriptions-list-body.ts new file mode 100644 index 0000000..564109e --- /dev/null +++ b/models/webhook-subscriptions-list-body.ts @@ -0,0 +1,51 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Bandwidth + * Bandwidth\'s Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +// May contain unused imports in some cases +// @ts-ignore +import type { LinksObject } from './links-object'; +// May contain unused imports in some cases +// @ts-ignore +import type { ModelError } from './model-error'; +// May contain unused imports in some cases +// @ts-ignore +import type { WebhookSubscription } from './webhook-subscription'; + +/** + * A list of all webhook subscriptions registered for this account ID for this particular feature (unpaginated). + * @export + * @interface WebhookSubscriptionsListBody + */ +export interface WebhookSubscriptionsListBody { + /** + * + * @type {LinksObject} + * @memberof WebhookSubscriptionsListBody + */ + 'links'?: LinksObject; + /** + * + * @type {Array} + * @memberof WebhookSubscriptionsListBody + */ + 'errors'?: Array; + /** + * + * @type {Array} + * @memberof WebhookSubscriptionsListBody + */ + 'data': Array; +} + diff --git a/package.json b/package.json index 3628cf1..86ab500 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bandwidth-sdk", - "version": "1.0.0", + "version": "1.0.0-dev", "description": "OpenAPI client for bandwidth-sdk", "author": "OpenAPI-Generator Contributors", "repository": { From 0cdf60a55b3f7bbad335745dd87243d1d18c910c Mon Sep 17 00:00:00 2001 From: ckoegel Date: Wed, 12 Feb 2025 14:59:19 -0500 Subject: [PATCH 2/6] generate with version --- configuration.ts | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration.ts b/configuration.ts index 93c8cf0..f2c6aa7 100644 --- a/configuration.ts +++ b/configuration.ts @@ -93,7 +93,7 @@ export class Configuration { ...param.baseOptions, headers: { ...param.baseOptions?.headers, - 'User-Agent': "OpenAPI-Generator/1.0.0-dev/typescript-axios" + 'User-Agent': "OpenAPI-Generator/1.0.0/typescript-axios" } }; this.formDataCtor = param.formDataCtor; diff --git a/package.json b/package.json index 86ab500..3628cf1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bandwidth-sdk", - "version": "1.0.0-dev", + "version": "1.0.0", "description": "OpenAPI client for bandwidth-sdk", "author": "OpenAPI-Generator Contributors", "repository": { From b121fb4e278785d19dabbff5d411bb95a5db8001 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Wed, 12 Feb 2025 15:07:59 -0500 Subject: [PATCH 3/6] add enum model tests --- tests/unit/models/tfv-callback-status-enum.test.ts | 8 ++++++++ tests/unit/models/tfv-status-enum.test.ts | 11 +++++++++++ .../models/webhook-subscription-type-enum.test.ts | 8 ++++++++ 3 files changed, 27 insertions(+) create mode 100644 tests/unit/models/tfv-callback-status-enum.test.ts create mode 100644 tests/unit/models/tfv-status-enum.test.ts create mode 100644 tests/unit/models/webhook-subscription-type-enum.test.ts diff --git a/tests/unit/models/tfv-callback-status-enum.test.ts b/tests/unit/models/tfv-callback-status-enum.test.ts new file mode 100644 index 0000000..a7e81fd --- /dev/null +++ b/tests/unit/models/tfv-callback-status-enum.test.ts @@ -0,0 +1,8 @@ +import { TfvCallbackStatusEnum } from '../../../models/tfv-callback-status-enum'; + +describe('TfvCallbackStatusEnum', () => { + test('should define the expected values', () => { + expect(TfvCallbackStatusEnum.Verified).toBe('VERIFIED'); + expect(TfvCallbackStatusEnum.Unverified).toBe('UNVERIFIED'); + }); +}); diff --git a/tests/unit/models/tfv-status-enum.test.ts b/tests/unit/models/tfv-status-enum.test.ts new file mode 100644 index 0000000..26274aa --- /dev/null +++ b/tests/unit/models/tfv-status-enum.test.ts @@ -0,0 +1,11 @@ +import { TfvStatusEnum } from '../../../models/tfv-status-enum'; + +describe('TfvStatusEnum', () => { + test('should define the expected values', () => { + expect(TfvStatusEnum.Verified).toBe('VERIFIED'); + expect(TfvStatusEnum.Unverified).toBe('UNVERIFIED'); + expect(TfvStatusEnum.Pending).toBe('PENDING'); + expect(TfvStatusEnum.PartiallyVerified).toBe('PARTIALLY_VERIFIED'); + expect(TfvStatusEnum.InvalidStatus).toBe('INVALID_STATUS'); + }); +}); diff --git a/tests/unit/models/webhook-subscription-type-enum.test.ts b/tests/unit/models/webhook-subscription-type-enum.test.ts new file mode 100644 index 0000000..757610f --- /dev/null +++ b/tests/unit/models/webhook-subscription-type-enum.test.ts @@ -0,0 +1,8 @@ +import { WebhookSubscriptionTypeEnum } from '../../../models/webhook-subscription-type-enum'; + +describe('WebhookSubscriptionTypeEnum', () => { + test('should define the expected values', () => { + expect(WebhookSubscriptionTypeEnum.TollfreeVerificationStatus).toBe('TOLLFREE_VERIFICATION_STATUS'); + expect(WebhookSubscriptionTypeEnum.MessagingPortoutApprovalStatus).toBe('MESSAGING_PORTOUT_APPROVAL_STATUS'); + }); +}); From 6588f6f0db2f4d4f1425174812465bc06fc5e3e8 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Wed, 12 Feb 2025 15:30:34 -0500 Subject: [PATCH 4/6] update readme --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cd0a453..d8a2505 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,12 @@ [![Deploy](https://github.com/Bandwidth/node-sdk/actions/workflows/deploy.yml/badge.svg)](https://github.com/Bandwidth/node-sdk/actions/workflows/deploy.yml) -### Test Matrix -| **OS** | **Node** | -|:---:|:---:| +| **OS** | **Node** | +|:------------:|:----------:| | Windows 2019 | 18, 20, 22 | | Windows 2022 | 18, 20, 22 | -| Ubuntu 20.04 | 18, 20, 22 | | Ubuntu 22.04 | 18, 20, 22 | +| Ubuntu 24.04 | 18, 20, 22 | #### Available on NPM ``` From e990a4b85baf653f525c9e32957fc42a21349ca7 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Wed, 12 Feb 2025 16:38:13 -0500 Subject: [PATCH 5/6] update enum tests --- tests/smoke/phone-number-lookup-api.test.ts | 14 ++------------ tests/unit/api/calls-api.test.ts | 10 +++++----- tests/unit/api/conferences-api.test.ts | 8 ++++---- tests/unit/api/messages-api.test.ts | 19 +++++-------------- .../unit/api/phone-number-lookup-api.test.ts | 14 ++------------ tests/unit/api/recordings-api.test.ts | 12 ++++++------ 6 files changed, 24 insertions(+), 53 deletions(-) diff --git a/tests/smoke/phone-number-lookup-api.test.ts b/tests/smoke/phone-number-lookup-api.test.ts index 89062d5..17513fd 100644 --- a/tests/smoke/phone-number-lookup-api.test.ts +++ b/tests/smoke/phone-number-lookup-api.test.ts @@ -21,12 +21,7 @@ describe('PhoneNumberLookupApi', () => { expect(status).toEqual(202); expect(data.requestId).toHaveLength(36); - expect(data.status).toBeOneOf([ - LookupStatusEnum.Complete, - LookupStatusEnum.InProgress, - LookupStatusEnum.Failed, - LookupStatusEnum.PartialComplete - ]); + expect(data.status).toBeOneOf(Object.values(LookupStatusEnum)); lookupRequestId = data.requestId!; await sleep(1); @@ -39,12 +34,7 @@ describe('PhoneNumberLookupApi', () => { expect(status).toEqual(200); expect(data.requestId).toEqual(lookupRequestId); - expect(data.status).toBeOneOf([ - LookupStatusEnum.Complete, - LookupStatusEnum.InProgress, - LookupStatusEnum.Failed, - LookupStatusEnum.PartialComplete - ]); + expect(data.status).toBeOneOf(Object.values(LookupStatusEnum)); expect(data.result).toBeInstanceOf(Array); expect(data.result![0]['Response Code']).toBeInteger(); expect(data.result![0]['E.164 Format']).toEqual(BW_NUMBER); diff --git a/tests/unit/api/calls-api.test.ts b/tests/unit/api/calls-api.test.ts index 4bf7642..415d25f 100644 --- a/tests/unit/api/calls-api.test.ts +++ b/tests/unit/api/calls-api.test.ts @@ -68,11 +68,11 @@ describe('CallsApi', () => { expect(data.callTimeout).toBePositive(); expect(data.callbackTimeout).toBePositive(); expect(data.tag).toBeString(); - expect(data.answerMethod).toBeOneOf([CallbackMethodEnum.Post, CallbackMethodEnum.Get]); + expect(data.answerMethod).toBeOneOf(Object.values(CallbackMethodEnum)); expect(data.answerUrl).toStartWith('http'); - expect(data.answerFallbackMethod).toBeOneOf([CallbackMethodEnum.Post, CallbackMethodEnum.Get]); + expect(data.answerFallbackMethod).toBeOneOf(Object.values(CallbackMethodEnum)); expect(data.answerFallbackUrl).toStartWith('http'); - expect(data.disconnectMethod).toBeOneOf([CallbackMethodEnum.Post, CallbackMethodEnum.Get]); + expect(data.disconnectMethod).toBeOneOf(Object.values(CallbackMethodEnum)); expect(data.disconnectUrl).toStartWith('http'); expect(data.username).toBeString(); expect(data.password).toBeString(); @@ -93,7 +93,7 @@ describe('CallsApi', () => { expect(data.parentCallId).toHaveLength(47); expect(data.to).toHaveLength(12); expect(data.from).toHaveLength(12); - expect(data.direction).toBeOneOf([CallDirectionEnum.Inbound, CallDirectionEnum.Outbound]); + expect(data.direction).toBeOneOf(Object.values(CallDirectionEnum)); expect(data.state).toBeString(); expect(data.stirShaken).toBeObject(); expect(data.identity).toBeString(); @@ -120,7 +120,7 @@ describe('CallsApi', () => { expect(data[0].parentCallId).toHaveLength(47); expect(data[0].to).toHaveLength(12); expect(data[0].from).toHaveLength(12); - expect(data[0].direction).toBeOneOf([CallDirectionEnum.Inbound, CallDirectionEnum.Outbound]); + expect(data[0].direction).toBeOneOf(Object.values(CallDirectionEnum)); expect(data[0].state).toBeString(); expect(data[0].stirShaken).toBeObject(); expect(data[0].identity).toBeString(); diff --git a/tests/unit/api/conferences-api.test.ts b/tests/unit/api/conferences-api.test.ts index 663951a..4bf870a 100644 --- a/tests/unit/api/conferences-api.test.ts +++ b/tests/unit/api/conferences-api.test.ts @@ -32,7 +32,7 @@ describe('ConferencesApi', () => { expect(data[0].createdTime).toBeDateString(); expect(data[0].completedTime).toBeDateString(); expect(data[0].conferenceEventUrl).toStartWith('http'); - expect(data[0].conferenceEventMethod).toBeOneOf([CallbackMethodEnum.Post, CallbackMethodEnum.Get]); + expect(data[0].conferenceEventMethod).toBeOneOf(Object.values(CallbackMethodEnum)); expect(data[0].tag).toBeString(); }); }); @@ -47,7 +47,7 @@ describe('ConferencesApi', () => { expect(data.createdTime).toBeDateString(); expect(data.completedTime).toBeDateString(); expect(data.conferenceEventUrl).toStartWith('http'); - expect(data.conferenceEventMethod).toBeOneOf([CallbackMethodEnum.Post, CallbackMethodEnum.Get]); + expect(data.conferenceEventMethod).toBeOneOf(Object.values(CallbackMethodEnum)); expect(data.tag).toBeString(); }); }); @@ -123,7 +123,7 @@ describe('ConferencesApi', () => { expect(data[0].channels).toBeNumber(); expect(data[0].startTime).toBeDateString(); expect(data[0].endTime).toBeDateString(); - expect(data[0].fileFormat).toBeOneOf([FileFormatEnum.Wav, FileFormatEnum.Mp3]); + expect(data[0].fileFormat).toBeOneOf(Object.values(FileFormatEnum)); expect(data[0].status).toBeString(); expect(data[0].mediaUrl).toStartWith('http'); }); @@ -142,7 +142,7 @@ describe('ConferencesApi', () => { expect(data.channels).toBeNumber(); expect(data.startTime).toBeDateString(); expect(data.endTime).toBeDateString(); - expect(data.fileFormat).toBeOneOf([FileFormatEnum.Wav, FileFormatEnum.Mp3]); + expect(data.fileFormat).toBeOneOf(Object.values(FileFormatEnum)); expect(data.status).toBeString(); expect(data.mediaUrl).toStartWith('http'); }); diff --git a/tests/unit/api/messages-api.test.ts b/tests/unit/api/messages-api.test.ts index d22ef50..736c194 100644 --- a/tests/unit/api/messages-api.test.ts +++ b/tests/unit/api/messages-api.test.ts @@ -44,7 +44,7 @@ describe('MessagesApi', () => { expect(data.applicationId).toHaveLength(36); expect(data.time).toBeDateString(); expect(data.segmentCount).toBeInteger(); - expect(data.direction).toBeOneOf([MessageDirectionEnum.In, MessageDirectionEnum.Out]) + expect(data.direction).toBeOneOf(Object.values(MessageDirectionEnum)); expect(data.to).toBeInstanceOf(Array); expect(data.to![0]).toHaveLength(12); expect(data.from).toHaveLength(12); @@ -52,7 +52,7 @@ describe('MessagesApi', () => { expect(data.media![0]).toStartWith('http'); expect(data.text).toBeString(); expect(data.tag).toBeString(); - expect(data.priority).toBeOneOf([PriorityEnum.Default, PriorityEnum.High]); + expect(data.priority).toBeOneOf(Object.values(PriorityEnum)); expect(data.expiration).toBeDateString(); }); }); @@ -74,18 +74,9 @@ describe('MessagesApi', () => { expect(data.messages![0].accountId).toHaveLength(7); expect(data.messages![0].sourceTn).toHaveLength(12); expect(data.messages![0].destinationTn).toHaveLength(12); - expect(data.messages![0].messageStatus).toBeOneOf([ - MessageStatusEnum.Received, - MessageStatusEnum.Queued, - MessageStatusEnum.Sending, - MessageStatusEnum.Sent, - MessageStatusEnum.Failed, - MessageStatusEnum.Delivered, - MessageStatusEnum.Accepted, - MessageStatusEnum.Undelivered, - ]); - expect(data.messages![0].messageDirection).toBeOneOf([ListMessageDirectionEnum.Inbound, ListMessageDirectionEnum.Outbound]); - expect(data.messages![0].messageType).toBeOneOf([MessageTypeEnum.Sms, MessageTypeEnum.Mms]); + expect(data.messages![0].messageStatus).toBeOneOf(Object.values(MessageStatusEnum)); + expect(data.messages![0].messageDirection).toBeOneOf(Object.values(ListMessageDirectionEnum)); + expect(data.messages![0].messageType).toBeOneOf(Object.values(MessageTypeEnum)); expect(data.messages![0].segmentCount).toBeInteger(); expect(data.messages![0].errorCode).toBePositive(); expect(data.messages![0].receiveTime).toBeDateString(); diff --git a/tests/unit/api/phone-number-lookup-api.test.ts b/tests/unit/api/phone-number-lookup-api.test.ts index 14c62f9..8f1e555 100644 --- a/tests/unit/api/phone-number-lookup-api.test.ts +++ b/tests/unit/api/phone-number-lookup-api.test.ts @@ -23,12 +23,7 @@ describe('PhoneNumberLookupApi', () => { expect(status).toEqual(202); expect(data.requestId).toHaveLength(36); - expect(data.status).toBeOneOf([ - LookupStatusEnum.Complete, - LookupStatusEnum.InProgress, - LookupStatusEnum.Failed, - LookupStatusEnum.PartialComplete - ]); + expect(data.status).toBeOneOf(Object.values(LookupStatusEnum)); }); }); @@ -42,12 +37,7 @@ describe('PhoneNumberLookupApi', () => { expect(status).toEqual(200); expect(data.requestId).toHaveLength(36); - expect(data.status).toBeOneOf([ - LookupStatusEnum.Complete, - LookupStatusEnum.InProgress, - LookupStatusEnum.Failed, - LookupStatusEnum.PartialComplete - ]); + expect(data.status).toBeOneOf(Object.values(LookupStatusEnum)); expect(data.result).toBeInstanceOf(Array); expect(data.result![0]).toContainAllKeys([ 'Response Code', diff --git a/tests/unit/api/recordings-api.test.ts b/tests/unit/api/recordings-api.test.ts index ada6b30..37d8284 100644 --- a/tests/unit/api/recordings-api.test.ts +++ b/tests/unit/api/recordings-api.test.ts @@ -40,11 +40,11 @@ describe('RecordingsApi', () => { expect(data[0].transferCallerId).toHaveLength(12); expect(data[0].transferTo).toHaveLength(12); expect(data[0].duration).toStartWith('PT'); - expect(data[0].direction).toBeOneOf([CallDirectionEnum.Inbound, CallDirectionEnum.Outbound]); + expect(data[0].direction).toBeOneOf(Object.values(CallDirectionEnum)); expect(data[0].channels).toBeNumber(); expect(data[0].startTime).toBeDateString(); expect(data[0].endTime).toBeDateString(); - expect(data[0].fileFormat).toBeOneOf([FileFormatEnum.Wav, FileFormatEnum.Mp3]); + expect(data[0].fileFormat).toBeOneOf(Object.values(FileFormatEnum)); expect(data[0].status).toBeString(); expect(data[0].mediaUrl).toStartWith('http'); expect(data[0].transcription).toContainAllKeys(['id', 'status', 'completedTime', 'url']); @@ -72,11 +72,11 @@ describe('RecordingsApi', () => { expect(data[0].transferCallerId).toHaveLength(12); expect(data[0].transferTo).toHaveLength(12); expect(data[0].duration).toStartWith('PT'); - expect(data[0].direction).toBeOneOf([CallDirectionEnum.Inbound, CallDirectionEnum.Outbound]); + expect(data[0].direction).toBeOneOf(Object.values(CallDirectionEnum)); expect(data[0].channels).toBeNumber(); expect(data[0].startTime).toBeDateString(); expect(data[0].endTime).toBeDateString(); - expect(data[0].fileFormat).toBeOneOf([FileFormatEnum.Wav, FileFormatEnum.Mp3]); + expect(data[0].fileFormat).toBeOneOf(Object.values(FileFormatEnum)); expect(data[0].status).toBeString(); expect(data[0].mediaUrl).toStartWith('http'); expect(data[0].transcription).toContainAllKeys(['id', 'status', 'completedTime', 'url']); @@ -103,11 +103,11 @@ describe('RecordingsApi', () => { expect(data.transferCallerId).toHaveLength(12); expect(data.transferTo).toHaveLength(12); expect(data.duration).toStartWith('PT'); - expect(data.direction).toBeOneOf([CallDirectionEnum.Inbound, CallDirectionEnum.Outbound]); + expect(data.direction).toBeOneOf(Object.values(CallDirectionEnum)); expect(data.channels).toBeNumber(); expect(data.startTime).toBeDateString(); expect(data.endTime).toBeDateString(); - expect(data.fileFormat).toBeOneOf([FileFormatEnum.Wav, FileFormatEnum.Mp3]); + expect(data.fileFormat).toBeOneOf(Object.values(FileFormatEnum)); expect(data.status).toBeString(); expect(data.mediaUrl).toStartWith('http'); expect(data.transcription).toContainAllKeys(['id', 'status', 'completedTime', 'url']); From 2ac603a7199d0da0d3ea525409f0cb510ce19450 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Thu, 13 Feb 2025 10:24:26 -0500 Subject: [PATCH 6/6] add API unit and smoke tests --- .../smoke/toll-free-verification-api.test.ts | 18 ++ .../api/toll-free-verification-api.test.ts | 159 ++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 tests/smoke/toll-free-verification-api.test.ts create mode 100644 tests/unit/api/toll-free-verification-api.test.ts diff --git a/tests/smoke/toll-free-verification-api.test.ts b/tests/smoke/toll-free-verification-api.test.ts new file mode 100644 index 0000000..d2a4d91 --- /dev/null +++ b/tests/smoke/toll-free-verification-api.test.ts @@ -0,0 +1,18 @@ +//@ts-nocheck +import { TollFreeVerificationApi } from '../../api'; +import { Configuration } from '../../configuration'; + +describe('TollFreeVerificationApi', () => { + const config = new Configuration({username: BW_USERNAME, password: BW_PASSWORD}); + const tfvApi = new TollFreeVerificationApi(config); + + describe('listTollFreeUseCases', () => { + test('list toll free use cases', async () => { + const { status, data } = await tfvApi.listTollFreeUseCases(BW_ACCOUNT_ID); + + expect(status).toEqual(200); + expect(data).toBeInstanceOf(Array); + }); + }); + +}); diff --git a/tests/unit/api/toll-free-verification-api.test.ts b/tests/unit/api/toll-free-verification-api.test.ts new file mode 100644 index 0000000..9396876 --- /dev/null +++ b/tests/unit/api/toll-free-verification-api.test.ts @@ -0,0 +1,159 @@ +//@ts-nocheck +import { TollFreeVerificationApi } from '../../../api'; +import { Configuration } from '../../../configuration'; +import { CallbackTypeEnum, TfvStatusEnum, WebhookSubscriptionTypeEnum } from '../../../models'; + +describe('TollFreeVerificationApi', () => { + const config = new Configuration({ + username: BW_USERNAME, + password: BW_PASSWORD, + basePath: 'http://127.0.0.1:4010' + }); + const tfvApi = new TollFreeVerificationApi(config); + + const webhookSubscriptionRequestSchema = { + basicAuthentication: { + username: 'username', + password: 'password' + }, + callbackUrl: 'https://example.com', + sharedSecretKey: 'shared-secret-key' + }; + + describe('createWebhookSubscription', () => { + test('should create a webhook subscription', async () => { + const { status, data } = await tfvApi.createWebhookSubscription(BW_ACCOUNT_ID, webhookSubscriptionRequestSchema); + + expect(status).toEqual(201); + expect(data.id).toBeString(); + expect(data.accountId).toHaveLength(7); + expect(data.callbackUrl).toStartWith('http'); + expect(data.type).toBeOneOf(Object.values(WebhookSubscriptionTypeEnum)); + expect(data.basicAuthentication!.username).toBeString(); + expect(data.basicAuthentication!.password).toBeString(); + expect(data.createdDate).toBeDateString(); + expect(data.modifiedDate).toBeDateString(); + }); + }); + + describe('deleteWebhookSubscription', () => { + test('should delete a webhook subscription', async () => { + const { status } = await tfvApi.deleteWebhookSubscription(BW_ACCOUNT_ID, 'test-id-1234'); + + expect(status).toEqual(204); + }); + }); + + describe('getTollFreeVerificationStatus', () => { + test('should get toll-free verification status', async () => { + const { status, data } = await tfvApi.getTollFreeVerificationStatus(BW_ACCOUNT_ID, '+18005551234'); + + expect(status).toEqual(200); + expect(data.phoneNumber).toBeString(); + expect(data.status).toBeOneOf(Object.values(TfvStatusEnum)); + expect(data.internalTicketNumber).toBeString(); + expect(data.declineReasonDescription).toBeString(); + expect(data.resubmitAllowed).toBeBoolean(); + expect(data.createdDateTime).toBeDateString(); + expect(data.modifiedDateTime).toBeDateString(); + }); + }); + + describe('listTollFreeUseCases', () => { + test('should list toll-free use cases', async () => { + const { status, data } = await tfvApi.listTollFreeUseCases(); + + expect(status).toEqual(200); + expect(data).toBeInstanceOf(Array); + }); + }); + + describe('listWebhookSubscriptions', () => { + test('should list webhook subscriptions', async () => { + const { status, data } = await tfvApi.listWebhookSubscriptions(BW_ACCOUNT_ID); + + expect(status).toEqual(200); + expect(data).toHaveProperty('links'); + expect(data.links!.first).toBeString(); + expect(data.links!.next).toBeString(); + expect(data.links!.previous).toBeString(); + expect(data.links!.last).toBeString(); + expect(data.errors).toBeInstanceOf(Array); + expect(data.errors[0]!.code).toBeNumber(); + expect(data.errors[0]!.description).toBeString(); + expect(data.errors[0]!.telephoneNumbers).toBeInstanceOf(Array); + expect(data.errors[0]!.telephoneNumbers[0].telephoneNumber).toBeString(); + expect(data.data).toBeInstanceOf(Array); + expect(data.data[0]!.id).toBeString(); + expect(data.data[0]!.accountId).toBeString(); + expect(data.data[0]!.callbackUrl).toBeString(); + expect(data.data[0]!.type).toBeOneOf(Object.values(WebhookSubscriptionTypeEnum)); + expect(data.data[0]!.basicAuthentication.username).toBeString(); + expect(data.data[0]!.basicAuthentication.password).toBeString(); + expect(data.data[0]!.createdDate).toBeDateString(); + expect(data.data[0]!.modifiedDate).toBeDateString(); + }); + }); + + describe('requestTollFreeVerification', () => { + test('should request toll-free verification', async () => { + const verificationRequest = { + businessAddress: { + name: 'name', + addr1: 'addr1', + addr2: 'addr2', + city: 'city', + state: 'state', + zip: 'zip', + url: 'https://example.com' + }, + businessContact: { + firstName: 'first-name', + lastName: 'last-name', + email: 'email@email.com', + phoneNumber: '+19195551234' + }, + messageVolume: 12, + phoneNumbers: ['+18005551234'], + useCase: 'useCase', + useCaseSummary: 'useCaseSummary', + productionMessageContent: 'productionMessageContent', + optInWorkflow: { + description: 'description', + imageUrls: ['https://example.com'] + }, + additionalInformation: 'additionalInformation', + isvReseller: 'isvReseller' + }; + const { status } = await tfvApi.requestTollFreeVerification(BW_ACCOUNT_ID, verificationRequest); + + expect(status).toEqual(202); + }); + }); + + describe('updateTollFreeVerificationRequest', () => { + test('should update toll-free verification request', async () => { + const tfvSubmissionWrapper = { + submission: undefined + }; + const { status } = await tfvApi.updateTollFreeVerificationRequest(BW_ACCOUNT_ID, '+18005551234', tfvSubmissionWrapper); + expect(status).toEqual(202); + }); + }); + + describe('updateWebhookSubscription', () => { + test('should update webhook subscription', async () => { + const { status, data } = await tfvApi.updateWebhookSubscription(BW_ACCOUNT_ID, 'test-id-1234', webhookSubscriptionRequestSchema); + + expect(status).toEqual(200); + expect(data.id).toBeString(); + expect(data.accountId).toHaveLength(7); + expect(data.callbackUrl).toStartWith('http'); + expect(data.type).toBeOneOf(Object.values(WebhookSubscriptionTypeEnum)); + expect(data.basicAuthentication!.username).toBeString(); + expect(data.basicAuthentication!.password).toBeString(); + expect(data.createdDate).toBeDateString(); + expect(data.modifiedDate).toBeDateString(); + }); + }); +});